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

ruby-changes:69843

From: Hiroshi <ko1@a...>
Date: Mon, 22 Nov 2021 10:51:57 +0900 (JST)
Subject: [ruby-changes:69843] e262272b6a (ruby_3_0): Merge RubyGems 3.2.29 and Bundler 2.2.29

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

From e262272b6a50c1a92cdcfee684e82f9242ef8171 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Thu, 11 Nov 2021 10:44:07 +0900
Subject: Merge RubyGems 3.2.29 and Bundler 2.2.29

---
 lib/bundler/cli/gem.rb                         | 21 ++++++++++--
 lib/bundler/gem_helper.rb                      |  2 +-
 lib/bundler/source/git.rb                      | 22 +++++++++++--
 lib/bundler/version.rb                         |  2 +-
 lib/rubygems.rb                                |  2 +-
 lib/rubygems/defaults.rb                       |  2 +-
 lib/rubygems/errors.rb                         |  3 +-
 lib/rubygems/specification.rb                  |  4 +--
 lib/rubygems/specification_policy.rb           |  2 +-
 spec/bundler/bundler/source/git_spec.rb        | 45 ++++++++++++++++++++++++++
 spec/bundler/commands/newgem_spec.rb           |  2 +-
 spec/bundler/support/hax.rb                    |  5 ++-
 spec/bundler/support/path.rb                   |  9 +++++-
 test/rubygems/helper.rb                        |  2 ++
 test/rubygems/test_gem_source_fetch_problem.rb | 10 ++++++
 test/rubygems/test_gem_specification.rb        | 14 ++++++++
 tool/bundler/rubocop_gems.rb.lock              | 23 ++++++-------
 tool/bundler/test_gems.rb.lock                 |  2 +-
 18 files changed, 143 insertions(+), 29 deletions(-)

diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index b3bb025b899..02f19ad115d 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -68,7 +68,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L68
         :bundler_version  => bundler_dependency_version,
         :git              => use_git,
         :github_username  => github_username.empty? ? "[USERNAME]" : github_username,
-        :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
+        :required_ruby_version => required_ruby_version,
       }
       ensure_safe_gem_name(name, constant_array)
 
@@ -169,7 +169,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L169
         "For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
         "and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
         config[:rubocop] = true
-        config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
+        config[:rubocop_version] = rubocop_version
         Bundler.ui.info "RuboCop enabled in config"
         templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
       end
