summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Lance <stefan@lances.net>2015-07-09 11:20:32 -0500
committerSamuel E. Giddins <segiddins@segiddins.me>2015-07-16 16:54:14 -0700
commit458b6cead0944a95eb4f64463a7d9db68e482adf (patch)
tree690c31732070eed1365766c550c7e06c7e7f7e6b
parent5293956c83403435fd81c937451fbaf614fd8bdc (diff)
downloadbundler-458b6cead0944a95eb4f64463a7d9db68e482adf.tar.gz
Fix `Bundler.settings.path`
- `File.expand_path`s may be unnecessary
-rw-r--r--lib/bundler/settings.rb10
-rw-r--r--lib/bundler/source/rubygems.rb4
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index c7b0259a87..aca3a09286 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -160,11 +160,15 @@ module Bundler
def path
key = key_for(:path)
path = ENV[key] || @global_config[key]
- return path if path && !@local_config.key?(key)
+
+ if path && !@local_config.key?(key)
+ path = "#{path}/#{Bundler.ruby_scope}" if path != Bundler.rubygems.gem_dir
+ return path
+ end
if path = self[:path]
- path == Bundler.rubygems.gem_dir ? path : "#{path}/#{Bundler.ruby_scope}"
- path = File.expand_path(path)
+ path = "#{path}/#{Bundler.ruby_scope}" if path != Bundler.rubygems.gem_dir
+ File.expand_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 88bd92f1fb..d95f9181b5 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -126,7 +126,7 @@ module Bundler
install_path = Bundler.tmp(spec.full_name)
bin_path = install_path.join("bin")
else
- install_path = Bundler.settings.path
+ install_path = File.expand_path(Bundler.settings.path)
bin_path = Bundler.system_bindir
end
@@ -237,7 +237,7 @@ module Bundler
end
def loaded_from(spec)
- "#{Bundler.settings.path}/specifications/#{spec.full_name}.gemspec"
+ "#{File.expand_path(Bundler.settings.path)}/specifications/#{spec.full_name}.gemspec"
end
def cached_gem(spec)