Ejemplo n.º 1
0
 public static Git clone(final DirectoryResource dir, final String repoUri)
     throws GitAPIException {
   CloneCommand clone =
       Git.cloneRepository().setURI(repoUri).setDirectory(dir.getUnderlyingResourceObject());
   Git git = clone.call();
   return git;
 }
Ejemplo n.º 2
0
 public List<File> searchForAllResources(ResourcesEnum resources) {
   this.resources = new ArrayList<File>();
   this.searchString = resources.toString();
   DirectoryResource root = project.getProjectRoot();
   File[] files = root.getUnderlyingResourceObject().listFiles();
   iterateFiles(files);
   return this.resources;
 }
Ejemplo n.º 3
0
  public List<File> searchForAllResourcesRecursive(String sourcePackage) {
    try {
      System.out.println(">>> search recursive");
      if (sourcePackage.endsWith(".*")) {
        sourcePackage = sourcePackage.substring(0, sourcePackage.length() - 2);
      }
      this.resources = new ArrayList<File>();
      this.searchString = resources.toString();
      DirectoryResource root = Utils.getSourcePackageAsDirResource(project, sourcePackage);
      System.out.println("root: " + root.getUnderlyingResourceObject().getAbsolutePath());
      File[] files = root.getUnderlyingResourceObject().listFiles();
      System.out.println("filesxxx: " + Arrays.asList(files).toString());
      iterateFiles(files);
      return this.resources;

    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
Ejemplo n.º 4
0
  public List<File> searchForAllResources(String sourcePackage) {
    try {
      this.resources = new ArrayList<File>();
      this.searchString = resources.toString();
      DirectoryResource root = Utils.getSourcePackageAsDirResource(project, sourcePackage);
      File[] files = root.getUnderlyingResourceObject().listFiles();
      System.out.println("files: " + files);

      // search for all resources in the given package
      if (sourcePackage.endsWith(".*")) {
        return Arrays.asList(files);
      }
      // search for resource for given name
      else {
        this.resources.add(Utils.getSourceFileForClass(project, sourcePackage));
        return this.resources;
      }

    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
Ejemplo n.º 5
0
 public static Git git(final DirectoryResource dir) throws IOException {
   RepositoryBuilder db = new RepositoryBuilder().findGitDir(dir.getUnderlyingResourceObject());
   return new Git(db.build());
 }