Example #1
0
 /** Creates a .gitignore file into the working directory */
 private void createGitIgnoreFile() {
   /**
    * create .gitignore file as in
    * https://github.com/cloudspokes/jenkins-test/blob/master/.gitignore if no filenames are give,
    * creates an empty one (if .gitignore file does not already exists). If .gitfile present,
    * appends to the end.
    */
   File gitIgnore = new File(this.workingFolderPath.concat("/.gitignore"));
   FileUtils.writeToFile(gitIgnore, ignoreList, true);
 }
Example #2
0
  /** Create the working folder (later deleted) */
  private void createWorkingFolder() throws RuntimeException {
    if (this.workingFolder == null
        && (this.workingFolderPath == null || this.workingFolderPath.equals("")))
      throw new RuntimeException("Class needs a valid working folder!");

    if (this.workingFolder == null) {
      this.workingFolder = new File(this.workingFolderPath);
    } else {
      // sanitize working folder. If it exists and is a directory, delete
      // it. If it is a file, refuse to continue.
      if (this.workingFolder.exists()) {
        if (this.workingFolder.isFile()) {
          throw new RuntimeException("Working folder exists, and is a file!");
        }
        if (this.workingFolder.isDirectory()) {
          Logger.log("Deleting existing working directory.");
          FileUtils.deleteFolder(this.workingFolder);
        }
      }
    }

    // create temporary directory for the local repository...
    this.workingFolder = FileUtils.createFolder(this.workingFolder);
  }
Example #3
0
 /** Deletes the working folder */
 private void cleanupWorkingFolder() {
   // cleanup temporary folder...
   FileUtils.deleteFolder(this.workingFolder);
 }