Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
#285 added ignored patterns config
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Oct 12, 2018
1 parent 5f003c2 commit 7ba50e8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/main/java/com/amihaiemil/charles/github/CharlesYml.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public interface CharlesYml {
*/
String driver();

/**
* Patterns that should be ignored when graph-crawling (index-site command).
* @return List of patterns.
*/
List<String> ignored();

/**
* Default .charles.yml file.
*/
Expand All @@ -73,6 +79,11 @@ public boolean tweet() {
public String driver() {
return "chrome";
}

@Override
public List<String> ignored() {
return new ArrayList<>();
}
}

}
12 changes: 12 additions & 0 deletions src/main/java/com/amihaiemil/charles/github/CharlesYmlInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,16 @@ public String driver() {
return "chrome";
}
}

@Override
public List<String> ignored() {
final List<String> ignored = new ArrayList<>();
final YamlSequence sequence = this.yaml.yamlSequence("ignored");
if(sequence != null) {
for(int i=0;i<sequence.size();i++) {
ignored.add(sequence.string(i));
}
}
return ignored;
}
}
4 changes: 3 additions & 1 deletion src/main/java/com/amihaiemil/charles/github/IndexSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ public WebCrawl graphCrawl(Command command, Logger logger) throws IOException {
+ " .The website will be crawled as a graph, going in-depth from the index page.");

WebCrawl siteCrawl = new GraphCrawl(
siteIndexUrl, driver, new IgnoredPatterns(),
siteIndexUrl,
driver,
new IgnoredPatterns(command.repo().charlesYml().ignored()),
new AmazonElasticSearch(command.indexName()),
20
);
Expand Down

0 comments on commit 7ba50e8

Please sign in to comment.