mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 11:33:58 +02:00
Merge pull request #5482 from hsbt/rubygems-3-3-bundler-2-3
Merge RubyGems 3.3.x and Bundler 2.3.x
This commit is contained in:
parent
69463805f0
commit
6794f8cf92
115 changed files with 1701 additions and 889 deletions
|
@ -11,7 +11,6 @@ require_relative 'basic_specification'
|
|||
require_relative 'stub_specification'
|
||||
require_relative 'platform'
|
||||
require_relative 'requirement'
|
||||
require_relative 'specification_policy'
|
||||
require_relative 'util/list'
|
||||
|
||||
##
|
||||
|
@ -163,15 +162,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
|
||||
@@default_value.each do |k,v|
|
||||
INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
|
||||
when [], {}, true, false, nil, Numeric, Symbol
|
||||
v.inspect
|
||||
when String
|
||||
v.dump
|
||||
when Numeric
|
||||
"default_value(:#{k})"
|
||||
else
|
||||
"default_value(:#{k}).dup"
|
||||
end
|
||||
when [], {}, true, false, nil, Numeric, Symbol
|
||||
v.inspect
|
||||
when String
|
||||
v.dump
|
||||
when Numeric
|
||||
"default_value(:#{k})"
|
||||
else
|
||||
"default_value(:#{k}).dup"
|
||||
end
|
||||
end
|
||||
|
||||
@@attributes = @@default_value.keys.sort_by {|s| s.to_s }
|
||||
|
@ -226,7 +225,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
attr_reader :version
|
||||
|
||||
##
|
||||
# A short summary of this gem's description. Displayed in `gem list -d`.
|
||||
# A short summary of this gem's description. Displayed in <tt>gem list -d</tt>.
|
||||
#
|
||||
# The #description should be more detailed than the summary.
|
||||
#
|
||||
|
@ -272,7 +271,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
# A list of authors for this gem.
|
||||
#
|
||||
# Alternatively, a single author can be specified by assigning a string to
|
||||
# `spec.author`
|
||||
# +spec.author+
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
|
@ -1116,7 +1115,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
file = file.dup.tap(&Gem::UNTAINT)
|
||||
return unless File.file?(file)
|
||||
|
||||
code = Gem.open_with_flock(file, 'r:UTF-8:-', &:read)
|
||||
code = Gem.open_file(file, 'r:UTF-8:-', &:read)
|
||||
|
||||
code.tap(&Gem::UNTAINT)
|
||||
|
||||
|
@ -1269,21 +1268,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
current_version = CURRENT_SPECIFICATION_VERSION
|
||||
|
||||
field_count = if spec.specification_version > current_version
|
||||
spec.instance_variable_set :@specification_version,
|
||||
current_version
|
||||
MARSHAL_FIELDS[current_version]
|
||||
else
|
||||
MARSHAL_FIELDS[spec.specification_version]
|
||||
end
|
||||
spec.instance_variable_set :@specification_version,
|
||||
current_version
|
||||
MARSHAL_FIELDS[current_version]
|
||||
else
|
||||
MARSHAL_FIELDS[spec.specification_version]
|
||||
end
|
||||
|
||||
if array.size < field_count
|
||||
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
|
||||
end
|
||||
|
||||
# Cleanup any YAML::PrivateType. They only show up for an old bug
|
||||
# Cleanup any Psych::PrivateType. They only show up for an old bug
|
||||
# where nil => null, so just convert them to nil based on the type.
|
||||
|
||||
array.map! {|e| e.kind_of?(YAML::PrivateType) ? nil : e }
|
||||
array.map! {|e| e.kind_of?(Psych::PrivateType) ? nil : e }
|
||||
|
||||
spec.instance_variable_set :@rubygems_version, array[0]
|
||||
# spec version
|
||||
|
@ -1474,10 +1473,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
|
||||
def add_dependency_with_type(dependency, type, requirements)
|
||||
requirements = if requirements.empty?
|
||||
Gem::Requirement.default
|
||||
else
|
||||
requirements.flatten
|
||||
end
|
||||
Gem::Requirement.default
|
||||
else
|
||||
requirements.flatten
|
||||
end
|
||||
|
||||
unless dependency.respond_to?(:name) &&
|
||||
dependency.respond_to?(:requirement)
|
||||
|
@ -1685,18 +1684,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
# This is the cleanest, most-readable, faster-than-using-Date
|
||||
# way to do it.
|
||||
@date = case date
|
||||
when String then
|
||||
if DateTimeFormat =~ date
|
||||
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
||||
else
|
||||
raise(Gem::InvalidSpecificationException,
|
||||
"invalid date format in specification: #{date.inspect}")
|
||||
end
|
||||
when Time, DateLike then
|
||||
Time.utc(date.year, date.month, date.day)
|
||||
else
|
||||
TODAY
|
||||
end
|
||||
when String then
|
||||
if DateTimeFormat =~ date
|
||||
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
||||
else
|
||||
raise(Gem::InvalidSpecificationException,
|
||||
"invalid date format in specification: #{date.inspect}")
|
||||
end
|
||||
when Time, DateLike then
|
||||
Time.utc(date.year, date.month, date.day)
|
||||
else
|
||||
TODAY
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -1802,13 +1801,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
coder.add 'name', @name
|
||||
coder.add 'version', @version
|
||||
platform = case @original_platform
|
||||
when nil, '' then
|
||||
'ruby'
|
||||
when String then
|
||||
@original_platform
|
||||
else
|
||||
@original_platform.to_s
|
||||
end
|
||||
when nil, '' then
|
||||
'ruby'
|
||||
when String then
|
||||
@original_platform
|
||||
else
|
||||
@original_platform.to_s
|
||||
end
|
||||
coder.add 'platform', platform
|
||||
|
||||
attributes = @@attributes.map(&:to_s) - %w[name version platform]
|
||||
|
@ -2025,10 +2024,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
def base_dir
|
||||
return Gem.dir unless loaded_from
|
||||
@base_dir ||= if default_gem?
|
||||
File.dirname File.dirname File.dirname loaded_from
|
||||
else
|
||||
File.dirname File.dirname loaded_from
|
||||
end
|
||||
File.dirname File.dirname File.dirname loaded_from
|
||||
else
|
||||
File.dirname File.dirname loaded_from
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -2655,9 +2654,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|||
default = self.default_value attribute
|
||||
|
||||
value = case default
|
||||
when Time, Numeric, Symbol, true, false, nil then default
|
||||
else default.dup
|
||||
end
|
||||
when Time, Numeric, Symbol, true, false, nil then default
|
||||
else default.dup
|
||||
end
|
||||
|
||||
instance_variable_set "@#{attribute}", value
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue