From 61275481392e7d40045c9f14742fde5e6e4661d8 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 10 Jan 2015 00:10:20 +0100 Subject: [PATCH 1/3] add exclude placeholder --- config/development.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/development.json b/config/development.json index 6c513bc..749f04a 100644 --- a/config/development.json +++ b/config/development.json @@ -6,5 +6,8 @@ "name" : "heimcontroljs", "port" : "27017", "user" : {} + }, + "plugins": { + "exclude": [] } } \ No newline at end of file From a874062ff5e9ecdefd0c21431ea74d5688fb918a Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 10 Jan 2015 00:10:53 +0100 Subject: [PATCH 2/3] pass the exclude plugins array to the helper function --- heimcontrol.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heimcontrol.js b/heimcontrol.js index f66c206..4dd02fc 100755 --- a/heimcontrol.js +++ b/heimcontrol.js @@ -173,7 +173,7 @@ requirejs([ 'http', 'connect', 'mongodb', 'path', 'express', 'node-conf', 'socke // 404 Not found app.all('*', Routes.notFound); - }); + }, config.plugins.exclude); } }); }); From 5450bc454e6afba9db3600b08b23df1e824ba4f3 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 10 Jan 2015 00:11:25 +0100 Subject: [PATCH 3/3] remove exclude plugins from the list of plugins to require --- libs/PluginHelper.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/PluginHelper.js b/libs/PluginHelper.js index fee2b1a..cc27524 100755 --- a/libs/PluginHelper.js +++ b/libs/PluginHelper.js @@ -47,12 +47,20 @@ define([ 'fs' ], function( fs ) { * @param {String} callback.err null if no error occured, otherwise the error * @param {Object} callback.result An array containing the plugins */ - PluginHelper.prototype.getPluginList = function(callback) { + PluginHelper.prototype.getPluginList = function(callback, excludes) { var pluginList = []; var that = this; var files = fs.readdirSync(that.pluginFolder); var requirejs = require('requirejs'); + // Remove excluded plugins from the files list + for(key in excludes) { + var plugin = excludes[key]; + var index = files.indexOf(plugin); + if( index > -1) + files.splice(index, 1); + } + function requireRecursive(files) { var file = files.shift(); // results in alphabetical order requirejs([that.pluginFolder + '/' + file + '/index.js'], function(Plugin) {