mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 17:46:18 +00:00
http api uses deps via app
This commit is contained in:
parent
fbdfc28129
commit
a481334759
5
app.js
5
app.js
@ -16,7 +16,7 @@ var env = process.env.NODE_ENV || 'development',
|
||||
|
||||
var app = new EventEmitter(),
|
||||
logger = libLogger('app'),
|
||||
httpApi = require('./httpApi')(app);
|
||||
httpApi;
|
||||
|
||||
var staticPath = path.join(__dirname, 'static'),
|
||||
staticServer = new nodeStatic.Server(staticPath);
|
||||
@ -56,6 +56,7 @@ app.lib = {};
|
||||
app.lib.reader = reader;
|
||||
app.lib.notifier = notifier;
|
||||
app.lib.logger = libLogger;
|
||||
app.lib.project = project;
|
||||
|
||||
var configDefaults = {
|
||||
notify: {},
|
||||
@ -214,6 +215,8 @@ Steppy(
|
||||
require(plugin).register(app);
|
||||
});
|
||||
|
||||
httpApi = require('./httpApi')(app);
|
||||
|
||||
notifier.init(app.config.notify, this.slot());
|
||||
|
||||
require('./projectsWatcher').init(app, this.slot());
|
||||
|
10
httpApi.js
10
httpApi.js
@ -2,10 +2,7 @@
|
||||
|
||||
var Steppy = require('twostep').Steppy,
|
||||
_ = require('underscore'),
|
||||
querystring = require('querystring'),
|
||||
logger = require('./lib/logger')('http api'),
|
||||
project = require('./lib/project');
|
||||
|
||||
querystring = require('querystring');
|
||||
/*
|
||||
* Pure rest api on pure nodejs follows below
|
||||
*/
|
||||
@ -51,6 +48,7 @@ router.getRoute = function(req) {
|
||||
};
|
||||
|
||||
module.exports = function(app) {
|
||||
var logger = app.lib.logger('http api');
|
||||
|
||||
// run building of a project
|
||||
router.post('/api/1.0/builds', function(req, res, next) {
|
||||
@ -83,7 +81,7 @@ module.exports = function(app) {
|
||||
Steppy(
|
||||
function() {
|
||||
logger.log('Cleaning up project "%s"', projectName);
|
||||
project.remove({
|
||||
app.lib.project.remove({
|
||||
baseDir: app.config.paths.projects,
|
||||
name: projectName
|
||||
}, this.slot());
|
||||
@ -122,7 +120,7 @@ module.exports = function(app) {
|
||||
);
|
||||
}
|
||||
|
||||
project.rename({
|
||||
app.lib.project.rename({
|
||||
baseDir: app.config.paths.projects,
|
||||
name: projectName,
|
||||
newName: newProjectName
|
||||
|
Loading…
Reference in New Issue
Block a user