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

ruby-changes:72802

From: David <ko1@a...>
Date: Wed, 3 Aug 2022 16:34:09 +0900 (JST)
Subject: [ruby-changes:72802] 35c65e7ba6 (master): [rubygems/rubygems] Fix conservative updates regardless of `--strict`

https://git.ruby-lang.org/ruby.git/commit/?id=35c65e7ba6

From 35c65e7ba6b4aa8bc80aaca8429a48c4eb923b89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Mon, 1 Aug 2022 16:41:31 +0200
Subject: [rubygems/rubygems] Fix conservative updates regardless of `--strict`

https://github.com/rubygems/rubygems/commit/c9a1d69a8d
---
 lib/bundler/cli/outdated.rb            |   2 +-
 spec/bundler/commands/outdated_spec.rb | 194 ++++++++++++++++-----------------
 2 files changed, 97 insertions(+), 99 deletions(-)

diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 9ce583886e..e9f93fec39 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -46,7 +46,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/outdated.rb#L46
 
       Bundler::CLI::Common.configure_gem_version_promoter(
         Bundler.definition,
-        options
+        options.merge(:strict => @strict)
       )
 
       definition_resolution = proc do
diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb
index a05a1ad4bb..6b7c95f01b 100644
--- a/spec/bundler/commands/outdated_spec.rb
+++ b/spec/bundler/commands/outdated_spec.rb
@@ -1098,127 +1098,125 @@ RSpec.describe "bundle outdated" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/outdated_spec.rb#L1098
   end
 
   context "conservative updates" do
-    context "without --strict" do
-      before do
-        build_repo4 do
-          build_gem "patch", %w[1.0.0 1.0.1]
-          build_gem "minor", %w[1.0.0 1.0.1 1.1.0]
-          build_gem "major", %w[1.0.0 1.0.1 1.1.0 2.0.0]
-        end
+    before do
+      build_repo4 do
+        build_gem "patch", %w[1.0.0 1.0.1]
+        build_gem "minor", %w[1.0.0 1.0.1 1.1.0]
+        build_gem "major", %w[1.0.0 1.0.1 1.1.0 2.0.0]
+      end
 
-        # establish a lockfile set to 1.0.0
-        install_gemfile <<-G
-          source "#{file_uri_for(gem_repo4)}"
-          gem 'patch', '1.0.0'
-          gem 'minor', '1.0.0'
-          gem 'major', '1.0.0'
-        G
+      # establish a lockfile set to 1.0.0
+      install_gemfile <<-G
+        source "#{file_uri_for(gem_repo4)}"
+        gem 'patch', '1.0.0'
+        gem 'minor', '1.0.0'
+        gem 'major', '1.0.0'
+      G
 
-        # remove all version requirements
-        gemfile <<-G
-          source "#{file_uri_for(gem_repo4)}"
-          gem 'patch'
-          gem 'minor'
-          gem 'major'
-        G
-      end
+      # remove all version requirements
+      gemfile <<-G
+        source "#{file_uri_for(gem_repo4)}"
+        gem 'patch'
+        gem 'minor'
+        gem 'major'
+      G
+    end
 
-      it "shows nothing when patching and filtering to minor" do
-        bundle "outdated --patch --filter-minor"
+    it "shows nothing when patching and filtering to minor" do
+      bundle "outdated --patch --filter-minor"
 
-        expect(out).to end_with("No minor updates to display.")
-      end
+      expect(out).to end_with("No minor updates to display.")
+    end
 
-      it "shows all gems when patching and filtering to patch" do
-        bundle "outdated --patch --filter-patch", :raise_on_error => false
+    it "shows all gems when patching and filtering to patch" do
+      bundle "outdated --patch --filter-patch", :raise_on_error => false
 
-        expected_output = <<~TABLE.strip
-          Gem    Current  Latest  Requested  Groups
-          major  1.0.0    1.0.1   >= 0       default
-          minor  1.0.0    1.0.1   >= 0       default
-          patch  1.0.0    1.0.1   >= 0       default
-        TABLE
+      expected_output = <<~TABLE.strip
+        Gem    Current  Latest  Requested  Groups
+        major  1.0.0    1.0.1   >= 0       default
+        minor  1.0.0    1.0.1   >= 0       default
+        patch  1.0.0    1.0.1   >= 0       default
+      TABLE
 
-        expect(out).to end_with(expected_output)
-      end
+      expect(out).to end_with(expected_output)
+    end
 
-      it "shows minor and major when updating to minor and filtering to patch and minor" do
-        bundle "outdated --minor --filter-minor", :raise_on_error => false
+    it "shows minor and major when updating to minor and filtering to patch and minor" do
+      bundle "outdated --minor --filter-minor", :raise_on_error => false
 
