diff --git a/lib/command/base.js b/lib/command/base.js index 4822864..3ae7ce8 100644 --- a/lib/command/base.js +++ b/lib/command/base.js @@ -5,7 +5,7 @@ var EventEmitter = require('events').EventEmitter, function Command(params) { params = params || {}; - this.isEmit = params.isEmit; + this.emitOut = params.emitOut; } exports.Command = Command; @@ -13,11 +13,11 @@ exports.Command = Command; inherits(Command, EventEmitter); Command.prototype.enableEmitter = function() { - this.isEmit = true; + this.emitOut = true; return this; }; Command.prototype.disableEmitter = function() { - this.isEmit = false; + this.emitOut = false; return this; }; diff --git a/lib/command/spawn.js b/lib/command/spawn.js index 4895bb3..2bf1ac7 100644 --- a/lib/command/spawn.js +++ b/lib/command/spawn.js @@ -20,7 +20,7 @@ inherits(Command, ParentCommand); */ Command.prototype.run = function(params, callback) { var self = this, - stdout = self.isCollect ? '' : null; + stdout = self.collectOut ? '' : null; if (!params.cmd) return callback(new Error('`cmd` is not set')); if (!params.args) return callback(new Error('`args` is not set')); callback = utils.once(callback); @@ -28,8 +28,8 @@ Command.prototype.run = function(params, callback) { params.options.cwd = params.options.cwd || this.cwd; var cmd = spawn(params.cmd, params.args, params.options); cmd.stdout.on('data', function(data) { - if (self.isEmit) self.emit('stdout', data); - if (self.isCollect) stdout += data; + if (self.emitOut) self.emit('stdout', data); + if (self.collectOut) stdout += data; }); cmd.stderr.on('data', function(data) { callback(new Error('Spawned command outputs to stderr: ' + data)); diff --git a/lib/scm/base.js b/lib/scm/base.js index ee5bbae..faa2541 100644 --- a/lib/scm/base.js +++ b/lib/scm/base.js @@ -9,7 +9,7 @@ function Scm(params) { if (!this.repository && !this.cwd) throw new Error( '`repository` or `cwd` must be set' ); - this.isCollect = true; + this.collectOut = true; } exports.Scm = Scm; diff --git a/test/commands/shell.js b/test/commands/shell.js index a0aecaf..d5aaad8 100644 --- a/test/commands/shell.js +++ b/test/commands/shell.js @@ -8,7 +8,7 @@ describe('Shell command', function() { var shellCommand; it('Should be created without errors', function() { shellCommand = new ShellCommand({ - isEmit: true + emitOut: true }); });