diff options
author | The Bundler Bot <bot@bundler.io> | 2017-07-25 03:33:50 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-07-25 03:33:50 +0000 |
commit | 219ea82fd4c84fcf047fc4cd957147600902288e (patch) | |
tree | c0feb454837dc0de5df6666a81d48fc657ad9d3b /lib/bundler.rb | |
parent | c34f20a39b03d07f72089fa58bf5af24edd6b490 (diff) | |
parent | 65c05e88eaba044117e80aa40c8a8e7ffc8f6a27 (diff) | |
download | bundler-219ea82fd4c84fcf047fc4cd957147600902288e.tar.gz |
Auto merge of #5860 - bundler:seg-validate-settings, r=segiddins
Introduce the notion of settings validation & default install to ./.bundle
Thanks so much for the contribution!
To make reviewing this PR a bit easier, please fill out answers to the following questions.
### What was the end-user problem that led to this PR?
The problem was...
### What was your diagnosis of the problem?
My diagnosis was...
### What is your fix for the problem, implemented in this PR?
My fix...
### Why did you choose this fix out of the possible options?
I chose this fix because...
Diffstat (limited to 'lib/bundler.rb')
-rw-r--r-- | lib/bundler.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index d0ae913216..edef1620e8 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -75,7 +75,11 @@ module Bundler # Returns absolute path of where gems are installed on the filesystem. def bundle_path - @bundle_path ||= Pathname.new(settings.path).expand_path(root) + @bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root) + end + + def configured_bundle_path + @configured_bundle_path ||= settings.path.tap(&:validate!) end # Returns absolute location of where binstubs are installed to. @@ -329,6 +333,10 @@ EOF Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir end + def use_system_gems? + configured_bundle_path.use_system_gems? + end + def requires_sudo? return @requires_sudo if defined?(@requires_sudo_ran) @@ -457,14 +465,16 @@ EOF end def reset_paths! - @root = nil - @settings = nil + @bin_path = nil + @bundle_path = nil + @configured = nil + @configured_bundle_path = nil @definition = nil - @setup = nil @load = nil @locked_gems = nil - @bundle_path = nil - @bin_path = nil + @root = nil + @settings = nil + @setup = nil @user_home = nil end @@ -503,14 +513,14 @@ EOF bundle_path end - def configure_gem_path(env = ENV, settings = self.settings) + def configure_gem_path(env = ENV) blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty? - if settings[:disable_shared_gems] + if !use_system_gems? # this needs to be empty string to cause # PathSupport.split_gem_path to only load up the # Bundler --path setting as the GEM_PATH. env["GEM_PATH"] = "" - elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s + elsif blank_home possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path] paths = possibles.flatten.compact.uniq.reject(&:empty?) env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR) |