extract is cloned executor method

This commit is contained in:
oleg 2016-02-26 23:58:46 +03:00
parent 9a8bd90855
commit 5a6a440d11
2 changed files with 10 additions and 7 deletions

View File

@ -4,7 +4,6 @@ var Steppy = require('twostep').Steppy,
path = require('path'), path = require('path'),
_ = require('underscore'), _ = require('underscore'),
EventEmitter = require('events').EventEmitter, EventEmitter = require('events').EventEmitter,
fs = require('fs'),
inherits = require('util').inherits; inherits = require('util').inherits;
function Executor(params) { function Executor(params) {
@ -97,14 +96,11 @@ Executor.prototype._getChanges = function(params, callback) {
scm, isFirstRun, oldRev; scm, isFirstRun, oldRev;
Steppy( Steppy(
function() { function() {
var slot = this.slot(); self._isCloned(this.slot());
fs.exists(self.cwd, function(exists) {
slot(null, exists);
});
}, },
function(err, exists) { function(err, cloned) {
var scmParams = {type: params.type}; var scmParams = {type: params.type};
if (exists) { if (cloned) {
scmParams.cwd = self.cwd; scmParams.cwd = self.cwd;
isFirstRun = false; isFirstRun = false;
} else { } else {

View File

@ -5,6 +5,7 @@ var Steppy = require('twostep').Steppy,
ParentExecutor = require('./base').Executor, ParentExecutor = require('./base').Executor,
createScm = require('../scm').createScm, createScm = require('../scm').createScm,
createCommand = require('../command').createCommand, createCommand = require('../command').createCommand,
fs = require('fs'),
_ = require('underscore'); _ = require('underscore');
function Executor(params) { function Executor(params) {
@ -22,3 +23,9 @@ Executor.prototype._createScm = function(params) {
Executor.prototype._createCommand = function(params) { Executor.prototype._createCommand = function(params) {
return createCommand(params); return createCommand(params);
}; };
Executor.prototype._isCloned = function(callback) {
fs.exists(this.cwd, function(exists) {
callback(null, exists);
});
};