Merge RubyGems-3.3.16 and Bundler-2.3.16

This commit is contained in:
Hiroshi SHIBATA 2022-07-13 14:44:32 +09:00 committed by nagachika
parent b9f6a09bd2
commit a01f5ad1ec
66 changed files with 808 additions and 562 deletions

View file

@ -157,7 +157,7 @@ class Gem::Specification < Gem::BasicSpecification
}.freeze
# rubocop:disable Style/MutableConstant
INITIALIZE_CODE_FOR_DEFAULTS = { } # :nodoc:
INITIALIZE_CODE_FOR_DEFAULTS = {} # :nodoc:
# rubocop:enable Style/MutableConstant
@@default_value.each do |k,v|
@ -1082,6 +1082,7 @@ class Gem::Specification < Gem::BasicSpecification
spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
spec.reset_nil_attributes_to_default
spec.flatten_require_paths
spec
end
@ -1273,10 +1274,26 @@ class Gem::Specification < Gem::BasicSpecification
array = begin
Marshal.load str
rescue ArgumentError => e
raise unless e.message.include?("YAML")
#
# Some very old marshaled specs included references to `YAML::PrivateType`
# and `YAML::Syck::DefaultKey` constants due to bugs in the old emitter
# that generated them. Workaround the issue by defining the necessary
# constants and retrying.
#
message = e.message
raise unless message.include?("YAML::")
Object.const_set "YAML", Psych
Marshal.load str
Object.const_set "YAML", Psych unless Object.const_defined?(:YAML)
if message.include?("YAML::Syck::")
YAML.const_set "Syck", YAML unless YAML.const_defined?(:Syck)
YAML::Syck.const_set "DefaultKey", Class.new if message.include?("YAML::Syck::DefaultKey")
elsif message.include?("YAML::PrivateType")
YAML.const_set "PrivateType", Class.new
end
retry
end
spec = Gem::Specification.new
@ -2676,6 +2693,13 @@ class Gem::Specification < Gem::BasicSpecification
@installed_by_version ||= nil
end
def flatten_require_paths # :nodoc:
return unless raw_require_paths.first.is_a?(Array)
warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
raw_require_paths.flatten!
end
def raw_require_paths # :nodoc:
@require_paths
end