summaryrefslogtreecommitdiff
path: root/lib/bundler/plugin
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-28 18:52:46 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-07-03 09:41:58 +0530
commit0cdbdbeef8d28223c483791f5e57cb25103cd7ae (patch)
tree8bb7f89da424617867d0c908829475936b32b9e1 /lib/bundler/plugin
parent89c7180ee7c5b1a1ab254e7e142a473ea51d1de3 (diff)
downloadbundler-0cdbdbeef8d28223c483791f5e57cb25103cd7ae.tar.gz
Fixed hard coded load path for plugins
Diffstat (limited to 'lib/bundler/plugin')
-rw-r--r--lib/bundler/plugin/index.rb11
-rw-r--r--lib/bundler/plugin/installer.rb11
2 files changed, 15 insertions, 7 deletions
diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb
index 0493e5b324..4abf85fb02 100644
--- a/lib/bundler/plugin/index.rb
+++ b/lib/bundler/plugin/index.rb
@@ -24,6 +24,7 @@ module Bundler
@plugin_paths = {}
@commands = {}
@sources = {}
+ @load_paths = {}
load_index
end
@@ -34,9 +35,10 @@ module Bundler
#
# @param [String] name of the plugin to be registered
# @param [String] path where the plugin is installed
+ # @param [Array<String>] load_paths for the plugin
# @param [Array<String>] commands that are handled by the plugin
# @param [Array<String>] sources that are handled by the plugin
- def register_plugin(name, path, commands, sources)
+ def register_plugin(name, path, load_paths, commands, sources)
old_commands = @commands.dup
common = commands & @commands.keys
@@ -48,6 +50,7 @@ module Bundler
sources.each {|k| @sources[k] = name }
@plugin_paths[name] = path
+ @load_paths[name] = load_paths
save_index
rescue
@commands = old_commands
@@ -63,6 +66,10 @@ module Bundler
Pathname.new @plugin_paths[name]
end
+ def load_paths(name)
+ @load_paths[name]
+ end
+
# Fetch the name of plugin handling the command
def command_plugin(command)
@commands[command]
@@ -92,6 +99,7 @@ module Bundler
require "bundler/yaml_serializer"
index = YAMLSerializer.load(data)
@plugin_paths = index["plugin_paths"] || {}
+ @load_paths = index["load_paths"] || {}
@commands = index["commands"] || {}
@sources = index["sources"] || {}
end
@@ -103,6 +111,7 @@ module Bundler
def save_index
index = {
"plugin_paths" => @plugin_paths,
+ "load_paths" => @load_paths,
"commands" => @commands,
"sources" => @sources,
}
diff --git a/lib/bundler/plugin/installer.rb b/lib/bundler/plugin/installer.rb
index ab80881fcf..a50d0ceedd 100644
--- a/lib/bundler/plugin/installer.rb
+++ b/lib/bundler/plugin/installer.rb
@@ -25,8 +25,8 @@ module Bundler
# Installs the plugin from Definition object created by limited parsing of
# Gemfile searching for plugins to be installed
#
- # @param [Definition] definiton object
- # @return [Hash] map of plugin names to thier paths
+ # @param [Definition] definition object
+ # @return [Hash] map of names to their specs they are installed with
def install_definition(definition)
def definition.lock(*); end
definition.resolve_remotely!
@@ -62,7 +62,7 @@ module Bundler
# @param [Array] version of the gem to install
# @param [String, Array<String>] source(s) to resolve the gem
#
- # @return [String] the path where the plugin was installed
+ # @return [Hash] map of names to the specs of plugins installed
def install_rubygems(names, version, sources)
deps = names.map {|name| Dependency.new name, version }
@@ -78,15 +78,14 @@ module Bundler
#
# @param specs to install
#
- # @return [Hash] map of names to path where the plugin was installed
+ # @return [Hash] map of names to the specs
def install_from_specs(specs)
paths = {}
specs.each do |spec|
spec.source.install spec
- spec.add_self_to_load_path
- paths[spec.name] = spec.full_gem_path
+ paths[spec.name] = spec
end
paths