diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-12-14 21:14:58 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-12-15 18:05:18 +0900 |
commit | 7e084ed707310139b351f6d30af435676422af62 (patch) | |
tree | db7450ae96ccd8d90287e33412769230da247242 /lib/rubygems | |
parent | 583e06e28f5ed4078393000f929f4380777ba972 (diff) |
Merge RubyGems and Bundler master
Merge from https://github.com/rubygems/rubygems/commit/793ad95ecb40e84a1dcb4cb60f2686843ed90de5
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5265
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/requirement.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 20 | ||||
-rw-r--r-- | lib/rubygems/version.rb | 7 |
4 files changed, 12 insertions, 21 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index ed1fcaa4b8..0601dccb07 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -12,8 +12,6 @@ class Gem::Commands::SetupCommand < Gem::Command ENV_PATHS = %w[/usr/bin/env /bin/env].freeze def initialize - require 'tmpdir' - super 'setup', 'Install RubyGems', :format_executable => false, :document => %w[ri], :force => true, @@ -253,6 +251,8 @@ By default, this RubyGems will install gem as: Dir.chdir path do bin_file = "gem" + require 'tmpdir' + dest_file = target_bin_path(bin_dir, bin_file) bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}" diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb index d2e28fab5b..9edd6aa7d3 100644 --- a/lib/rubygems/requirement.rb +++ b/lib/rubygems/requirement.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require_relative "deprecate" +require_relative "version" ## # A Requirement is a set of one or more version restrictions. It supports a diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 40a5bddff6..dc5e5ba013 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -9,6 +9,8 @@ require_relative 'deprecate' require_relative 'basic_specification' require_relative 'stub_specification' +require_relative 'platform' +require_relative 'requirement' require_relative 'specification_policy' require_relative 'util/list' @@ -179,18 +181,14 @@ class Gem::Specification < Gem::BasicSpecification end def self.clear_specs # :nodoc: - @@all_specs_mutex.synchronize do - @@all = nil - @@stubs = nil - @@stubs_by_name = {} - @@spec_with_requirable_file = {} - @@active_stub_with_requirable_file = {} - end + @@all = nil + @@stubs = nil + @@stubs_by_name = {} + @@spec_with_requirable_file = {} + @@active_stub_with_requirable_file = {} end private_class_method :clear_specs - @@all_specs_mutex = Thread::Mutex.new - clear_specs # Sentinel object to represent "not found" stubs @@ -758,7 +756,7 @@ class Gem::Specification < Gem::BasicSpecification attr_accessor :specification_version def self._all # :nodoc: - @@all_specs_mutex.synchronize { @@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec) } + @@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec) end def self.clear_load_cache # :nodoc: @@ -1086,7 +1084,7 @@ class Gem::Specification < Gem::BasicSpecification # +prerelease+ is true. def self.latest_specs(prerelease = false) - _latest_specs Gem::Specification._all, prerelease + _latest_specs Gem::Specification.stubs, prerelease end ## diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb index 37fd71edc0..42e0f23505 100644 --- a/lib/rubygems/version.rb +++ b/lib/rubygems/version.rb @@ -149,13 +149,6 @@ # For the last example, single-digit versions are automatically extended with # a zero to give a sensible result. -# Our code style opens classes directly without opening the intermediate -# modules. This works because tha main entrypoint `rubygems.rb`, which defines -# the root `Gem` module, is usually required first. But in this case we want to -# allow using `Gem::Version` without loading the rest of rubygems, so we -# explicit define the `Gem` placeholder module first. -module Gem; end - require_relative "deprecate" class Gem::Version |