Blame SOURCES/ruby-2.7.0-bundler-use-bundle-gem-instead-of-gem-command.patch

0bc38e
From 745899dec8f28d50a37dc03a96bbea972caaef58 Mon Sep 17 00:00:00 2001
0bc38e
From: SHIBATA Hiroshi <hsbt@ruby-lang.org>
0bc38e
Date: Tue, 19 Feb 2019 22:41:56 +0900
0bc38e
Subject: [PATCH] Use ENV["BUNDLE_GEM"] instead of gem command provided by
0bc38e
 system ruby.
0bc38e
0bc38e
  It break the examples of bundler. Because some examples detect the
0bc38e
  different version of system ruby than test target version like trunk.
0bc38e
---
0bc38e
 lib/bundler/gem_helper.rb            |  8 ++++++--
0bc38e
 spec/bundler/commands/clean_spec.rb  | 14 +++++++++-----
0bc38e
 spec/bundler/support/rubygems_ext.rb |  7 ++-----
0bc38e
 3 files changed, 17 insertions(+), 12 deletions(-)
0bc38e
0bc38e
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
0bc38e
index e7673cba88..c54259b5b6 100644
0bc38e
--- a/lib/bundler/gem_helper.rb
0bc38e
+++ b/lib/bundler/gem_helper.rb
0bc38e
@@ -74,7 +74,8 @@ def install
0bc38e
 
0bc38e
     def build_gem
0bc38e
       file_name = nil
0bc38e
-      sh("gem build -V '#{spec_path}'") do
0bc38e
+      gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
0bc38e
+      sh("#{gem} build -V #{spec_path}") do
0bc38e
         file_name = File.basename(built_gem_path)
0bc38e
         SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
0bc38e
         FileUtils.mv(built_gem_path, "pkg")
0bc38e
@@ -85,7 +86,10 @@ def build_gem
0bc38e
 
0bc38e
     def install_gem(built_gem_path = nil, local = false)
0bc38e
       built_gem_path ||= build_gem
0bc38e
-      out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}")
0bc38e
+      gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
0bc38e
+      cmd = "#{gem} install #{built_gem_path}"
0bc38e
+      cmd = "#{cmd} --local" if local
0bc38e
+      out, _ = sh_with_code(cmd)
0bc38e
       raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
0bc38e
       Bundler.ui.confirm "#{name} (#{version}) installed."
0bc38e
     end
0bc38e
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
0bc38e
index 37cbeeb4e7..74a5b86ec1 100644
0bc38e
--- a/spec/bundler/commands/clean_spec.rb
0bc38e
+++ b/spec/bundler/commands/clean_spec.rb
0bc38e
@@ -339,7 +339,8 @@ def should_not_have_gems(*gems)
0bc38e
       gem "rack"
0bc38e
     G
0bc38e
 
0bc38e
-    sys_exec! "gem list"
0bc38e
+    gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
0bc38e
+    sys_exec! "#{gem} list"
0bc38e
     expect(out).to include("rack (1.0.0)").and include("thin (1.0)")
0bc38e
   end
0bc38e
 
0bc38e
@@ -461,8 +462,9 @@ def should_not_have_gems(*gems)
0bc38e
     end
0bc38e
     bundle! :update, :all => bundle_update_requires_all?
0bc38e
 
0bc38e
-    sys_exec! "gem list"
0bc38e
-    expect(out).to include("foo (1.0.1, 1.0)")
0bc38e
+    gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
0bc38e
+    sys_exec! "#{gem} list"
0bc38e
+  expect(out).to include("foo (1.0.1, 1.0)")
0bc38e
   end
0bc38e
 
0bc38e
   it "cleans system gems when --force is used" do
0bc38e
@@ -485,7 +487,8 @@ def should_not_have_gems(*gems)
0bc38e
     bundle "clean --force"
0bc38e
 
0bc38e
     expect(out).to include("Removing foo (1.0)")
0bc38e
-    sys_exec "gem list"
0bc38e
+    gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
0bc38e
+    sys_exec "#{gem} list"
0bc38e
     expect(out).not_to include("foo (1.0)")
0bc38e
     expect(out).to include("rack (1.0.0)")
0bc38e
   end
0bc38e
@@ -519,7 +522,8 @@ def should_not_have_gems(*gems)
0bc38e
       expect(out).to include(system_gem_path.to_s)
0bc38e
       expect(out).to include("grant write permissions")
0bc38e
 
0bc38e
-      sys_exec "gem list"
0bc38e
+      gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
0bc38e
+      sys_exec "#{gem} list"
0bc38e
       expect(out).to include("foo (1.0)")
0bc38e
       expect(out).to include("rack (1.0.0)")
0bc38e
     end
0bc38e
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
0bc38e
index c18f7650fc..408d715ecf 100644
0bc38e
--- a/spec/bundler/support/rubygems_ext.rb
0bc38e
+++ b/spec/bundler/support/rubygems_ext.rb
0bc38e
@@ -59,11 +59,8 @@ def self.install_gems(gems)
0bc38e
       no_reqs.map!(&:first)
0bc38e
       reqs.map! {|name, req| "'#{name}:#{req}'" }
0bc38e
       deps = reqs.concat(no_reqs).join(" ")
0bc38e
-      cmd = if Gem::VERSION < "2.0.0"
0bc38e
-        "gem install #{deps} --no-rdoc --no-ri --conservative"
0bc38e
-      else
0bc38e
-        "gem install #{deps} --no-document --conservative"
0bc38e
-      end
0bc38e
+      gem = Spec::Path.ruby_core? ? ENV["BUNDLE_GEM"] : "#{Gem.ruby} -S gem"
0bc38e
+      cmd = "#{gem} install #{deps} --no-document --conservative"
0bc38e
       puts cmd
0bc38e
       system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
0bc38e
     end
0bc38e
-- 
0bc38e
2.31.1
0bc38e