|
|
|
@ -31,11 +31,15 @@ var fs = require('fs'),
|
|
|
|
|
|
|
|
|
|
Plugins.initialized = false;
|
|
|
|
|
|
|
|
|
|
Plugins.init = function() {
|
|
|
|
|
Plugins.init = function(nbbApp, nbbMiddleware) {
|
|
|
|
|
if (Plugins.initialized) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app = nbbApp;
|
|
|
|
|
middleware = nbbMiddleware;
|
|
|
|
|
hotswap.prepare(nbbApp);
|
|
|
|
|
|
|
|
|
|
if (global.env === 'development') {
|
|
|
|
|
winston.info('[plugins] Initializing plugins system');
|
|
|
|
|
}
|
|
|
|
@ -62,12 +66,6 @@ var fs = require('fs'),
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Plugins.prepareApp = function(nbbApp, nbbMiddleware) {
|
|
|
|
|
app = nbbApp;
|
|
|
|
|
middleware = nbbMiddleware;
|
|
|
|
|
hotswap.prepare(nbbApp);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Plugins.ready = function(callback) {
|
|
|
|
|
if (!Plugins.initialized) {
|
|
|
|
|
emitter.once('plugins:loaded', callback);
|
|
|
|
@ -124,9 +122,6 @@ var fs = require('fs'),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Plugins.reloadRoutes = function(callback) {
|
|
|
|
|
if (!app || !middleware || !controllers) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
var router = express.Router();
|
|
|
|
|
router.hotswapId = 'plugins';
|
|
|
|
|
router.render = function() {
|
|
|
|
@ -141,7 +136,6 @@ var fs = require('fs'),
|
|
|
|
|
winston.info('[plugins] All plugins reloaded and rerouted');
|
|
|
|
|
callback();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Plugins.loadPlugin = function(pluginPath, callback) {
|
|
|
|
|