diff options
author | Stefan Lance <stefan@lances.net> | 2015-07-16 14:40:51 -0500 |
---|---|---|
committer | Stefan Lance <stefan@lances.net> | 2015-07-20 14:17:08 -0500 |
commit | a3fa32a57817074a1b2056c587aa5114371ea01d (patch) | |
tree | bc3c49ec7d66739157de9fdc1819e945a9fffcc0 | |
parent | d8aec2251286fa090a8bd82741b9e069d7484623 (diff) | |
download | bundler-a3fa32a57817074a1b2056c587aa5114371ea01d.tar.gz |
Modify installation path
Conflicts:
lib/bundler/source_list.rb
-rw-r--r-- | lib/bundler/settings.rb | 6 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 17 | ||||
-rw-r--r-- | spec/install/path_spec.rb | 1 |
3 files changed, 21 insertions, 3 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 8be66976f4..f5eede6480 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -12,6 +12,10 @@ module Bundler @global_config = load_config(global_config_file) end + def root + @root + end + def [](name) key = key_for(name) value = (@local_config[key] || ENV[key] || @global_config[key] || DEFAULT_CONFIG[name]) @@ -141,7 +145,7 @@ module Bundler if path = self[:path] path = "#{path}/#{Bundler.ruby_scope}" if path != Bundler.rubygems.gem_dir - File.expand_path(path) + path else File.join(@root, Bundler.ruby_scope) end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index d95f9181b5..1da1aaf247 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -126,8 +126,21 @@ module Bundler install_path = Bundler.tmp(spec.full_name) bin_path = install_path.join("bin") else - install_path = File.expand_path(Bundler.settings.path) - bin_path = Bundler.system_bindir + + set_path = Bundler.settings.path + + # TODO: document exactly what's going on here and in Bundler.settings.path + if set_path == File.join(Bundler.settings.root, Bundler.ruby_scope) # ? + install_path = Bundler.settings.path + elsif set_path == Bundler.rubygems.gem_dir # system gems path + install_path = Bundler.settings.path + elsif Pathname.new(set_path).absolute? # all other absolute paths + install_path = Bundler.settings.path + else # all relative paths + install_path = File.join(Bundler::root, Bundler.settings.path) + end + + bin_path = Bundler.system_bindir end installed_spec = nil diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 420e8b162e..8ec8f2c50b 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -92,6 +92,7 @@ describe "bundle install" do # FIXME: If the bundle_path is `"vendor"` instead of # `bundled_app("vendor").to_s`, this spec fails. As is, this spec # may not test what happens when `path` is relative. + bundle "config path vendor" #set_bundle_path(type, bundled_app("vendor").to_s) |