diff --git a/lib/executor/base.js b/lib/executor/base.js index 4e4fcc4..d46d5ed 100644 --- a/lib/executor/base.js +++ b/lib/executor/base.js @@ -4,7 +4,6 @@ var Steppy = require('twostep').Steppy, path = require('path'), _ = require('underscore'), EventEmitter = require('events').EventEmitter, - fs = require('fs'), inherits = require('util').inherits; function Executor(params) { @@ -97,14 +96,11 @@ Executor.prototype._getChanges = function(params, callback) { scm, isFirstRun, oldRev; Steppy( function() { - var slot = this.slot(); - fs.exists(self.cwd, function(exists) { - slot(null, exists); - }); + self._isCloned(this.slot()); }, - function(err, exists) { + function(err, cloned) { var scmParams = {type: params.type}; - if (exists) { + if (cloned) { scmParams.cwd = self.cwd; isFirstRun = false; } else { diff --git a/lib/executor/local.js b/lib/executor/local.js index 6c25f04..2b21cee 100644 --- a/lib/executor/local.js +++ b/lib/executor/local.js @@ -5,6 +5,7 @@ var Steppy = require('twostep').Steppy, ParentExecutor = require('./base').Executor, createScm = require('../scm').createScm, createCommand = require('../command').createCommand, + fs = require('fs'), _ = require('underscore'); function Executor(params) { @@ -22,3 +23,9 @@ Executor.prototype._createScm = function(params) { Executor.prototype._createCommand = function(params) { return createCommand(params); }; + +Executor.prototype._isCloned = function(callback) { + fs.exists(this.cwd, function(exists) { + callback(null, exists); + }); +};