Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Exclude plugins through config #113

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"name" : "heimcontroljs",
"port" : "27017",
"user" : {}
},
"plugins": {
"exclude": []
}
}
2 changes: 1 addition & 1 deletion heimcontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ requirejs([ 'http', 'connect', 'mongodb', 'path', 'express', 'node-conf', 'socke
// 404 Not found
app.all('*', Routes.notFound);

});
}, config.plugins.exclude);
}
});
});
10 changes: 9 additions & 1 deletion libs/PluginHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down