From 318c14cd432ee4191fef0c0f4f1a0b11064abe76 Mon Sep 17 00:00:00 2001 From: Sebastian Dechant Date: Sat, 20 Feb 2016 21:11:17 +0100 Subject: [PATCH] make it actionhero v13 ready ;-) --- actions/calcStatus.js | 1 - actions/getPlugins.js | 64 ++++++++++++++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/actions/calcStatus.js b/actions/calcStatus.js index a665d7f..ad10543 100644 --- a/actions/calcStatus.js +++ b/actions/calcStatus.js @@ -63,7 +63,6 @@ action.run = function(api, data, next){ // iterate through all available statistics and get their corresponding timeseries value async.each(stats, function(stat, callback) { api.ahDashboard.timesSeries.getHits(stat, timeInterval, timechunks, function(err, res){ - console.dir(res); for(var a in res){ res[a].push(new Date((res[a][0]*1000))); } diff --git a/actions/getPlugins.js b/actions/getPlugins.js index 1506591..eece760 100644 --- a/actions/getPlugins.js +++ b/actions/getPlugins.js @@ -18,36 +18,68 @@ action.outputExample = { action.run = function(api, data, next){ api.ahDashboard.session.checkAuth(data, function(session){ var plugins = []; - api.config.general.paths.plugin.forEach(function(p){ - api.config.general.plugins.forEach(function(pluginName){ - var pluginPackageBase = path.normalize(p + '/' + pluginName); - // Check if plugin folder isnt ah root folder AND the folder exists (if multiple plugins folder are defined) - if(api.project_root != pluginPackageBase && fs.existsSync(pluginPackageBase)){ - var plugin = {}; + var foundPlugins = []; + + // try to get any plugin link + [ 'actions', 'tasks', 'public', 'servers', 'initializers'].forEach(function(pluginPath){ + // get a local link directory + var localLinkDirectory = api.projectRoot + path.sep + pluginPath + path.sep + 'plugins'; + + // check if the directory exists + if( fs.existsSync(localLinkDirectory) ){ + // when it exists, read the whole directory + var pluginDir = fs.readdirSync(localLinkDirectory); + // now iterate over all registered plugins + for(var i=0; i