[前][次][番号順一覧][スレッド一覧]

ruby-changes:67409

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:06:53 +0900 (JST)
Subject: [ruby-changes:67409] 0ab160e2e0 (master): [rubygems/rubygems] Respect `BUNDLE_USER_CONFIG` if set

https://git.ruby-lang.org/ruby.git/commit/?id=0ab160e2e0

From 0ab160e2e0b959054c28b06f1ada3f015c9f3bc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 30 Jul 2021 10:30:24 +0200
Subject: [rubygems/rubygems] Respect `BUNDLE_USER_CONFIG` if set

https://github.com/rubygems/rubygems/commit/f28ab141af
---
 lib/bundler/settings.rb              |  2 ++
 spec/bundler/commands/config_spec.rb | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index de42cc1..03126f6 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -428,6 +428,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/settings.rb#L428
     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
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index 1ef84c8..4e13a79 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -76,6 +76,20 @@ RSpec.describe ".bundle/config" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/config_spec.rb#L76
     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
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]