This is the interfacing class represents the API that we intend to provide the plugins to use.
For plugins to be independent of the Bundler internals they shall limit their interactions to methods of this class only. This will save them from breaking when some internal change.
Currently we are delegating the methods defined in Bundler class to itself. So, this class acts as a buffer.
If there is some change in the Bundler class that is incompatible to its previous behavior or if otherwise desired, we can reimplement(or implement) the method to preserve compatibility.
To use this, either the class can inherit this class or use it directly. For example of both types of use, refer the file `spec/plugins/command.rb`
To use it without inheriting, you will have to create an object of this to use the functions (except for declaration functions like command, source, and hooks).
| PLUGIN_FILE_NAME | = | "plugins.rb".freeze |
Evaluates the Gemfile with a limited DSL and installs the plugins specified by plugin method
@param [Pathname] gemfile path @param [Proc] block that can be evaluated for (inline) Gemfile
Runs all the hooks that are registered for the passed event
It passes the passed arguments and block to the block registered with the api.
@param [String] event
Installs a new plugin by the given name
@param [Array<String>] names the name of plugin to be installed @param [Hash] options various parameters as described in description.
Refer to cli/plugin for available options
Runs the plugins.rb file in an isolated namespace, records the plugin actions it registers for and then passes the data to index to be stored.
@param [String] name the name of the plugin @param [Specification] spec of installed plugin @param [Boolean] optional_plugin, removed if there is conflict with any
other plugin (used for default source plugins)
@raise [MalformattedPlugin] if plugins.rb raises any error
The directory root for all plugin related data
If run in an app, points to local root, in app_config_path Otherwise, points to global root, in Bundler.user_bundle_path("plugin")
Post installation processing and registering with index
@param [Array<String>] plugins list to be installed @param [Hash] specs of plugins mapped to installation path (currently they
contain all the installed specs, including plugins)
@param [Array<String>] names of inferred source plugins that can be ignored
@param [Hash] The options that are present in the lock file @return [API::Source] the instance of the class that handles the source
type passed in locked_opts
Checks if the gem is good to be a plugin
At present it only checks whether it contains plugins.rb file
@param [Pathname] plugin_path the path plugin is installed at @raise [MalformattedPlugin] if plugins.rb file is not found