From 4304cd009e4a0037fa7b0440240a33aff0e082a5 Mon Sep 17 00:00:00 2001 From: oleg Date: Mon, 29 Feb 2016 23:53:42 +0300 Subject: [PATCH] expose command, executor, node and scm to api --- app.js | 8 ++++++++ lib/command/index.js | 4 ++++ lib/executor/index.js | 4 ++++ lib/node/index.js | 8 ++++++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 3ac9439..cdca103 100644 --- a/app.js +++ b/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: {}, diff --git a/lib/command/index.js b/lib/command/index.js index 4bf01c2..886f3ca 100644 --- a/lib/command/index.js +++ b/lib/command/index.js @@ -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); diff --git a/lib/executor/index.js b/lib/executor/index.js index c17c42d..ba8c43b 100644 --- a/lib/executor/index.js +++ b/lib/executor/index.js @@ -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); diff --git a/lib/node/index.js b/lib/node/index.js index 8db4ad7..d62fd7e 100644 --- a/lib/node/index.js +++ b/lib/node/index.js @@ -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];