Skip to content
Merged
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
24 changes: 24 additions & 0 deletions core/lib/plugin_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@ var plugin_manager = function (config, configPath) {
fs = require('fs-extra'),
util = require('./utilities');

/**
* Loads a plugin
*
* @param pluginName {string} the name of the plugin
* @return {object} the loaded plugin
*/
function loadPlugin(pluginName) {
return require(path.join(process.cwd(), 'node_modules', pluginName));
}

/**
* Installs a plugin
*
* @param pluginName {string} the name of the plugin
*/
function installPlugin(pluginName) {
try {
var pluginPath = path.resolve(
Expand Down Expand Up @@ -40,6 +51,11 @@ var plugin_manager = function (config, configPath) {
}
}

/**
* Detect installed plugins
*
* @return {array} list of installed plugins
*/
function detectPlugins() {
var node_modules_path = path.join(process.cwd(), 'node_modules');
return fs.readdirSync(node_modules_path).filter(function (dir) {
Expand All @@ -48,10 +64,18 @@ var plugin_manager = function (config, configPath) {
});
}

/**
* Disables an installed plugin
* Not implemented yet
*/
function disablePlugin(pluginName) {
console.log('disablePlugin not implemented yet. No change made to state of plugin', pluginName);
}

/**
* Enables an installed plugin
* Not implemented yet
*/
function enablePlugin(pluginName) {
console.log('enablePlugin not implemented yet. No change made to state of plugin', pluginName);
}
Expand Down