Skip to content

Commit

Permalink
#50 full dir
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 3, 2017
1 parent f8efc9b commit dca425a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 1 addition & 8 deletions src/main/java/org/jpeek/web/Reports.java
Expand Up @@ -134,14 +134,7 @@ public Func<String, Response> apply(final String group,
);
}
new App(input, output).analyze();
new Results().add(
String.format("%s:%s", group, artifact),
Double.parseDouble(
new XMLDocument(
output.resolve("index.xml").toFile()
).xpath("/index/@score").get(0)
)
);
new Results().add(String.format("%s:%s", group, artifact), output);
return new TypedPages(new Pages(output));
}

Expand Down
11 changes: 9 additions & 2 deletions src/main/java/org/jpeek/web/Results.java
Expand Up @@ -30,7 +30,9 @@
import com.jcabi.dynamo.Table;
import com.jcabi.dynamo.mock.H2Data;
import com.jcabi.dynamo.mock.MkRegion;
import com.jcabi.xml.XMLDocument;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -82,11 +84,16 @@ final class Results {
/**
* Add result.
* @param artifact The artifact, like "org.jpeek:jpeek"
* @param score The score [0..10]
* @param dir Directory with files
* @throws IOException If fails
*/
public void add(final String artifact, final double score)
public void add(final String artifact, final Path dir)
throws IOException {
final double score = Double.parseDouble(
new XMLDocument(
dir.resolve("index.xml").toFile()
).xpath("/index/@score").get(0)
);
this.table.put(
new Attributes()
.with("good", "true")
Expand Down

0 comments on commit dca425a

Please sign in to comment.