@@ -350,5 +350,22 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/gem.rb#L350
     def open_editor(editor, file)
       thor.run(%(#{editor} "#{file}"))
     end
+
+    def required_ruby_version
+      if Gem.ruby_version < Gem::Version.new("2.4.a") then "2.3.0"
+      elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "2.4.0"
+      elsif Gem.ruby_version < Gem::Version.new("2.6.a") then "2.5.0"
+      else
+        "2.6.0"
+      end
+    end
+
+    def rubocop_version
+      if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.81.0"
+      elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.12"
+      else
+        "1.21"
+      end
+    end
   end
 end
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 6096adfa271..8e1dd7c4f2b 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -76,7 +76,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/gem_helper.rb#L76
         tag_version { git_push(args[:remote]) } unless already_tagged?
       end
 
-      task "release:rubygem_push" do
+      task "release:rubygem_push" => "build" do
         rubygem_push(built_gem_path) if gem_push?
       end
 
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index fb13ca05786..679fb225745 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -42,7 +42,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/git.rb#L42
         %w[ref branch tag submodules].each do |opt|
           out << "  #{opt}: #{options[opt]}\n" if options[opt]
         end
-        out << "  glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
+        out << "  glob: #{@glob}\n" unless default_glob?
         out << "  specs:\n"
       end
 
@@ -75,12 +75,20 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/git.rb#L75
             git_proxy.branch
           end
 
-          rev = " (at #{at}@#{shortref_for_display(revision)})"
+          rev = "at #{at}@#{shortref_for_display(revision)}"
         rescue GitError
           ""
         end
 
-        "#{@safe_uri}#{rev}"
+        specifiers = [rev, glob_for_display].compact
+        suffix =
+          if specifiers.any?
+            " (#{specifiers.join(", ")})"
+          else
+            ""
+          end
+
+        "#{@safe_uri}#{suffix}"
       end
 
       def name
@@ -282,6 +290,14 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/git.rb#L290
         ref[0..11]
       end
 
+      def glob_for_display
+        default_glob? ? nil : "glob: #{@glob}"
+      end
+
+      def default_glob?
+        @glob == DEFAULT_GLOB
+      end
+
       def uri_hash
         if uri =~ %r{^\w+://(\w+@)?}
           # Downcase the domain component of the URI
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index cf4965c0db5..23a568c8ba0 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/version.rb#L1
 # frozen_string_literal: false
 
 module Bundler
-  VERSION = "2.2.28".freeze
+  VERSION = "2.2.29".freeze
 
   def self.bundler_major_version
     @bundler_major_version ||= VERSION.split(".").first.to_i
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index ebe9d7baddb..3c48f2a8ac4 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L8
 require 'rbconfig'
 
 module Gem
-  VERSION = "3.2.28".freeze
+  VERSION = "3.2.29".freeze
 end
 
 # Must be first since it unloads the prelude from 1.9.2
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index e95bc067927..923b60f31f3 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -73,7 +73,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L73
   # Path to specification files of default gems.
 
   def self.default_specifications_dir
-    File.join(Gem.default_dir, "specifications", "default")
+    @default_specifications_dir ||= File.join(Gem.default_dir, "specifications", "default")
   end
 
   ##
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb
index abee20651e3..86f0d1da14b 100644
--- a/lib/rubygems/errors.rb
+++ b/lib/rubygems/errors.rb
@@ -171,8 +171,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/errors.rb#L171
     # An English description of the error.
 
     def wordy
-      @source.uri.password = 'REDACTED' unless @source.uri.password.nil?
-      "Unable to download data from #{@source.uri} - #{@error.message}"
+      "Unable to download data from #{Gem::Uri.new(@source.uri).redacted} - #{@error.message}"
     end
 
     ##
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index e31ac8ede54..aaa3b8ce7b4 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -1556,8 +1556,8 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1556
   # the gem.build_complete file is missing.
 
   def build_extensions # :nodoc:
-    return if default_gem?
     return if extensions.empty?
+    return if default_gem?
     return if File.exist? gem_build_complete_path
     return if !File.writable?(base_dir)
     return if !File.exist?(File.join(base_dir, 'extensions'))
@@ -2120,8 +2120,8 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2120
   # probably want to build_extensions
 
   def missing_extensions?
-    return false if default_gem?
     return false if extensions.empty?
+    return false if default_gem?
     return false if File.exist? gem_build_complete_path
 
     true
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index c30ec707d98..73bd31970c3 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -381,7 +381,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification_policy.rb#L381
   end
 
   LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
-  LAZY_PATTERN = /^FI XME|^TO DO/x.freeze
+  LAZY_PATTERN = /\AFI XME|\ATO DO/x.freeze
   HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze
 
   def validate_lazy_metadata
diff --git a/spec/bundler/bundler/source/git_spec.rb b/spec/bundler/bundler/source/git_spec.rb
index 6668b6e69ab..ed6dc3cd29f 100644
--- a/spec/bundler/bundler/source/git_spec.rb
+++ b/spec/bundler/bundler/source/git_spec.rb
@@ -24,5 +24,50 @@ RSpec.describe Bundler::Source::Git do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/source/git_spec.rb#L24
         expect(subject.to_s).to eq "https://x-oauth-basic@g.../foo/bar.git"
       end
     end
+
+    context "when the source has a glob specifier" do
+      let(:glob) { "bar/baz/*.gemspec" }
+      let(:options) do
+        { "uri" => uri, "glob" => glob }
+      end
+
+      it "includes it" do
+        expect(subject.to_s).to eq "https://github.com/foo/bar.git (glob: bar/baz/*.gemspec)"
+      end
+    end
+
+    context "when the source has a reference" do
+      let(:git_proxy_stub) do
+        instance_double(Bundler::Source::Git::GitProxy, :revision => "123abc", :branch => "v1.0.0")
+      end
+      let(: (... truncated)

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

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