예제 #1
0
파일: GitUtils.java 프로젝트: snjeza/core
  /**
   * Initialize a new git repository.
   *
   * @param dir The directory in which to create a new .git/ folder and repository.
   */
  public static Git init(final DirectoryResource dir) throws IOException {
    FileResource<?> gitDir = dir.getChildDirectory(".git").reify(FileResource.class);
    gitDir.mkdirs();

    RepositoryBuilder db =
        new RepositoryBuilder().setGitDir(gitDir.getUnderlyingResourceObject()).setup();
    Git git = new Git(db.build());
    git.getRepository().create();
    return git;
  }
예제 #2
0
 @Override
 public DirectoryResource getTestResourceFolder() {
   MavenCoreFacet mavenFacet = project.getFacet(MavenCoreFacet.class);
   Build build = mavenFacet.getPOM().getBuild();
   final String resFolderName;
   if (build != null
       && !build.getTestResources().isEmpty()
       && build.getTestResources().get(0).getDirectory() != null) {
     resFolderName = build.getTestResources().get(0).getDirectory();
   } else {
     resFolderName = "src" + File.separator + "test" + File.separator + "resources";
   }
   DirectoryResource projectRoot = project.getProjectRoot();
   return projectRoot.getChildDirectory(resFolderName);
 }
 @Override
 public DirectoryResource getSourceFolder() {
   DirectoryResource projectRoot = project.getProjectRoot();
   return projectRoot.getChildDirectory("src" + File.separator + "main" + File.separator + "java");
 }