diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-08-22 11:49:20 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2022-09-03 15:54:07 +0900 |
commit | 091878334780a9d6618ff83371fde39d85b635b5 (patch) | |
tree | 32a9f0dcc8ed45bbd17510da5ad73b4a3e62986d /lib/rubygems | |
parent | 7ef68dd74af151a340a592869c28a0f78d2f11fb (diff) |
Merge RubyGems-3.3.18 and Bundler-2.3.18
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 9 | ||||
-rw-r--r-- | lib/rubygems/commands/update_command.rb | 6 | ||||
-rw-r--r-- | lib/rubygems/gem_runner.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/platform.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 24 |
6 files changed, 42 insertions, 13 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 84e9210cfb..35b500936d 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -365,10 +365,11 @@ By default, this RubyGems will install gem as: bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") } - # Remove bundler-*.gemspec in default specification directory. - Dir.entries(specs_dir). - select {|gs| gs.start_with?("bundler-") }. - each {|gs| File.delete(File.join(specs_dir, gs)) } + current_default_spec = Gem::Specification.default_stubs.find {|s| s.name == "bundler" } + if current_default_spec + File.delete(current_default_spec.loaded_from) + Gem::Specification.remove_spec current_default_spec + end default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec") Gem.write_binary(default_spec_path, bundler_spec.to_ruby) diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 54b1251010..4080bf5feb 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -118,15 +118,19 @@ command to remove old versions. updated = update_gems gems_to_update + installed_names = highest_installed_gems.keys updated_names = updated.map {|spec| spec.name } not_updated_names = options[:args].uniq - updated_names + not_installed_names = not_updated_names - installed_names + up_to_date_names = not_updated_names - not_installed_names if updated.empty? say "Nothing to update" else say "Gems updated: #{updated_names.join(' ')}" - say "Gems already up-to-date: #{not_updated_names.join(' ')}" unless not_updated_names.empty? end + say "Gems already up-to-date: #{up_to_date_names.join(' ')}" unless up_to_date_names.empty? + say "Gems not currently installed: #{not_installed_names.join(' ')}" unless not_installed_names.empty? end def fetch_remote_gems(spec) # :nodoc: diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb index 89b23b26aa..b3f925773b 100644 --- a/lib/rubygems/gem_runner.rb +++ b/lib/rubygems/gem_runner.rb @@ -10,11 +10,6 @@ require_relative 'command_manager' require_relative 'deprecate' ## -# Load additional plugins from $LOAD_PATH - -Gem.load_env_plugins rescue nil - -## # Run an instance of the gem program. # # Gem::GemRunner is only intended for internal use by RubyGems itself. It @@ -37,6 +32,9 @@ class Gem::GemRunner do_configuration args + Gem.load_env_plugins rescue nil + Gem.load_plugins + cmd = @command_manager_class.instance cmd.command_names.each do |command_name| @@ -75,5 +73,3 @@ class Gem::GemRunner Gem::Command.extra_args = Gem.configuration[:gem] end end - -Gem.load_plugins diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 0613399890..7484145467 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -340,7 +340,7 @@ class Gem::Installer say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil? - Gem::Specification.reset + Gem::Specification.add_spec(spec) run_post_install_hooks diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index f48f4bdc76..8fcabf164d 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -159,6 +159,10 @@ class Gem::Platform def ===(other) return nil unless Gem::Platform === other + # universal-mingw32 matches x64-mingw-ucrt + return true if (@cpu == 'universal' or other.cpu == 'universal') and + @os.start_with?('mingw') and other.os.start_with?('mingw') + # cpu ([nil,'universal'].include?(@cpu) or [nil, 'universal'].include?(other.cpu) or @cpu == other.cpu or (@cpu == 'arm' and other.cpu.start_with?("arm"))) and diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 01aa8fd942..0ced1d9020 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -884,6 +884,30 @@ class Gem::Specification < Gem::BasicSpecification end ## + # Adds +spec+ to the known specifications, keeping the collection + # properly sorted. + + def self.add_spec(spec) + return if _all.include? spec + + _all << spec + stubs << spec + (@@stubs_by_name[spec.name] ||= []) << spec + + _resort!(@@stubs_by_name[spec.name]) + _resort!(stubs) + end + + ## + # Removes +spec+ from the known specs. + + def self.remove_spec(spec) + _all.delete spec.to_spec + stubs.delete spec + (@@stubs_by_name[spec.name] || []).delete spec + end + + ## # Returns all specifications. This method is discouraged from use. # You probably want to use one of the Enumerable methods instead. |