File reorganization

This commit is contained in:
tknew2 2014-07-01 15:37:13 +02:00
parent d3d70a26c5
commit e3faaa5200
5 changed files with 44 additions and 12 deletions

View File

@ -13,7 +13,7 @@ var Satan = require('./Satan');
var Common = require('./Common');
var cst = require('../constants.js');
var extItps = require('./interpreter.json');
var InteractorDaemonizer = require('./InteractorDaemonizer');
var InteractorDaemonizer = require('./Interactor/InteractorDaemonizer');
var p = path;
var Deploy = require('pm2-deploy');

View File

@ -7,8 +7,8 @@ var crypto = require('crypto');
var fs = require('fs');
var debug = require('debug')('interface:driver'); // Interface
var os = require('os');
var cst = require('../constants.js');
var pkg = require('../package.json');
var cst = require('../../constants.js');
var pkg = require('../../package.json');
var sock = axon.socket('pub');
var rep = axon.socket('rep');

View File

@ -2,11 +2,11 @@
'use strict';
var fs = require('fs');
var cst = require('../constants.js');
var cst = require('../../constants.js');
var path = require('path');
var util = require('util');
var rpc = require('pm2-axon-rpc');
var Common = require('./Common');
var Common = require('../Common');
var debug = require('debug')('interface:daemon');
var axon = require('axon');

View File

@ -107,7 +107,7 @@ Satan.remoteWrapper = function() {
// Only require here because God init himself
var God = require('./God');
var InteractorDaemonizer = require('./InteractorDaemonizer.js');
var InteractorDaemonizer = require('./Interactor/InteractorDaemonizer.js');
Satan.processStateHandler(God);
@ -219,12 +219,11 @@ Satan.remoteWrapper = function() {
return God.clusters_db[pm2_env.pm_id].pm2_env.axm_actions.push(msg.data.data);
});
God.bus.onAny(function(data_v) {
debug(this.event);
var self = this;
// Avoid circular structure
InteractorDaemonizer.launchAndInteract({}, function(err, data) {
pub.emit(self.event, JSON.parse(Stringify(data_v)));
InteractorDaemonizer.launchAndInteract({}, function(err, data) {
God.bus.onAny(function(data_v) {
debug(this.event);
// Avoid circular structure
pub.emit(this.event, JSON.parse(Stringify(data_v)));
});
});

33
test/fixtures/ecosystem.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
"apps" : [{
"name" : "API",
"script" : "app.js",
"env": {
"COMMON_VARIABLE": "true"
},
"env_production" : {
"NODE_ENV": "production"
}
},{
"name" : "WEB",
"script" : "web.js"
}],
"deploy" : {
"production" : {
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "git@github.com:repo.git",
"path" : "/var/www/production",
"post-deploy" : "pm2 startOrRestart ecosystem.json --env production"
},
"dev" : {
"user" : "node",
"host" : "212.83.163.1",
"ref" : "origin/master",
"repo" : "git@github.com:repo.git",
"path" : "/var/www/development",
"post-deploy" : "pm2 startOrRestart ecosystem.json --env dev"
}
}
}