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

ruby-changes:72800

From: Hiroshi <ko1@a...>
Date: Wed, 3 Aug 2022 13:14:24 +0900 (JST)
Subject: [ruby-changes:72800] 71794a75db (master): Merge rubygems/bundler HEAD

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

From 71794a75db5d3da810146da106baf7eb5e86f745 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Wed, 3 Aug 2022 12:24:38 +0900
Subject: Merge rubygems/bundler HEAD

  Pick from https://github.com/rubygems/rubygems/commit/8331e63263081a6aa690d8025d2957f30c4e814a
---
 lib/bundler/cli/platform.rb                        |    2 +-
 lib/bundler/cli/viz.rb                             |    2 +-
 lib/bundler/constants.rb                           |    2 +-
 lib/bundler/fetcher/downloader.rb                  |    2 +-
 lib/bundler/templates/Executable                   |    2 +-
 lib/bundler/templates/Executable.bundler           |    5 +-
 lib/bundler/templates/Executable.standalone        |    2 +
 lib/rubygems.rb                                    |    2 +-
 lib/rubygems/commands/rdoc_command.rb              |    5 +-
 lib/rubygems/defaults.rb                           |    2 +-
 lib/rubygems/ext/builder.rb                        |    2 +-
 lib/rubygems/installer.rb                          |    4 +-
 lib/rubygems/validator.rb                          |    2 +-
 spec/bundler/commands/platform_spec.rb             | 1284 ++++++++++++++++++++
 spec/bundler/other/platform_spec.rb                | 1284 --------------------
 spec/bundler/quality_spec.rb                       |    2 +-
 spec/bundler/realworld/edgecases_spec.rb           |    6 +-
 spec/bundler/runtime/setup_spec.rb                 |    4 +-
 test/rubygems/helper.rb                            |    2 +-
 test/rubygems/test_bundled_ca.rb                   |    2 +-
 test/rubygems/test_gem_bundler_version_finder.rb   |    2 +-
 test/rubygems/test_gem_ext_builder.rb              |    6 +-
 test/rubygems/test_gem_ext_cargo_builder.rb        |    2 +-
 test/rubygems/test_gem_installer.rb                |    2 +-
 test/rubygems/test_gem_requirement.rb              |    2 +-
 .../test_gem_resolver_git_specification.rb         |    2 +-
 test/rubygems/test_gem_security_trust_dir.rb       |    4 +-
 test/rubygems/test_kernel.rb                       |   16 +-
 28 files changed, 1329 insertions(+), 1325 deletions(-)
 create mode 100644 spec/bundler/commands/platform_spec.rb
 delete mode 100644 spec/bundler/other/platform_spec.rb

diff --git a/lib/bundler/cli/platform.rb b/lib/bundler/cli/platform.rb
index 068c765aad..16d4e0145a 100644
--- a/lib/bundler/cli/platform.rb
+++ b/lib/bundler/cli/platform.rb
@@ -9,7 +9,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/platform.rb#L9
 
     def run
       platforms, ruby_version = Bundler.ui.silence do
-        locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version
+        locked_ruby_version = Bundler.locked_gems && Bundler.locked_gems.ruby_version.gsub(/p\d+\Z/, "")
         gemfile_ruby_version = Bundler.definition.ruby_version && Bundler.definition.ruby_version.single_version_string
         [Bundler.definition.platforms.map {|p| "* #{p}" },
          locked_ruby_version || gemfile_ruby_version]
diff --git a/lib/bundler/cli/viz.rb b/lib/bundler/cli/viz.rb
index 644f9b25cf..5c09e00995 100644
--- a/lib/bundler/cli/viz.rb
+++ b/lib/bundler/cli/viz.rb
@@ -23,7 +23,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/viz.rb#L23
       Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:"
       Bundler.ui.warn "`gem install ruby-graphviz`"
     rescue StandardError => e
-      raise unless e.message =~ /GraphViz not installed or dot not in PATH/
+      raise unless e.message.to_s.include?("GraphViz not installed or dot not in PATH")
       Bundler.ui.error e.message
       Bundler.ui.warn "Please install GraphViz. On a Mac with Homebrew, you can run `brew install graphviz`."
     end
diff --git a/lib/bundler/constants.rb b/lib/bundler/constants.rb
index 2e4ebb37ee..8dd8a53815 100644
--- a/lib/bundler/constants.rb
+++ b/lib/bundler/constants.rb
@@ -2,6 +2,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/constants.rb#L2
 
 module Bundler
   WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
