This function is to be called when a new plugin is installed.
This function shall add the functions of the plugin to existing maps and
also the name to source location.
@param [String] name of the plugin to be
registered @param [String] path where the plugin
is installed @param [Array]load_paths for the plugin
@param [Array] commands that are handled
by the plugin @param [Array] sources that
are handled by the plugin
# File lib/bundler/plugin/index.rb, line 50
def register_plugin(name, path, load_paths, commands, sources, hooks)
old_commands = @commands.dup
common = commands & @commands.keys
raise CommandConflict.new(name, common) unless common.empty?
commands.each {|c| @commands[c] = name }
common = sources & @sources.keys
raise SourceConflict.new(name, common) unless common.empty?
sources.each {|k| @sources[k] = name }
hooks.each {|e| (@hooks[e] ||= []) << name }
@plugin_paths[name] = path
@load_paths[name] = load_paths
save_index
rescue StandardError
@commands = old_commands
raise
end