lib/plugins.js
function (pluginName, program, applicationServer, callback) {
    var config = configHelpers.getConfig();

    // Test if plugin is installed.
    if (config.plugins[pluginName] === undefined) {
      logger.error('Plugin ' + pluginName + ' not installed!');
      nodeHelpers.invoke(callback);

    } else {

      try {

        // Load plugin
        if (pluginHelpers.loadedPlugins[pluginName] === undefined) {
          pluginHelpers.loadPlugin(pluginName, program);
        }
        var plugin = pluginHelpers.loadedPlugins[pluginName];

        if (plugin !== null) {
          pluginHelpers.startedPlugins[plugin] = true;

          if (plugin.configureAppServer && applicationServer) {
            logger.info('Configuring plugin ' + pluginName + '...');

            plugin.configureAppServer(
              applicationServer, config, routes, function logResult () {

              logger.info('Plugin ' + pluginName + ' configured.');
              nodeHelpers.invoke(callback);
            });

          // Plugin has no action to perform on the server.
          } else {
            nodeHelpers.invoke(callback);
          }

        // Something went wrong while loading the plugin.
        } else {
          logger.error('Plugin ' + pluginName + ' was not properly loaded!');
          nodeHelpers.invoke(callback);
        }

      } catch(err) {
        logger.raw(err);
        logger.error('Plugin ' + pluginName + ' loading failed.');
        nodeHelpers.invoke(callback, err);
      }
    }
  }
function (pluginName, program, applicationServer, callback) {
    var config = configHelpers.getConfig();

    // Test if plugin is installed.
    if (config.plugins[pluginName] === undefined) {
      logger.error('Plugin ' + pluginName + ' not installed!');
      nodeHelpers.invoke(callback);

    } else {

      try {

        // Load plugin
        if (pluginHelpers.loadedPlugins[pluginName] === undefined) {
          pluginHelpers.loadPlugin(pluginName, program);
        }
        var plugin = pluginHelpers.loadedPlugins[pluginName];

        if (plugin !== null) {
          pluginHelpers.startedPlugins[plugin] = true;

          if (plugin.configureAppServer && applicationServer) {
            logger.info('Configuring plugin ' + pluginName + '...');

            plugin.configureAppServer(
              applicationServer, config, routes, function logResult () {

              logger.info('Plugin ' + pluginName + ' configured.');
              nodeHelpers.invoke(callback);
            });

          // Plugin has no action to perform on the server.
          } else {
            nodeHelpers.invoke(callback);
          }

        // Something went wrong while loading the plugin.
        } else {
          logger.error('Plugin ' + pluginName + ' was not properly loaded!');
          nodeHelpers.invoke(callback);
        }

      } catch(err) {
        logger.raw(err);
        logger.error('Plugin ' + pluginName + ' loading failed.');
        nodeHelpers.invoke(callback, err);
      }
    }
  }
Start given plugin (require it, run configuration and apply change to
cozy light server).
NB: Do not load given plugin if it is disabled.

@param pluginName The plugin name to start.
@param program The commander program to bind.
@param applicationServer The application server to connect the plugin on.
@param callback Termination.