tasks/batch_git_clone.js
function deleteOldFiles(path){

      var deferred = Q.defer();

      // Don't delete existing files & folders if overwrite is off
      if(options.overWrite !== false){

        grunt.log.writeln('---> Deleting folder ==> '+path);

        rimraf(path,  function(err){
          if(err) {
            grunt.log.warn('---> There was an error deleting the existing repo folder : '+path+', error : '+err);
            deferred.reject(err);
          }else{
            deferred.resolve();
          }
        });

      }else{
        if(grunt.file.isDir(path)){
          grunt.log.writeln('---> Folder exists so plugin will not overwrite ==> '+path);
        }
        deferred.resolve();
      }

      return deferred.promise;

    }
function deleteOldFiles(path){

      var deferred = Q.defer();

      // Don't delete existing files & folders if overwrite is off
      if(options.overWrite !== false){

        grunt.log.writeln('---> Deleting folder ==> '+path);

        rimraf(path,  function(err){
          if(err) {
            grunt.log.warn('---> There was an error deleting the existing repo folder : '+path+', error : '+err);
            deferred.reject(err);
          }else{
            deferred.resolve();
          }
        });

      }else{
        if(grunt.file.isDir(path)){
          grunt.log.writeln('---> Folder exists so plugin will not overwrite ==> '+path);
        }
        deferred.resolve();
      }

      return deferred.promise;

    }
function deleteOldFiles ( path ) { var deferred = Q . defer ( ) ; // Don't delete existing files & folders if overwrite is off if ( options . overWrite !== false ) { grunt . log . writeln ( '---> Deleting folder ==> ' + path ) ; rimraf ( path , function ( err ) { if ( err ) { grunt . log . warn ( '---> There was an error deleting the existing repo folder : ' + path + ', error : ' + err ) ; deferred . reject ( err ) ; } else { deferred . resolve ( ) ; } } ) ; } else { if ( grunt . file . isDir ( path ) ) { grunt . log . writeln ( '---> Folder exists so plugin will not overwrite ==> ' + path ) ; } deferred . resolve ( ) ; } return deferred . promise ; }
delete the repo folder before repopulating it
delete the repo folder before repopulating it