Method not available on this version
This method is only available on newer versions.
The first available version (v2_6_3 ) is shown here.
register_plugin (name, spec, optional_plugin = false)
public
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
Show source # File lib/bundler/plugin.rb, line 227
def register_plugin(name, spec, optional_plugin = false)
commands = @commands
sources = @sources
hooks = @hooks_by_event
@commands = {}
@sources = {}
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
load_paths = spec.load_paths
add_to_load_path(load_paths)
path = Pathname.new spec.full_gem_path
begin
load path.join(PLUGIN_FILE_NAME), true
rescue StandardError => e
raise MalformattedPlugin, "#{e.class}: #{e.message}"
end
if optional_plugin && @sources.keys.any? {|s| source? s }
Bundler.rm_rf(path)
false
else
index.register_plugin(name, path.to_s, load_paths, @commands.keys,
@sources.keys, @hooks_by_event.keys)
true
end
ensure
@commands = commands
@sources = sources
@hooks_by_event = hooks
end