-  FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
+  FREEBSD = RbConfig::CONFIG["host_os"].to_s.include?("bsd")
   NULL    = WINDOWS ? "NUL" : "/dev/null"
 end
diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb
index f2aad3a500..0a668eb17c 100644
--- a/lib/bundler/fetcher/downloader.rb
+++ b/lib/bundler/fetcher/downloader.rb
@@ -68,7 +68,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/fetcher/downloader.rb#L68
         raise CertificateFailureError.new(uri)
       rescue *HTTP_ERRORS => e
         Bundler.ui.trace e
-        if e.is_a?(SocketError) || e.message =~ /host down:/
+        if e.is_a?(SocketError) || e.message.to_s.include?("host down:")
           raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
             "connection and try again."
         else
diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable
index f6487e3c89..9ff6f00898 100644
--- a/lib/bundler/templates/Executable
+++ b/lib/bundler/templates/Executable
@@ -13,7 +13,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("<%= relative_gemfile_path %>", __dir https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/Executable#L13
 bundle_binstub = File.expand_path("bundle", __dir__)
 
 if File.file?(bundle_binstub)
-  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
+  if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
     load(bundle_binstub)
   else
     abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
diff --git a/lib/bundler/templates/Executable.bundler b/lib/bundler/templates/Executable.bundler
index 51650c7664..77f90e735c 100644
--- a/lib/bundler/templates/Executable.bundler
+++ b/lib/bundler/templates/Executable.bundler
@@ -62,8 +62,9 @@ m = Module.new do https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/Executable.bundler#L62
 
   def bundler_requirement
     @bundler_requirement ||=
-      env_var_version || cli_arg_version ||
-        bundler_requirement_for(lockfile_version)
+      env_var_version ||
+      cli_arg_version ||
+      bundler_requirement_for(lockfile_version)
   end
 
   def bundler_requirement_for(version)
diff --git a/lib/bundler/templates/Executable.standalone b/lib/bundler/templates/Executable.standalone
index d591e3fc04..3117a27e86 100644
--- a/lib/bundler/templates/Executable.standalone
+++ b/lib/bundler/templates/Executable.standalone
@@ -1,4 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/Executable.standalone#L1
 #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
+# frozen_string_literal: true
+
 #
 # This file was generated by Bundler.
 #
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index e59cd26870..b21f00acc7 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1010,7 +1010,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1010
   # Is this platform Solaris?
 
   def self.solaris_platform?
-    RUBY_PLATFORM =~ /solaris/
+    RUBY_PLATFORM.include?("solaris")
   end
 
   ##
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index 17ad6f836b..a998a9704c 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -86,8 +86,9 @@ Use --overwrite to force rebuilding of documentation. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/rdoc_command.rb#L86
       begin
         doc.generate
       rescue Errno::ENOENT => e
-        e.message =~ / - /
-        alert_error "Unable to document #{spec.full_name}, #{$'} is missing, skipping"
+        match = / - /.match(e.message)
+        alert_error "Unable to document #{spec.full_name}, " \
+                    " #{match.post_match} is missing, skipping"
         terminate_interaction 1 if specs.length == 1
       end
     end
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index d27f286265..b805ef9174 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -171,7 +171,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L171
   def self.default_exec_format
     exec_format = RbConfig::CONFIG["ruby_install_name"].sub("ruby", "%s") rescue "%s"
 
-    unless exec_format =~ /%s/
+    unless exec_format.include?("%s")
       raise Gem::Exception,
         "[BUG] invalid exec_format #{exec_format.inspect}, no %s"
     end
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index c5a03806b9..b46f9b5cd5 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -26,7 +26,7 @@ class Gem::Ext::Builder https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/builder.rb#L26
     RbConfig::CONFIG["configure_args"] =~ /with-make-prog\=(\w+)/
     make_program_name = ENV["MAKE"] || ENV["make"] || $1
     unless make_program_name
-      make_program_name = (/mswin/ =~ RUBY_PLATFORM) ? "nmake" : "make"
+      make_program_name = (RUBY_PLATFORM.include?("mswin")) ? "nmake" : "make"
     end
     make_program = Shellwords.split(make_program_name)
 
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 52307f6d93..8ec75d1ff7 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -234,8 +234,8 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L234
       io.gets # blankline
 
       # TODO detect a specially formatted comment instead of trying
-      # to run a regexp against Ruby code.
-      next unless io.gets =~ /This file was generated by RubyGems/
+      # to find a string inside Ruby code.
+      next unless io.gets.to_s.include?("This file was generated by RubyGems")
 
       ruby_executable = true
       existing = io.read.slice(%r{
diff --git a/li (... truncated)

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

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