diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-05-02 19:42:57 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2022-05-18 10:02:42 +0900 |
| commit | 2e291e3ffdea1cba747119ff58cf253f4c4a87c8 (patch) | |
| tree | ac8024cb8e7d92295c259ef4cecf1e5ccc09ea94 /lib/rubygems/specification.rb | |
| parent | 8ba584ff3c085251865c11c5d7deef0ddfc6d0ff (diff) | |
Merge RubyGems-3.3.12 and Bundler-2.3.12
Diffstat (limited to 'lib/rubygems/specification.rb')
| -rw-r--r-- | lib/rubygems/specification.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 0d72cee51d..7e7599f7db 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -657,6 +657,8 @@ class Gem::Specification < Gem::BasicSpecification @rdoc_options ||= [] end + LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1") + ## # The version of Ruby required by this gem. The ruby version can be # specified to the patch-level: @@ -683,6 +685,14 @@ class Gem::Specification < Gem::BasicSpecification def required_ruby_version=(req) @required_ruby_version = Gem::Requirement.create req + + @required_ruby_version.requirements.map! do |op, v| + if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4 + [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))] + else + [op, v] + end + end end ## |
