Skip to content

Commit

Permalink
filter version number when retrieving list of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
pepite committed Jan 7, 2014
1 parent 80cd00e commit 8f5a0d4
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions framework/src/play/deps/YamlParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,30 @@ public static List<String> getOrderedModuleList(File file) throws Oops {
if (data.containsKey("require")) {
if (data.get("require") instanceof List) {

List dependencies = (List) data.get("require");
// filter out play
dependencies.remove("play");
System.out.println("loading modules " + dependencies);
List<String> dependencies = filterModuleName((List<String>) data.get("require"));

return dependencies;
}
}
return new ArrayList<String>();
}

private static List<String> filterModuleName(List<String> dependencies) {
List<String> moduleNames = new ArrayList<String>();
for (String name : dependencies) {
String filteredName = getModuleName(name);
if (!"play".equals(filteredName)) {
moduleNames.add(filteredName);
}
}
return moduleNames;
}

private static String getModuleName(String name) {
int index = name.indexOf(" ");
if (index > 0) {
return name.substring(0, index);
}
return name;
}
}

0 comments on commit 8f5a0d4

Please sign in to comment.