mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 16:16:16 +00:00
expose scm
This commit is contained in:
parent
d44071deaf
commit
dd4c0c633a
@ -1,6 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
var BaseScm = require('./base').Scm;
|
||||
|
||||
exports.BaseScm = BaseScm;
|
||||
|
||||
var constructors = {
|
||||
git: require('./git').Scm,
|
||||
mercurial: require('./mercurial').Scm
|
||||
};
|
||||
|
||||
exports.register = function(type, constructor) {
|
||||
constructors[type] = constructor;
|
||||
};
|
||||
|
||||
exports.createScm = function(params) {
|
||||
var Constructor = require('./' + params.type).Scm;
|
||||
if (params.type in constructors === false) {
|
||||
throw new Error('Unknown scm type: ' + params.type);
|
||||
}
|
||||
|
||||
var Constructor = constructors[params.type];
|
||||
return new Constructor(params);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user