Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/main/java/hudson/plugins/rake/RvmUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public static RubyInstallation[] getRvmRubies(Rvm rvm) {
String newpath = "";
FilePath specifications = getSpecifications(gemCandidate);
if (specifications != null) {
Collection<FilePath> specs = specifications.list(rakeFilter);
if (specs == null || specs.size() == 0) {
Collection<FilePath> specs = getRakeSpecifications(specifications);
if (specs.size() == 0) {
// We did not find the rake gem in this gemset's bin directory; check in global
specifications = getSpecifications(global);
if (specifications != null) {
specs = specifications.list(rakeFilter);
if (specs == null || specs.size() == 0) {
specs = getRakeSpecifications(specifications);
if (specs.size() == 0) {
// Rake not found in global either; this gemset is unusable
continue;
} else {
Expand Down Expand Up @@ -177,5 +177,25 @@ public boolean accept(File pathname) {
}
}

private static Collection<FilePath> getRakeSpecifications(FilePath specifications)
throws InterruptedException, IOException {
Collection<FilePath> rakeSpecs = new LinkedHashSet<FilePath>();

List<FilePath> specs = specifications.list(rakeFilter);
if(specs != null) {
rakeSpecs.addAll(specs);
}


for(FilePath subDirectory: specifications.listDirectories()) {
specs = subDirectory.list(rakeFilter);
if(specs != null) {
rakeSpecs.addAll(specs);
}
}
return rakeSpecs;
}


private static FileFilter rakeFilter = new RakeSpecFilter();
}