diff --git a/lib/command/base.js b/lib/command/base.js index 68ddfee..4822864 100644 --- a/lib/command/base.js +++ b/lib/command/base.js @@ -8,7 +8,7 @@ function Command(params) { this.isEmit = params.isEmit; } -exports.BaseCommand = Command; +exports.Command = Command; inherits(Command, EventEmitter); diff --git a/lib/command/index.js b/lib/command/index.js index d214875..4bf01c2 100644 --- a/lib/command/index.js +++ b/lib/command/index.js @@ -1,10 +1,6 @@ 'use strict'; -var typesHash = { - 'shell': require('./shell').ShellCommand -}; - exports.createCommand = function(params) { - var Constructor = typesHash[params.type]; + var Constructor = require('./' + params.type).Command; return new Constructor(params); }; diff --git a/lib/command/shell.js b/lib/command/shell.js index eeabd4b..73a6927 100644 --- a/lib/command/shell.js +++ b/lib/command/shell.js @@ -1,6 +1,6 @@ 'use strict'; -var ParentCommand = require('./spawn').SpawnCommand, +var ParentCommand = require('./spawn').Command, inherits = require('util').inherits; function Command(params) { diff --git a/lib/command/spawn.js b/lib/command/spawn.js index c671b57..71bd9c8 100644 --- a/lib/command/spawn.js +++ b/lib/command/spawn.js @@ -1,7 +1,7 @@ 'use strict'; var spawn = require('child_process').spawn, - ParentCommand = require('./base').BaseCommand, + ParentCommand = require('./base').Command, inherits = require('util').inherits; function Command(params) { @@ -10,7 +10,7 @@ function Command(params) { this.cwd = params.cwd; } -exports.SpawnCommand = Command; +exports.Command = Command; inherits(Command, ParentCommand); diff --git a/lib/scm/base.js b/lib/scm/base.js index d25c76a..6531b49 100644 --- a/lib/scm/base.js +++ b/lib/scm/base.js @@ -1,6 +1,6 @@ 'use strict'; -var ParentCommand = require('../command/spawn').SpawnCommand, +var ParentCommand = require('../command/spawn').Command, inherits = require('util').inherits; function Scm(params) { @@ -11,7 +11,7 @@ function Scm(params) { ); } -exports.BaseScm = Scm; +exports.Scm = Scm; inherits(Scm, ParentCommand); diff --git a/lib/scm/index.js b/lib/scm/index.js index 3b28630..89d0ddc 100644 --- a/lib/scm/index.js +++ b/lib/scm/index.js @@ -1,10 +1,6 @@ 'use strict'; -var typesHash = { - 'mercurial': require('./mercurial').MercurialScm -}; - exports.createScm = function(params) { - var Constructor = typesHash[params.type]; + var Constructor = require('./' + params.type).Scm; return new Constructor(params); }; diff --git a/lib/scm/mercurial.js b/lib/scm/mercurial.js index de67dd6..dce5dea 100644 --- a/lib/scm/mercurial.js +++ b/lib/scm/mercurial.js @@ -1,13 +1,13 @@ 'use strict'; -var ParentScm = require('./base').BaseScm, +var ParentScm = require('./base').Scm, inherits = require('util').inherits; function Scm(params) { ParentScm.call(this, params); } -exports.MercurialScm = Scm; +exports.Scm = Scm; inherits(Scm, ParentScm); diff --git a/test/scm.js b/test/scm.js index d819d73..7639b20 100644 --- a/test/scm.js +++ b/test/scm.js @@ -4,7 +4,7 @@ var expect = require('expect.js'), path = require('path'), fs = require('fs'), createScm = require('../lib/scm').createScm, - SpawnCommand = require('../lib/command/spawn').SpawnCommand; + SpawnCommand = require('../lib/command/spawn').Command; ['mercurial'].forEach(function(type) {