[rubygems/rubygems] Respect `BUNDLE_USER_CONFIG` if set

https://github.com/rubygems/rubygems/commit/f28ab141af
This commit is contained in:
David Rodríguez 2021-07-30 10:30:24 +02:00 коммит произвёл Hiroshi SHIBATA
Родитель d37c2441cc
Коммит 0ab160e2e0
2 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

@ -76,6 +76,20 @@ RSpec.describe ".bundle/config" do
end
end
describe "config location" do
let(:bundle_user_config) { File.join(Dir.home, ".config/bundler") }
before do
Dir.mkdir File.dirname(bundle_user_config)
end
it "can be configured through BUNDLE_USER_CONFIG" do
bundle "config set path vendor", :env => { "BUNDLE_USER_CONFIG" => bundle_user_config }
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
end
describe "global" do
before(:each) do
install_gemfile <<-G