initial the plugins by plugin's config
@param  {Object} plugins plugin's config
@return {Promise}
7795
function(plugins, pluginBase){
        var _this = this;
        
        if (typeof pluginBase === 'string') {
            _pluginBase = pluginBase;
        }
        plugins.forEach(function(plugin, index){
            var name;
            var path;
            if (typeof plugin === 'string'){
                name = plugin;
            } else {
                name = plugin.name;
                path = plugin.path;
            }
            _this.register(name, plugin);
        });
    }
1066352
function use(plugin) {
  var self = this
  var pipeline = self.pipeline
  var duplicate = false

  if (plugin && plugin.pluginId) {
    duplicate = self.plugins.some(matches)
  }

  if (!duplicate && self.plugins.indexOf(plugin) !== -1) {
    duplicate = true
  }

  if (!duplicate) {
    self.plugins.push(plugin)
    pipeline.use(plugin)
  }

  return self

  function matches(fn) {
    return fn.pluginId === plugin.pluginId
  }
}
775987
function validateConfig(book, plugins) {
    return Promise.reduce(plugins, function(newBook, plugin) {
        return validatePluginConfig(newBook, plugin);
    }, book);
}
503712
async function executePlugin([plugin, options]: PluginCall): Promise<string> {
  return (await resolvePlugin(plugin))(await executeNested(options));
}
1361806
function prepare(config) {
  config = config || {};
  var settings = config.settings && config.settings[constants.PLUGIN_NAME] || {};

  // Set paths, convert string values to array
  settings.paths = objValuesToArray(settings.paths || {});

  // Set allExceptPaths, convert string values to array
  settings.allExceptPaths = objValuesToArray(settings.allExceptPaths || {});

  // Set options for multimatch module
  settings.pathsOptions = settings.pathsOptions || defaults.pathsOptions;

  // Forward plugins from config or use custom ones, remove current plugin
  settings.plugins = toArray(settings.plugins || config.plugins || []);
  var index = settings.plugins.indexOf(constants.PLUGIN_NAME_SHORT);
  if (index > -1) {
    settings.plugins.splice(index, 1);
  }

  settings.cliArgs = settings.cliArgs || [];

  return settings;
}
605393
function addPlugin(plugin) {
  if (!plugin) {
    return;
  }
  if (!needFilterPlugin) {
    console.warn('You are adding a plugin after getPlugins is called.');
  }
  needFilterPlugin = true;
  if (!plugin.name) {
    console.log('plugin: ', plugin);
    throw new Error('Each plugin should have a name.');
  }
  if (_.find(allPlugins, { name: plugin.name })) {
    console.warn('You should not add a plugin with same name: ' + plugin.name);
    return;
  }
  allPlugins.push(plugin);
}
1039189
function( MyPlugin, defaults ) {

        // make sure a function has been passed in to
        // create a plugin from.
        if (typeof MyPlugin === 'function') {

            /**
             * the plugin object, inherits all attributes and methods
             * from the base plugin and the user's plugin
             *
             * @param {object} element
             * @param {object} options
             * @return {object} instance
             */
            var Plugin = function( element, options ) {
                Boilerplate.call( this, element, options || {}, defaults || {} );
                MyPlugin.call( this, element, options );
                return this;
            }
            // inherit prototype methods from MyPlugin
            Plugin.prototype = MyPlugin.prototype;
            // set constructor method to Plugin
            Plugin.prototype.constructor = Plugin;
            // set a couple static variables
            Plugin.init = Boilerplate.init;
            Plugin.instances = {};
            Plugin.defaults = defaults || {};

            /**
             * An externalized object used to initialize the plugin and
             * provides external access to plugin.
             *
             * @param {object} options
             * @return {object} instance
             */
            var Boost = function( options ) {
                return Plugin.init.call( Plugin, this, options );
            }
            // externalize a couple vars by attaching them to obj
            Boost.init = function( elems, options ) {
                return Plugin.init.call( Plugin, elems, options );
            }
            Boost.instances = Plugin.instances;
            Boost.defaults = Plugin.defaults;

            // return the Boost object
            return Boost;

        } else {

            throw '\'Boost JS\' requires a function as first paramater.';

        }

    }
903195
public function appendPlugin(Plugin ...$plugins)
    {
        foreach ($plugins as $plugin) {
            $this->appendPlugins[] = $plugin;
        }

        return $this;
    }
