lib/app/plugins.js
function (config) {
    return _.map(config.features, function(featureDef) {
      var feature = null
        , featurePath = null;

      var featureId = featureDef.$featureId || featureDef.feature;

      // Try to require the feature from each path listed in `config.featurePaths`.
      for (var i = 0; i < config.featurePaths.length; ++i) {
        featurePath = path.join(config.featurePaths[i], featureDef.feature);
        if (fs.existsSync(featurePath) || fs.existsSync(featurePath + '.js')) {
          feature = require(featurePath);
          break;
        }
      }

      if (!feature) {
        var errorMsg =
          'Cannot find feature: ' + util.inspect(featureDef.feature) +
          ' from featurePaths: ' + util.inspect(config.featurePaths);
        throw new Error(errorMsg);
      }

      var featureTasks = _.get(feature, 'tasks', []);

      return {
        featureId: featureId,
        featureDef: featureDef,
        featureConstructor : feature,
        tasks: featureTasks
      };
    });
  }
function (config) {
    return _.map(config.features, function(featureDef) {
      var feature = null
        , featurePath = null;

      var featureId = featureDef.$featureId || featureDef.feature;

      // Try to require the feature from each path listed in `config.featurePaths`.
      for (var i = 0; i < config.featurePaths.length; ++i) {
        featurePath = path.join(config.featurePaths[i], featureDef.feature);
        if (fs.existsSync(featurePath) || fs.existsSync(featurePath + '.js')) {
          feature = require(featurePath);
          break;
        }
      }

      if (!feature) {
        var errorMsg =
          'Cannot find feature: ' + util.inspect(featureDef.feature) +
          ' from featurePaths: ' + util.inspect(config.featurePaths);
        throw new Error(errorMsg);
      }

      var featureTasks = _.get(feature, 'tasks', []);

      return {
        featureId: featureId,
        featureDef: featureDef,
        featureConstructor : feature,
        tasks: featureTasks
      };
    });
  }
function ( config ) { return _ . map ( config . features , function ( featureDef ) { var feature = null , featurePath = null ; var featureId = featureDef . $featureId || featureDef . feature ; // Try to require the feature from each path listed in `config.featurePaths`. for ( var i = 0 ; i < config . featurePaths . length ; ++ i ) { featurePath = path . join ( config . featurePaths [ i ] , featureDef . feature ) ; if ( fs . existsSync ( featurePath ) || fs . existsSync ( featurePath + '.js' ) ) { feature = require ( featurePath ) ; break ; } } if ( ! feature ) { var errorMsg = 'Cannot find feature: ' + util . inspect ( featureDef . feature ) + ' from featurePaths: ' + util . inspect ( config . featurePaths ) ; throw new Error ( errorMsg ) ; } var featureTasks = _ . get ( feature , 'tasks' , [ ] ) ; return { featureId : featureId , featureDef : featureDef , featureConstructor : feature , tasks : featureTasks } ; } ) ; }
Load features of configuration to get plugin tasks etc.
Load features of configuration to get plugin tasks etc .