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

ruby-changes:72290

From: David <ko1@a...>
Date: Thu, 23 Jun 2022 18:17:23 +0900 (JST)
Subject: [ruby-changes:72290] 4f5eb48dea (master): [rubygems/rubygems] Fix `bundle package --no-install` no longer skipping install

https://git.ruby-lang.org/ruby.git/commit/?id=4f5eb48dea

From 4f5eb48dead5c82b966c1fdebc890cf9d3010d86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Tue, 21 Jun 2022 20:02:17 +0200
Subject: [rubygems/rubygems] Fix `bundle package --no-install` no longer
 skipping install

This is a regression from https://github.com/rubygems/rubygems/commit/cf749f8ffabd. The
funny thing is that we have a spec for this feature, so it was unclear
how we regressed here. It turns out there was a bug in one of our
negative matchers checking that gems ARE NOT included in a bundle.

This commit fixes the bug in the negative matcher and reverts
https://github.com/rubygems/rubygems/commit/cf749f8ffabd (with a slightly simpler diff).

https://github.com/rubygems/rubygems/commit/3f9a4ff32a
---
 lib/bundler/cli.rb               | 8 ++++++--
 lib/bundler/cli/cache.rb         | 2 +-
 lib/bundler/cli/install.rb       | 2 ++
 lib/bundler/source/rubygems.rb   | 2 ++
 spec/bundler/support/matchers.rb | 2 +-
 5 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 3d93ce5e6f..e1c284130b 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -251,7 +251,9 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L251
       remembered_negative_flag_deprecation("no-deployment")
 
       require_relative "cli/install"
-      Install.new(options.dup).run
+      Bundler.settings.temporary(:no_install => false) do
+        Install.new(options.dup).run
+      end
     end
 
     map aliases_for("install")
@@ -297,7 +299,9 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L299
     def update(*gems)
       SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
       require_relative "cli/update"
-      Update.new(options, gems).run
+      Bundler.settings.temporary(:no_install => false) do
+        Update.new(options, gems).run
+      end
     end
 
     desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb
index eb5dd23092..c8698ed7e3 100644
--- a/lib/bundler/cli/cache.rb
+++ b/lib/bundler/cli/cache.rb
@@ -14,7 +14,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/cache.rb#L14
       Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
 
       setup_cache_all
-      install unless Bundler.settings[:no_install]
+      install
 
       # TODO: move cache contents here now that all bundles are locked
       custom_path = Bundler.settings[:path] if options[:path]
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index acf92f28ad..e9b85f7f6f 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -161,6 +161,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/install.rb#L161
 
       Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
 
+      Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
+
       Bundler.settings.set_command_option_if_given :clean, options["clean"]
 
       normalize_groups if options[:without] || options[:with]
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index f78e6a443b..04ba4a654c 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -160,6 +160,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L160
           raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
         end
 
+        return if Bundler.settings[:no_install]
+
         if requires_sudo?
           install_path = Bundler.tmp(spec.full_name)
           bin_path     = install_path.join("bin")
diff --git a/spec/bundler/support/matchers.rb b/spec/bundler/support/matchers.rb
index 3c2a7f9f58..ce6b216619 100644
--- a/spec/bundler/support/matchers.rb
+++ b/spec/bundler/support/matchers.rb
@@ -178,7 +178,7 @@ module Spec https://github.com/ruby/ruby/blob/trunk/spec/bundler/support/matchers.rb#L178
 
             begin
               require '#{name}'
-              name_constant = '#{Spec::Builders.constantize(name)}'
+              name_constant = #{Spec::Builders.constantize(name)}
               if #{version.nil?} || name_constant == '#{version}'
                 exit 64
               else
-- 
cgit v1.2.1


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

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