|
13 | 13 | # `Gem::Source` from the redefined `Gem::Specification#source`. |
14 | 14 | require "rubygems/source" |
15 | 15 |
|
16 | | -# Cherry-pick fixes to `Gem.ruby_version` to be useful for modern Bundler |
17 | | -# versions and ignore patchlevels |
18 | | -# (https://github.com/rubygems/rubygems/pull/5472, |
19 | | -# https://github.com/rubygems/rubygems/pull/5486). May be removed once RubyGems |
20 | | -# 3.3.12 support is dropped. |
21 | | -unless Gem.ruby_version.to_s == RUBY_VERSION || RUBY_PATCHLEVEL == -1 |
22 | | - Gem.instance_variable_set(:@ruby_version, Gem::Version.new(RUBY_VERSION)) |
23 | | -end |
24 | | - |
25 | 16 | module Gem |
26 | 17 | # Can be removed once RubyGems 3.5.11 support is dropped |
27 | 18 | unless Gem.respond_to?(:freebsd_platform?) |
@@ -92,21 +83,10 @@ def ===(other) |
92 | 83 | # version |
93 | 84 | ( |
94 | 85 | (@os != "linux" && (@version.nil? || other.version.nil?)) || |
95 | | - (@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) || |
| 86 | + (@os == "linux" && (normalized_linux_version == other.normalized_linux_version || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) || |
96 | 87 | @version == other.version |
97 | 88 | ) |
98 | 89 | end |
99 | | - |
100 | | - # This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`. |
101 | | - # Once only 3.3.23 is supported, we can use the method in RubyGems. |
102 | | - def normalized_linux_version_ext |
103 | | - return nil unless @version |
104 | | - |
105 | | - without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "") |
106 | | - return nil if without_gnu_nor_abi_modifiers.empty? |
107 | | - |
108 | | - without_gnu_nor_abi_modifiers |
109 | | - end |
110 | 90 | end |
111 | 91 | end |
112 | 92 |
|
@@ -144,9 +124,6 @@ def match_platforms?(platform, platforms) |
144 | 124 | # Can be removed once RubyGems 3.5.14 support is dropped |
145 | 125 | VALIDATES_FOR_RESOLUTION = Specification.new.respond_to?(:validate_for_resolution).freeze |
146 | 126 |
|
147 | | - # Can be removed once RubyGems 3.3.15 support is dropped |
148 | | - FLATTENS_REQUIRED_PATHS = Specification.new.respond_to?(:flatten_require_paths).freeze |
149 | | - |
150 | 127 | class Specification |
151 | 128 | # Can be removed once RubyGems 3.5.15 support is dropped |
152 | 129 | correct_array_attributes = @@default_value.select {|_k,v| v.is_a?(Array) }.keys |
@@ -272,27 +249,6 @@ def validate_for_resolution |
272 | 249 | end |
273 | 250 | end |
274 | 251 |
|
275 | | - unless FLATTENS_REQUIRED_PATHS |
276 | | - def flatten_require_paths |
277 | | - return unless raw_require_paths.first.is_a?(Array) |
278 | | - |
279 | | - 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" |
280 | | - raw_require_paths.flatten! |
281 | | - end |
282 | | - |
283 | | - class << self |
284 | | - module RequirePathFlattener |
285 | | - def from_yaml(input) |
286 | | - spec = super(input) |
287 | | - spec.flatten_require_paths |
288 | | - spec |
289 | | - end |
290 | | - end |
291 | | - |
292 | | - prepend RequirePathFlattener |
293 | | - end |
294 | | - end |
295 | | - |
296 | 252 | private |
297 | 253 |
|
298 | 254 | def dependencies_to_gemfile(dependencies, group = nil) |
@@ -471,15 +427,4 @@ def full_name |
471 | 427 |
|
472 | 428 | Package::TarReader::Entry.prepend(FixFullNameEncoding) |
473 | 429 | end |
474 | | - |
475 | | - require "rubygems/uri" |
476 | | - |
477 | | - # Can be removed once RubyGems 3.3.15 support is dropped |
478 | | - unless Gem::Uri.respond_to?(:redact) |
479 | | - class Uri |
480 | | - def self.redact(uri) |
481 | | - new(uri).redacted |
482 | | - end |
483 | | - end |
484 | | - end |
485 | 430 | end |
0 commit comments