mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-16 00:33:46 +01:00
fix RubyBundlerAnalyzer.accept
This commit is contained in:
@@ -55,6 +55,16 @@ public class RubyBundlerAnalyzer extends RubyGemspecAnalyzer {
|
||||
//Folder name that contains the gems by "bundle install"
|
||||
private static final String GEMS = "gems";
|
||||
|
||||
/**
|
||||
* Returns the name of the analyzer.
|
||||
*
|
||||
* @return the name of the analyzer.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return ANALYZER_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only accept *.gemspec files generated by "bundle install --deployment" under "specifications" folder.
|
||||
*/
|
||||
@@ -64,7 +74,7 @@ public class RubyBundlerAnalyzer extends RubyGemspecAnalyzer {
|
||||
boolean accepted = super.accept(pathname);
|
||||
if(accepted == true) {
|
||||
File parentDir = pathname.getParentFile();
|
||||
accepted = parentDir != null && parentDir.exists() && parentDir.getName().equals(SPECIFICATIONS);
|
||||
accepted = parentDir != null && parentDir.getName().equals(SPECIFICATIONS);
|
||||
}
|
||||
|
||||
return accepted;
|
||||
|
||||
@@ -78,7 +78,8 @@ public class RubyBundlerAnalyzerTest extends BaseTest {
|
||||
*/
|
||||
@Test
|
||||
public void testSupportsFiles() {
|
||||
assertThat(analyzer.accept(new File("test.gemspec")), is(true));
|
||||
assertThat(analyzer.accept(new File("test.gemspec")), is(false));
|
||||
assertThat(analyzer.accept(new File("specifications" + File.separator + "test.gemspec")), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user