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:
parent
ea16a0df80
commit
21db5876ca
Notes:
git
2021-08-31 19:07:11 +09:00
2 changed files with 12 additions and 0 deletions
|
@ -430,6 +430,8 @@ module Bundler
|
||||||
Pathname.new(ENV["BUNDLE_CONFIG"])
|
Pathname.new(ENV["BUNDLE_CONFIG"])
|
||||||
elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
|
elsif ENV["BUNDLE_USER_CONFIG"] && !ENV["BUNDLE_USER_CONFIG"].empty?
|
||||||
Pathname.new(ENV["BUNDLE_USER_CONFIG"])
|
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?
|
elsif Bundler.rubygems.user_home && !Bundler.rubygems.user_home.empty?
|
||||||
Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
|
Pathname.new(Bundler.rubygems.user_home).join(".bundle/config")
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,6 +88,16 @@ RSpec.describe ".bundle/config" do
|
||||||
bundle "config get path", :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\"")
|
expect(out).to include("Set for the current user (#{bundle_user_config}): \"vendor\"")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "global" do
|
describe "global" do
|
||||||
|
|
Loading…
Add table
Reference in a new issue