exports commands and scms with single name

This commit is contained in:
oleg 2014-12-04 00:24:00 +03:00
parent e78b39af29
commit 6cce9c9bbf
8 changed files with 11 additions and 19 deletions

View File

@ -8,7 +8,7 @@ function Command(params) {
this.isEmit = params.isEmit; this.isEmit = params.isEmit;
} }
exports.BaseCommand = Command; exports.Command = Command;
inherits(Command, EventEmitter); inherits(Command, EventEmitter);

View File

@ -1,10 +1,6 @@
'use strict'; 'use strict';
var typesHash = {
'shell': require('./shell').ShellCommand
};
exports.createCommand = function(params) { exports.createCommand = function(params) {
var Constructor = typesHash[params.type]; var Constructor = require('./' + params.type).Command;
return new Constructor(params); return new Constructor(params);
}; };

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var ParentCommand = require('./spawn').SpawnCommand, var ParentCommand = require('./spawn').Command,
inherits = require('util').inherits; inherits = require('util').inherits;
function Command(params) { function Command(params) {

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
var spawn = require('child_process').spawn, var spawn = require('child_process').spawn,
ParentCommand = require('./base').BaseCommand, ParentCommand = require('./base').Command,
inherits = require('util').inherits; inherits = require('util').inherits;
function Command(params) { function Command(params) {
@ -10,7 +10,7 @@ function Command(params) {
this.cwd = params.cwd; this.cwd = params.cwd;
} }
exports.SpawnCommand = Command; exports.Command = Command;
inherits(Command, ParentCommand); inherits(Command, ParentCommand);

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var ParentCommand = require('../command/spawn').SpawnCommand, var ParentCommand = require('../command/spawn').Command,
inherits = require('util').inherits; inherits = require('util').inherits;
function Scm(params) { function Scm(params) {
@ -11,7 +11,7 @@ function Scm(params) {
); );
} }
exports.BaseScm = Scm; exports.Scm = Scm;
inherits(Scm, ParentCommand); inherits(Scm, ParentCommand);

View File

@ -1,10 +1,6 @@
'use strict'; 'use strict';
var typesHash = {
'mercurial': require('./mercurial').MercurialScm
};
exports.createScm = function(params) { exports.createScm = function(params) {
var Constructor = typesHash[params.type]; var Constructor = require('./' + params.type).Scm;
return new Constructor(params); return new Constructor(params);
}; };

View File

@ -1,13 +1,13 @@
'use strict'; 'use strict';
var ParentScm = require('./base').BaseScm, var ParentScm = require('./base').Scm,
inherits = require('util').inherits; inherits = require('util').inherits;
function Scm(params) { function Scm(params) {
ParentScm.call(this, params); ParentScm.call(this, params);
} }
exports.MercurialScm = Scm; exports.Scm = Scm;
inherits(Scm, ParentScm); inherits(Scm, ParentScm);

View File

@ -4,7 +4,7 @@ var expect = require('expect.js'),
path = require('path'), path = require('path'),
fs = require('fs'), fs = require('fs'),
createScm = require('../lib/scm').createScm, createScm = require('../lib/scm').createScm,
SpawnCommand = require('../lib/command/spawn').SpawnCommand; SpawnCommand = require('../lib/command/spawn').Command;
['mercurial'].forEach(function(type) { ['mercurial'].forEach(function(type) {