236061
function loadConfig(config) {
  var options = normalizeOptions(config);

  if (config.options.plugins != null && !Array.isArray(config.options.plugins)) {
    throw new Error(".plugins should be an array, null, or undefined");
  }

  var plugins = (config.options.plugins || []).map(function (plugin, index) {
    var _normalizePair = normalizePair(plugin, _files.loadPlugin, config.dirname),
        filepath = _normalizePair.filepath,
        value = _normalizePair.value,
        options = _normalizePair.options;

    return {
      alias: filepath || config.loc + "$" + index,
      loc: filepath || config.loc,
      value: value,
      options: options,
      dirname: config.dirname
    };
  });

  if (config.options.presets != null && !Array.isArray(config.options.presets)) {
    throw new Error(".presets should be an array, null, or undefined");
  }

  var presets = (config.options.presets || []).map(function (preset, index) {
    var _normalizePair2 = normalizePair(preset, _files.loadPreset, config.dirname),
        filepath = _normalizePair2.filepath,
        value = _normalizePair2.value,
        options = _normalizePair2.options;

    return {
      alias: filepath || config.loc + "$" + index,
      loc: filepath || config.loc,
      value: value,
      options: options,
      dirname: config.dirname
    };
  });

  return { options: options, plugins: plugins, presets: presets };
}
1253742
function resolvePlugin(item) {
    /**
     * Handle when string was given, such as plugins: ['bs-html-injector']
     */
    if (typeof item === "string") {
        return getFromString(item);
    }

    if (!isMap(item)) {
        return new Plugin().mergeDeep({
            errors: [new Error("Plugin not supported in this format")]
        });
    }

    if (item.has("module")) {
        var nameOrObj = item.get("module");
        var options = item.get("options");

        /**
         * The 'module' key can be a string, this allows
         * inline plugin references, but with options
         * eg:
         *
         * bs.init({
         *     plugins: [
         *         {
         *             module: './myjs-file.js'
         *             options: {
         *                 files: "*.html"
         *             }
         *         }
         *     ]
         * });
         */
        if (typeof nameOrObj === "string") {
            return getFromString(nameOrObj).mergeDeep({
                options: options
            });
        }

        /**
         * If the plugin was given completely inline (because it needs options)
         * eg:
         *
         * bs.init({
         *     plugins: [
         *         {
         *             module: {
         *                 plugin: function() {
         *                     console.log('My plugin code')
         *                 }
         *             },
         *             options: {
         *                 files: "*.html"
         *             }
         *         }
         *     ]
         * })
         */
        if (Immutable.Map.isMap(nameOrObj)) {
            return new Plugin({
                module: nameOrObj,
                options: options
            });
        }
    }

    /**
     * If a module was given directly. For example, ater calling require.
     *
     * eg:
     *    var myplugin = require('./some-js');
     *    bs.init({plugins: [myplugin]});
     */
    if (item.has("plugin")) {
        return new Plugin({
            module: item
        });
    }

    /**
     * If we reach here, the plugin option was used incorrectly
     */
    return new Plugin().mergeDeep({
        errors: [new Error("Plugin was not configured correctly")]
    });
}
107208
function(plugins) {
		var p = this._plugins;
		([]).concat(plugins).forEach(function(plugin) {
			if (p.indexOf(plugin) === -1) {
				p.push(plugin);
			}
		});

		this._cacheId++;
	}
969833
def load_plugins(plugins)
      unless plugins.is_a?(Array)
        raise ArgumentError, "load_plugins expects an array, got #{plugins.inspect}"
      end

      plugins.each do |plugin|
        plugin_file = plugin.start_with?("/") ? plugin : File.expand_path("../../#{plugin}", File.dirname(__FILE__))
        unless File.file?(plugin_file)
          raise Errno::ENOENT, "Failed to find plugin #{plugin.inspect} at #{plugin_file}"
        end
        require plugin_file
      end
    end
511923
function resolvePluginsForBrowsers(browsers) {
  const plugins = [];

  if (!Array.isArray(browsers)) browsers = [browsers];

  browsers.forEach(browser => {
    const name = Object.keys(browser)[0];
    const version = browser[name];

    for (const pluginName in babelPluginsByEnvironmentVersion) {
      if (
        !babelPluginsByEnvironmentVersion[pluginName][name] ||
        babelPluginsByEnvironmentVersion[pluginName][name] > version
      ) {
        plugins.push(`babel-plugin-${pluginName}`);
      }
    }
  });

  return plugins;
}
1014349
function loadApis() {
  // Shortcut if apis already have been loaded
  if (apis !== undefined) {
    return Promise.resolve(apis);
  }

  const apiSpecsPath = path.join(process.cwd(), plugin.config.apisPath);

  // This event allows to inject code before loading all APIs
  return plugin.myrmex.fire('beforeApisLoad')
  .then(() => {
    // Retrieve configuration path of all API specifications
    return Promise.promisify(fs.readdir)(apiSpecsPath);
  })
  .then(subdirs => {
    // Load all the API specifications
    const apiPromises = [];
    _.forEach(subdirs, (subdir) => {
      const apiSpecPath = path.join(apiSpecsPath, subdir, 'spec');
      // subdir is the identifier of the API, so we pass it as the second argument
      apiPromises.push(loadApi(apiSpecPath, subdir));
    });
    return Promise.all(apiPromises);
  })
  .then(apis => {
    // This event allows to inject code to add or delete or alter API specifications
    return plugin.myrmex.fire('afterApisLoad', apis);
  })
  .spread(loadedApis => {
    apis = loadedApis;
    return Promise.resolve(apis);
  })
  .catch(e => {
    if (e.code === 'ENOENT' && path.basename(e.path) === path.basename(plugin.config.apisPath)) {
      return Promise.resolve([]);
    }
    return Promise.reject(e);
  });
}
1278246
function resolveDependencyPlugins(deps) {
    return deps
        .filter(dep => isInstalled(dep) && isInstalled(`eslint-plugin-${dep}`))
        .map(dep => `./lib/plugin-conf/${dep}.js`);
}
629695
function createEntries(plugins) {
    return _.chain(plugins)
        .map(function (plugin) {
            let entry = _.get(plugin, 'raw.plugin.entry')

            if (!Array.isArray(entry)) {
                entry = [entry]
            }

            return entry.reduce(function (result, value) {
                if (value) {
                    result.push(createEntry(path.join(plugin.path, value)))
                }
                return result
            }, [])
        })
        .flatten()
        .compact()
        .value()
}
459299
function init(options = {}, handlebars) {
  const opts = deepExtend({}, defaults, options);
  normalizePaths(opts);
  opts.handlebars = handlebars || Handlebars.create();
  return Promise.resolve(opts);
}