diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-01-14 13:37:23 +0900 |
---|---|---|
committer | NARUSE, Yui <nurse@users.noreply.github.com> | 2021-01-14 16:44:42 +0900 |
commit | c721e36ceca587d823a765cbbad90911a20cffce (patch) | |
tree | 96f70401c4ad1a22c688b6516111083d2d2a905c /lib | |
parent | d4f5827a6d445941450a2ec5dac5e51e333ef745 (diff) |
Merge RubyGems-3.2.4
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 76 | ||||
-rw-r--r-- | lib/rubygems/ext/builder.rb | 6 | ||||
-rw-r--r-- | lib/rubygems/ext/cmake_builder.rb | 3 | ||||
-rw-r--r-- | lib/rubygems/ext/configure_builder.rb | 3 | ||||
-rw-r--r-- | lib/rubygems/remote_fetcher.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/resolver/best_set.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/resolver/index_specification.rb | 5 | ||||
-rw-r--r-- | lib/rubygems/test_case.rb | 6 |
9 files changed, 33 insertions, 74 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index fe52d72cc3..0c3e5858d4 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = "3.2.3".freeze + VERSION = "3.2.4".freeze end # Must be first since it unloads the prelude from 1.9.2 diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 22b1371a1f..b5af43d7b7 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -6,8 +6,8 @@ require 'rubygems/command' # RubyGems checkout or tarball. class Gem::Commands::SetupCommand < Gem::Command - HISTORY_HEADER = /^===\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze - VERSION_MATCHER = /^===\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze + HISTORY_HEADER = /^#\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze + VERSION_MATCHER = /^#\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze ENV_PATHS = %w[/usr/bin/env /bin/env].freeze @@ -167,19 +167,18 @@ By default, this RubyGems will install gem as: extend MakeDirs lib_dir, bin_dir = make_destination_dirs install_destdir - man_dir = make_man_dir install_destdir + man_dir = generate_default_man_dir install_destdir install_lib lib_dir - install_man man_dir - install_executables bin_dir remove_old_bin_files bin_dir remove_old_lib_files lib_dir - remove_old_man_files man_dir + # Can be removed one we drop support for bundler 2.2.3 (the last version installing man files to man_dir) + remove_old_man_files man_dir if man_dir && File.exist?(man_dir) install_default_bundler_gem bin_dir @@ -330,21 +329,6 @@ By default, this RubyGems will install gem as: end end - def install_man(man_dir) - mans = { 'Bundler' => 'bundler/man' } - mans.each do |tool, path| - say "Installing #{tool} manpages" if @verbose - - bundler_man1_files = bundler_man1_files_in(path) - bundler_man5_files = bundler_man5_files_in(path) - - Dir.chdir path do - install_file_list(bundler_man1_files, "#{man_dir}/man1") - install_file_list(bundler_man5_files, "#{man_dir}/man5") - end - end - end - def install_rdoc gem_doc_dir = File.join Gem.dir, 'doc' rubygems_name = "rubygems-#{Gem::VERSION}" @@ -392,7 +376,7 @@ By default, this RubyGems will install gem as: mkdir_p specs_dir, :mode => 0755 bundler_spec = Gem::Specification.load("bundler/bundler.gemspec") - bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe,man}/**/*}"] } + bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe}/**/*}"] } bundler_spec.executables -= %w[bundler bundle_ruby] # Remove bundler-*.gemspec in default specification directory. @@ -455,19 +439,12 @@ By default, this RubyGems will install gem as: return lib_dir, bin_dir end - def make_man_dir(install_destdir) - man_dir = generate_default_man_dir(install_destdir) - - mkdir_p man_dir, :mode => 0755 - - return man_dir - end - def generate_default_man_dir(install_destdir) prefix = options[:prefix] if prefix.empty? man_dir = RbConfig::CONFIG['mandir'] + return unless man_dir else man_dir = File.join prefix, 'man' end @@ -518,20 +495,6 @@ By default, this RubyGems will install gem as: end end - # for installation of bundler as default gems - def bundler_man1_files_in(dir) - Dir.chdir dir do - Dir['bundle*.1'] - end - end - - # for installation of bundler as default gems - def bundler_man5_files_in(dir) - Dir.chdir dir do - Dir['gemfile.5'] - end - end - def remove_old_bin_files(bin_dir) old_bin_files = { 'gem_mirror' => 'gem mirror', @@ -585,33 +548,26 @@ abort "#{deprecation_message}" end end - def remove_old_man_files(man_dir) - man_dirs = { man_dir => "bundler/man" } - man_dirs.each do |old_man_dir, new_man_dir| - man1_files = bundler_man1_files_in(new_man_dir) - - old_man1_dir = "#{old_man_dir}/man1" - old_man1_files = bundler_man1_files_in(old_man1_dir) - old_man1_files += Dir.chdir(old_man1_dir) { Dir["bundle*.1.{txt,ronn}"] } + def remove_old_man_files(old_man_dir) + old_man1_dir = "#{old_man_dir}/man1" - man1_to_remove = old_man1_files - man1_files + if File.exist?(old_man1_dir) + man1_to_remove = Dir.chdir(old_man1_dir) { Dir["bundle*.1{,.txt,.ronn}"] } remove_file_list(man1_to_remove, old_man1_dir) + end - man5_files = bundler_man5_files_in(new_man_dir) - - old_man5_dir = "#{old_man_dir}/man5" - old_man5_files = bundler_man5_files_in(old_man5_dir) - old_man5_files += Dir.chdir(old_man5_dir) { Dir["gemfile.5.{txt,ronn}"] } + old_man5_dir = "#{old_man_dir}/man5" - man5_to_remove = old_man5_files - man5_files + if File.exist?(old_man5_dir) + man5_to_remove = Dir.chdir(old_man5_dir) { Dir["gemfile.5{,.txt,.ronn}"] } remove_file_list(man5_to_remove, old_man5_dir) end end def show_release_notes - release_notes = File.join Dir.pwd, 'History.txt' + release_notes = File.join Dir.pwd, 'CHANGELOG.md' release_notes = if File.exist? release_notes diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index f6de6a50d7..222fb9aa5e 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -29,7 +29,7 @@ class Gem::Ext::Builder make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make' end - destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] + destdir = 'DESTDIR=%s' % ENV['DESTDIR'] ['clean', '', 'install'].each do |target| # Pass DESTDIR via command line to override what's in MAKEFLAGS @@ -37,7 +37,7 @@ class Gem::Ext::Builder make_program, destdir, target, - ].join(' ').rstrip + ].reject(&:empty?) begin run(cmd, results, "make #{target}".rstrip, make_dir) rescue Gem::InstallError @@ -56,7 +56,7 @@ class Gem::Ext::Builder p(command) end results << "current directory: #{dir}" - results << (command.respond_to?(:shelljoin) ? command.shelljoin : command) + results << command.shelljoin require "open3" # Set $SOURCE_DATE_EPOCH for the subprocess. diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb index 2efec91f15..269e876cfa 100644 --- a/lib/rubygems/ext/cmake_builder.rb +++ b/lib/rubygems/ext/cmake_builder.rb @@ -4,8 +4,7 @@ require_relative '../command' class Gem::Ext::CmakeBuilder < Gem::Ext::Builder def self.build(extension, dest_path, results, args=[], lib_dir=nil, cmake_dir=Dir.pwd) unless File.exist?(File.join(cmake_dir, 'Makefile')) - cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}" - cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty? + cmd = ["cmake", ".", "-DCMAKE_INSTALL_PREFIX=#{dest_path}", *Gem::Command.build_args] run cmd, results, class_name, cmake_dir end diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb index 36a758989b..eb2f9fce61 100644 --- a/lib/rubygems/ext/configure_builder.rb +++ b/lib/rubygems/ext/configure_builder.rb @@ -8,8 +8,7 @@ class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder def self.build(extension, dest_path, results, args=[], lib_dir=nil, configure_dir=Dir.pwd) unless File.exist?(File.join(configure_dir, 'Makefile')) - cmd = "sh ./configure --prefix=#{dest_path}" - cmd << " #{args.join ' '}" unless args.empty? + cmd = ["sh", "./configure", "--prefix=#{dest_path}", *args] run cmd, results, class_name, configure_dir end diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index 285c80a95f..53e840978c 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -26,13 +26,15 @@ class Gem::RemoteFetcher ## # The URI which was being accessed when the exception happened. - attr_accessor :uri + attr_accessor :uri, :original_uri def initialize(message, uri) super message uri = parse_uri(uri) + @original_uri = uri.dup + uri.password = 'REDACTED' if uri.respond_to?(:password) && uri.password @uri = uri.to_s diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb index b6a46a9403..300ea8015c 100644 --- a/lib/rubygems/resolver/best_set.rb +++ b/lib/rubygems/resolver/best_set.rb @@ -58,7 +58,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet # The calling method must retry the exception to repeat the lookup. def replace_failed_api_set(error) # :nodoc: - uri = error.uri + uri = error.original_uri uri = URI uri unless URI === uri uri = uri + "." diff --git a/lib/rubygems/resolver/index_specification.rb b/lib/rubygems/resolver/index_specification.rb index 45ff130a14..2aa6b419ba 100644 --- a/lib/rubygems/resolver/index_specification.rb +++ b/lib/rubygems/resolver/index_specification.rb @@ -43,9 +43,12 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification ## # The required_rubygems_version constraint for this specification # + # A fallback is included because the original version of the specification + # API didn't include that field, so some marshalled specs in the index have it + # set to +nil+. def required_rubygems_version - spec.required_rubygems_version + spec.required_rubygems_version || Gem::Requirement.default end def ==(other) diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index a8261ef5c2..6523c515be 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -250,16 +250,16 @@ class Gem::TestCase < Minitest::Test def assert_contains_make_command(target, output, msg = nil) if output.match(/\n/) msg = message(msg) do - 'Expected output containing make command "%s": %s' % [ + "Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [ ('%s %s' % [make_command, target]).rstrip, - output.inspect, + output, ] end else msg = message(msg) do 'Expected make command "%s": %s' % [ ('%s %s' % [make_command, target]).rstrip, - output.inspect, + output, ] end end |