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

    if (config.plugins[pluginName] === undefined) {
      logger.error('Plugin ' + pluginName + ' not installed!');

    } else if (pluginHelpers.loadedPlugins[pluginName] === undefined) {
      logger.error('Plugin ' + pluginName + ' not loaded!');

    } else {
      var options = config.plugins[pluginName];

      try {
        var plugin = pluginHelpers.loadedPlugins[pluginName];
        delete pluginHelpers.loadedPlugins[pluginName];
        nodeHelpers.clearRequireCache(configHelpers.modulePath(options.name));

        if (plugin.onExit !== undefined) {

          return plugin.onExit(options, config, function (err) {

            if (err) {
              logger.raw(err);
              logger.info('\t' + symbols.err + '\t' +
                          options.displayName + '');

            } else {
              logger.info('\t' + symbols.ok + '\t' +
                          options.displayName + '');
            }

            delete pluginHelpers.startedPlugins[pluginName];
            nodeHelpers.invoke(callback, err);
          });

        } else {
          delete pluginHelpers.startedPlugins[pluginName];
          logger.info('\t' + symbols.ok + '\t' +
                      options.displayName + '');
        }

      } catch(err) {
        logger.raw(err);
        logger.error('Plugin ' + options.displayName +
                     ' failed for termination.');
        return nodeHelpers.invoke(callback, err);
      }
    }
    return nodeHelpers.invoke(callback);
  }
function (pluginName, callback) {
    var config = configHelpers.getConfig();

    if (config.plugins[pluginName] === undefined) {
      logger.error('Plugin ' + pluginName + ' not installed!');

    } else if (pluginHelpers.loadedPlugins[pluginName] === undefined) {
      logger.error('Plugin ' + pluginName + ' not loaded!');

    } else {
      var options = config.plugins[pluginName];

      try {
        var plugin = pluginHelpers.loadedPlugins[pluginName];
        delete pluginHelpers.loadedPlugins[pluginName];
        nodeHelpers.clearRequireCache(configHelpers.modulePath(options.name));

        if (plugin.onExit !== undefined) {

          return plugin.onExit(options, config, function (err) {

            if (err) {
              logger.raw(err);
              logger.info('\t' + symbols.err + '\t' +
                          options.displayName + '');

            } else {
              logger.info('\t' + symbols.ok + '\t' +
                          options.displayName + '');
            }

            delete pluginHelpers.startedPlugins[pluginName];
            nodeHelpers.invoke(callback, err);
          });

        } else {
          delete pluginHelpers.startedPlugins[pluginName];
          logger.info('\t' + symbols.ok + '\t' +
                      options.displayName + '');
        }

      } catch(err) {
        logger.raw(err);
        logger.error('Plugin ' + options.displayName +
                     ' failed for termination.');
        return nodeHelpers.invoke(callback, err);
      }
    }
    return nodeHelpers.invoke(callback);
  }
function ( pluginName , callback ) { var config = configHelpers . getConfig ( ) ; if ( config . plugins [ pluginName ] === undefined ) { logger . error ( 'Plugin ' + pluginName + ' not installed!' ) ; } else if ( pluginHelpers . loadedPlugins [ pluginName ] === undefined ) { logger . error ( 'Plugin ' + pluginName + ' not loaded!' ) ; } else { var options = config . plugins [ pluginName ] ; try { var plugin = pluginHelpers . loadedPlugins [ pluginName ] ; delete pluginHelpers . loadedPlugins [ pluginName ] ; nodeHelpers . clearRequireCache ( configHelpers . modulePath ( options . name ) ) ; if ( plugin . onExit !== undefined ) { return plugin . onExit ( options , config , function ( err ) { if ( err ) { logger . raw ( err ) ; logger . info ( '\t' + symbols . err + '\t' + options . displayName + '' ) ; } else { logger . info ( '\t' + symbols . ok + '\t' + options . displayName + '' ) ; } delete pluginHelpers . startedPlugins [ pluginName ] ; nodeHelpers . invoke ( callback , err ) ; } ) ; } else { delete pluginHelpers . startedPlugins [ pluginName ] ; logger . info ( '\t' + symbols . ok + '\t' + options . displayName + '' ) ; } } catch ( err ) { logger . raw ( err ) ; logger . error ( 'Plugin ' + options . displayName + ' failed for termination.' ) ; return nodeHelpers . invoke ( callback , err ) ; } } return nodeHelpers . invoke ( callback ) ; }
Stop given plugin (unload it form cache and run its exit handleR).

@param pluginName The plugin name to start.
@param callback Termination.
Stop given plugin ( unload it form cache and run its exit handleR ) .