-        expected_output = <<~TABLE.strip
-          Gem    Current  Latest  Requested  Groups
-          major  1.0.0    1.1.0   >= 0       default
-          minor  1.0.0    1.1.0   >= 0       default
-        TABLE
+      expected_output = <<~TABLE.strip
+        Gem    Current  Latest  Requested  Groups
+        major  1.0.0    1.1.0   >= 0       default
+        minor  1.0.0    1.1.0   >= 0       default
+      TABLE
 
-        expect(out).to end_with(expected_output)
-      end
+      expect(out).to end_with(expected_output)
+    end
 
-      it "shows minor when updating to major and filtering to minor with parseable" do
-        bundle "outdated --major --filter-minor --parseable", :raise_on_error => false
+    it "shows minor when updating to major and filtering to minor with parseable" do
+      bundle "outdated --major --filter-minor --parseable", :raise_on_error => false
 
-        expect(out).not_to include("patch (newest")
-        expect(out).to include("minor (newest")
-        expect(out).not_to include("major (newest")
-      end
+      expect(out).not_to include("patch (newest")
+      expect(out).to include("minor (newest")
+      expect(out).not_to include("major (newest")
     end
+  end
 
-    context "with --strict" do
-      before do
-        build_repo4 do
-          build_gem "foo", %w[1.4.3 1.4.4] do |s|
-            s.add_dependency "bar", "~> 2.0"
-          end
-          build_gem "foo", %w[1.4.5 1.5.0] do |s|
-            s.add_dependency "bar", "~> 2.1"
-          end
-          build_gem "foo", %w[1.5.1] do |s|
-            s.add_dependency "bar", "~> 3.0"
-          end
-          build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0]
-          build_gem "qux", %w[1.0.0 1.1.0 2.0.0]
+  context "tricky conservative updates" do
+    before do
+      build_repo4 do
+        build_gem "foo", %w[1.4.3 1.4.4] do |s|
+          s.add_dependency "bar", "~> 2.0"
         end
+        build_gem "foo", %w[1.4.5 1.5.0] do |s|
+          s.add_dependency "bar", "~> 2.1"
+        end
+        build_gem "foo", %w[1.5.1] do |s|
+          s.add_dependency "bar", "~> 3.0"
+        end
+        build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0]
+        build_gem "qux", %w[1.0.0 1.1.0 2.0.0]
+      end
 
-        # establish a lockfile set to 1.4.3
-        install_gemfile <<-G
-          source "#{file_uri_for(gem_repo4)}"
-          gem 'foo', '1.4.3'
-          gem 'bar', '2.0.3'
-          gem 'qux', '1.0.0'
-        G
+      # establish a lockfile set to 1.4.3
+      install_gemfile <<-G
+        source "#{file_uri_for(gem_repo4)}"
+        gem 'foo', '1.4.3'
+        gem 'bar', '2.0.3'
+        gem 'qux', '1.0.0'
+      G
 
-        # remove 1.4.3 requirement and bar altogether
-        # to setup update specs below
-        gemfile <<-G
-          source "#{file_uri_for(gem_repo4)}"
-          gem 'foo'
-          gem 'qux'
-        G
-      end
+      # remove 1.4.3 requirement and bar altogether
+      # to setup update specs below
+      gemfile <<-G
+        source "#{file_uri_for(gem_repo4)}"
+        gem 'foo'
+        gem 'qux'
+      G
+    end
 
-      it "shows gems with --strict updating to patch and filtering to patch" do
-        bundle "outdated --patch --strict --filter-patch", :raise_on_error => false
+    it "shows gems updating to patch and filtering to patch" do
+      bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG_RESOLVER" => "1" }
 
-        expected_output = <<~TABLE.strip
-          Gem  Current  Latest  Requested  Groups
-          bar  2.0.3    2.0.5
-          foo  1.4.3    1.4.4   >= 0       default
-        TABLE
+      expected_output = <<~TABLE.strip
+        Gem  Current  Latest  Requested  Groups
+        bar  2.0.3    2.0.5
+        foo  1.4.3    1.4.4   >= 0       default
+      TABLE
 
-        expect(out).to end_with(expected_output)
-      end
+      expect(out).to end_with(expected_output)
+    end
 
-      it "shows gems with --strict updating to patch and filtering to patch, in debug mode" do
-        bundle "outdated --patch --strict --filter-patch", :raise_on_error => false, :env => { "DEBUG" => "1" }
+    it "shows gems updating to patch and filtering to patch, in debug mode" do
+      bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG" => "1" }
 
-        expected_output = <<~TABLE.strip
-          Gem  Current  Latest  Requested  Groups   Path
-          bar  2.0.3    2.0.5
-          foo  1.4.3    1.4.4   >= 0       default
-        TABLE
+      expected_output = <<~TABLE.strip
+        Gem  Current  Latest  Requested  Groups   Path
+        bar  2.0.3    2.0.5
+        foo  1.4.3    1.4.4   >= 0       default
+      TABLE
 
-        expect(out).to end_with(expected_output)
-      end
+      expect(out).to end_with(expected_output)
     end
   end
 
-- 
cgit v1.2.1


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

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