From baceedd70e9de18aa81d5f234c473af5a18a834b Mon Sep 17 00:00:00 2001 From: oleg Date: Sun, 28 Feb 2016 22:13:24 +0300 Subject: [PATCH] do not set default command for scm --- lib/executor/local.js | 4 +++- lib/scm/base.js | 2 ++ lib/scm/index.js | 5 ----- test/scm.js | 9 +++++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/executor/local.js b/lib/executor/local.js index 2b21cee..b22a4df 100644 --- a/lib/executor/local.js +++ b/lib/executor/local.js @@ -6,7 +6,7 @@ var Steppy = require('twostep').Steppy, createScm = require('../scm').createScm, createCommand = require('../command').createCommand, fs = require('fs'), - _ = require('underscore'); + SpawnCommand = require('../command/spawn').Command; function Executor(params) { ParentExecutor.call(this, params); @@ -17,6 +17,8 @@ inherits(Executor, ParentExecutor); exports.Executor = Executor; Executor.prototype._createScm = function(params) { + params.command = new SpawnCommand(); + return createScm(params); }; diff --git a/lib/scm/base.js b/lib/scm/base.js index e012136..a9ab156 100644 --- a/lib/scm/base.js +++ b/lib/scm/base.js @@ -18,6 +18,8 @@ function Scm(params) { self.command = params.command; + if (!self.command) throw new Error('`command` is required'); + self.command.setParams({ collectOut: true, emitIn: true, diff --git a/lib/scm/index.js b/lib/scm/index.js index 7b74c75..89d0ddc 100644 --- a/lib/scm/index.js +++ b/lib/scm/index.js @@ -1,11 +1,6 @@ 'use strict'; -var SpawnCommand = require('../command/spawn').Command; - exports.createScm = function(params) { var Constructor = require('./' + params.type).Scm; - - params.command = params.command || new SpawnCommand(); - return new Constructor(params); }; diff --git a/test/scm.js b/test/scm.js index 214da67..3e9717a 100644 --- a/test/scm.js +++ b/test/scm.js @@ -42,7 +42,8 @@ var expect = require('expect.js'), it('create scm instance attached to new repository without errors', function() { scm = createScm({ type: type, - repository: originalRepositoryPath + repository: originalRepositoryPath, + command: new SpawnCommand() }); }); @@ -129,7 +130,11 @@ var expect = require('expect.js'), }); it('create scm instance attached to existing `cwd` without errors', function() { - scm = createScm({type: type, cwd: repositoryPath}); + scm = createScm({ + type: type, + cwd: repositoryPath, + command: new SpawnCommand() + }); }); it('expect repository log from rev0 to default revision equals to ' +