http api uses deps via app

This commit is contained in:
oleg 2015-12-06 23:46:24 +03:00
parent fbdfc28129
commit a481334759
2 changed files with 8 additions and 7 deletions

5
app.js
View File

@ -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());

View File

@ -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