
org.jasmine.SpecScanner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasmine-core Show documentation
Show all versions of jasmine-core Show documentation
A jasmine runner using the dynjs javascript runtime
The newest version!
package org.jasmine;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
public class SpecScanner {
private final FileSystem fileSystem = FileSystems.getDefault();
public Iterable findSpecs(String pattern){
if(!pattern.startsWith("./")){
pattern = "./" + pattern;
}
final PathMatcher pathMatcher = fileSystem.getPathMatcher("glob:" + pattern);
final List paths = newArrayList();
try{
Files.walkFileTree(fileSystem.getPath("."), new SimpleFileVisitor() {
@Override
public FileVisitResult visitFile(final Path file, BasicFileAttributes attrs) throws IOException {
if (pathMatcher.matches(file)) {
paths.add(file.toString());
}
return FileVisitResult.CONTINUE;
}
});
} catch (IOException e) {
throw new RuntimeException(e);
}
return paths;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy