diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2024-05-24 19:47:22 +0200 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-05-30 18:23:36 +0000 |
| commit | 4f160ad9cfc0f2690a5acca301dedff4f901a673 (patch) | |
| tree | e430b0adbdaf8780c0e427cf39f7cb05ae793b77 /lib | |
| parent | 15501e13d7588a049437d343548bda76121b92f9 (diff) | |
[rubygems/rubygems] Don't let `bundle config` report a path without a Gemfile as "local app"
https://github.com/rubygems/rubygems/commit/6aa2ac337f
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/bundler.rb | 2 | ||||
| -rw-r--r-- | lib/bundler/settings.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index adf0a8e450..0081b9554f 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -358,7 +358,7 @@ module Bundler def settings @settings ||= Settings.new(app_config_path) rescue GemfileNotFound - @settings = Settings.new(Pathname.new(".bundle").expand_path) + @settings = Settings.new end # @return [Hash] Environment present before Bundler was activated diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index abbaec9783..4aef0cf1b3 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -103,6 +103,7 @@ module Bundler def initialize(root = nil) @root = root @local_config = load_config(local_config_file) + @local_root = root || Pathname.new(".bundle").expand_path @env_config = ENV.to_h @env_config.select! {|key, _value| key.start_with?("BUNDLE_") } @@ -142,7 +143,7 @@ module Bundler end def set_local(key, value) - local_config_file || raise(GemfileNotFound, "Could not locate Gemfile") + local_config_file = @local_root.join("config") set_key(key, value, @local_config, local_config_file) end |
