Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #6628 - bundler:segiddins/bundler-2-global-path-ruby-sc…
Browse files Browse the repository at this point in the history
…ope, r=indirect

[Settings] Append the ruby scope on Bundler 2 with a global path setting

### What was the end-user problem that led to this PR?

The problem was `bundle config path` behaving differently depending on whether the config is local or global was... confusing.

Closes #6619 (comment).

### What was your diagnosis of the problem?

My diagnosis was setting the `path` setting should be consistent, regardless of the level of configuration it is set at.

### What is your fix for the problem, implemented in this PR?

My fix appends the "ruby scope" to the path when set globally on Bundler 2.

### Why did you choose this fix out of the possible options?

I chose this fix because it means users won't have to re-install gems when switching rubies with a global `BUNDLE_PATH` set.
  • Loading branch information
bundlerbot committed Jul 17, 2018
2 parents 8d53c82 + 4487ea5 commit 1866621
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def self.settings_method(name, key, &default)
settings_flag(:disable_multisource) { bundler_2_mode? }
settings_flag(:error_on_stderr) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_2_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
settings_flag(:global_gem_cache) { bundler_2_mode? }
settings_flag(:init_gems_rb) { bundler_2_mode? }
settings_flag(:list_command) { bundler_2_mode? }
Expand Down
3 changes: 2 additions & 1 deletion lib/bundler/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Settings
frozen
gem.coc
gem.mit
global_path_appends_ruby_scope
global_gem_cache
ignore_messages
init_gems_rb
Expand Down Expand Up @@ -225,7 +226,7 @@ def path
key = key_for(:path)
path = ENV[key] || @global_config[key]
if path && !@temporary.key?(key) && !@local_config.key?(key)
return Path.new(path, false, false, false)
return Path.new(path, Bundler.feature_flag.global_path_appends_ruby_scope?, false, false)
end

system_path = self["path.system"] || (self[:disable_shared_gems] == false)
Expand Down
3 changes: 3 additions & 0 deletions man/bundle-config.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
Whether Bundler should cache all gems globally, rather than locally to the
installing Ruby installation.
* `global_path_appends_ruby_scope` (`BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE`):
Whether Bundler should append the Ruby scope (e.g. engine and ABI version)
to a globally-configured path.
* `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): When set, no post install
messages will be printed. To silence a single gem, use dot notation like
`ignore_messages.httparty true`.
Expand Down

0 comments on commit 1866621

Please sign in to comment.