mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 16:26:18 +00:00
expose command, executor, node and scm to api
This commit is contained in:
parent
2a7d6dfb98
commit
4304cd009e
8
app.js
8
app.js
@ -16,6 +16,10 @@ var env = process.env.NODE_ENV || 'development',
|
||||
ProjectsCollection = require('./lib/project').ProjectsCollection,
|
||||
BuildsCollection = require('./lib/build').BuildsCollection,
|
||||
libLogger = require('./lib/logger'),
|
||||
libNode = require('./lib/node'),
|
||||
libCommand = require('./lib/command'),
|
||||
libExecutor = require('./lib/executor'),
|
||||
libScm = require('./lib/scm'),
|
||||
EventEmitter = require('events').EventEmitter,
|
||||
validateConfig = require('./lib/validateConfig'),
|
||||
utils = require('./lib/utils');
|
||||
@ -64,6 +68,10 @@ app.lib = {};
|
||||
app.lib.BaseReaderLoader = BaseReaderLoader;
|
||||
app.lib.BaseNotifierTransport = BaseNotifierTransport;
|
||||
app.lib.logger = libLogger;
|
||||
app.lib.command = libCommand;
|
||||
app.lib.executor = libExecutor;
|
||||
app.lib.scm = libScm;
|
||||
app.lib.node = libNode;
|
||||
|
||||
var configDefaults = {
|
||||
notify: {},
|
||||
|
@ -1,5 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var SpawnCommand = require('./spawn').Command;
|
||||
|
||||
exports.SpawnCommand = SpawnCommand;
|
||||
|
||||
exports.createCommand = function(params) {
|
||||
var Constructor = require('./' + params.type).Command;
|
||||
return new Constructor(params);
|
||||
|
@ -1,5 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var BaseExecutor = require('./base').Executor;
|
||||
|
||||
exports.BaseExecutor = BaseExecutor;
|
||||
|
||||
exports.createExecutor = function(params) {
|
||||
var Constructor = require('./' + params.type).Executor;
|
||||
return new Constructor(params);
|
||||
|
@ -1,16 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var BaseNode = require('./base').Node;
|
||||
|
||||
exports.BaseNode = BaseNode;
|
||||
|
||||
var constructors = {
|
||||
local: require('./local').Node
|
||||
};
|
||||
|
||||
exports.register = function(type, constructor) {
|
||||
constructor[type] = constructor;
|
||||
constructors[type] = constructor;
|
||||
};
|
||||
|
||||
exports.createNode = function(params) {
|
||||
if (params.type in constructors === false) {
|
||||
throw new Error('Unknown node type: ', params.type);
|
||||
throw new Error('Unknown node type: ' + params.type);
|
||||
}
|
||||
|
||||
var Constructor = constructors[params.type];
|
||||
|
Loading…
Reference in New Issue
Block a user