1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Respect BUNDLE_USER_HOME for global config location

https://github.com/rubygems/rubygems/commit/58fc31442f
This commit is contained in:
David Rodríguez 2021-08-06 11:20:31 +02:00 committed by Hiroshi SHIBATA
parent ea16a0df80
commit 21db5876ca
Notes: git 2021-08-31 19:07:11 +09:00
2 changed files with 12 additions and 0 deletions

View file

@ -430,6 +430,8 @@ module Bundler
Pathname.new(ENV["BUNDLE_CONFIG"])
elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
Pathname.new(ENV["BUNDLE_USER_CONFIG"])
elsif ENV["BUNDLE_USER_HOME"] && !ENV["BUNDLE_USER_HOME"].empty?
Pathname.new(ENV["BUNDLE_USER_HOME"]).join("config")
elsif Bundler.rubygems.user_home && !Bundler.rubygems.user_home.empty?
Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
end

View file

@ -88,6 +88,16 @@ RSpec.describe ".bundle/config" do
bundle "config get path", :env => { "BUNDLE_USER_CONFIG" => bundle_user_config }
expect(out).to include("Set for the current user (#{bundle_user_config}): \"vendor\"")
end
context "when not explicitly configured, but BUNDLE_USER_HOME set" do
let(:bundle_user_home) { bundled_app(".bundle").to_s }
it "uses the right location" do
bundle "config set path vendor", :env => { "BUNDLE_USER_HOME" => bundle_user_home }
bundle "config get path", :env => { "BUNDLE_USER_HOME" => bundle_user_home }
expect(out).to include("Set for the current user (#{bundle_user_home}/config): \"vendor\"")
end
end
end
describe "global" do