Skip to content

Commit c9ba3d0

Browse files
segiddinshsbt
authored andcommitted
[rubygems/rubygems] Bump required_ruby_version to 3.2
Ruby 3.1 was EOL March 2025 Signed-off-by: Samuel Giddins <[email protected]> ruby/rubygems@29c21b1e78
1 parent d565d80 commit c9ba3d0

File tree

5 files changed

+6
-68
lines changed

5 files changed

+6
-68
lines changed

lib/bundler/bundler.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ Gem::Specification.new do |s|
2929
"source_code_uri" => "https://github.com/rubygems/rubygems/tree/master/bundler",
3030
}
3131

32-
s.required_ruby_version = ">= 3.1.0"
32+
s.required_ruby_version = ">= 3.2.0"
3333

3434
# It should match the RubyGems version shipped with `required_ruby_version` above
35-
s.required_rubygems_version = ">= 3.3.3"
35+
s.required_rubygems_version = ">= 3.4.1"
3636

3737
s.files = Dir.glob("lib/bundler{.rb,/**/*}", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
3838

lib/bundler/cli/gem.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def rust_builder_required_rubygems_version
446446
end
447447

448448
def required_ruby_version
449-
"3.1.0"
449+
"3.2.0"
450450
end
451451

452452
def rubocop_version
@@ -456,12 +456,5 @@ def rubocop_version
456456
def standard_version
457457
"1.3"
458458
end
459-
460-
def validate_rust_builder_rubygems_version
461-
if Gem::Version.new(rust_builder_required_rubygems_version) > Gem.rubygems_version
462-
Bundler.ui.error "Your RubyGems version (#{Gem.rubygems_version}) is too old to build Rust extension. Please update your RubyGems using `gem update --system` or any other way and try again."
463-
exit 1
464-
end
465-
end
466459
end
467460
end

lib/bundler/rubygems_ext.rb

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
# `Gem::Source` from the redefined `Gem::Specification#source`.
1414
require "rubygems/source"
1515

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-
2516
module Gem
2617
# Can be removed once RubyGems 3.5.11 support is dropped
2718
unless Gem.respond_to?(:freebsd_platform?)
@@ -92,21 +83,10 @@ def ===(other)
9283
# version
9384
(
9485
(@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))) ||
9687
@version == other.version
9788
)
9889
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
11090
end
11191
end
11292

@@ -144,9 +124,6 @@ def match_platforms?(platform, platforms)
144124
# Can be removed once RubyGems 3.5.14 support is dropped
145125
VALIDATES_FOR_RESOLUTION = Specification.new.respond_to?(:validate_for_resolution).freeze
146126

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-
150127
class Specification
151128
# Can be removed once RubyGems 3.5.15 support is dropped
152129
correct_array_attributes = @@default_value.select {|_k,v| v.is_a?(Array) }.keys
@@ -272,27 +249,6 @@ def validate_for_resolution
272249
end
273250
end
274251

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-
296252
private
297253

298254
def dependencies_to_gemfile(dependencies, group = nil)
@@ -471,15 +427,4 @@ def full_name
471427

472428
Package::TarReader::Entry.prepend(FixFullNameEncoding)
473429
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
485430
end

spec/bundler/bundler/specifications/foo.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Gem::Specification.new do |s|
88
s.version = "1.0.0"
99
s.loaded_from = __FILE__
1010
s.extensions = "ext/foo"
11-
s.required_ruby_version = ">= 3.1.0"
11+
s.required_ruby_version = ">= 3.2.0"
1212
end
1313
# rubocop:enable Style/FrozenStringLiteralComment

spec/bundler/support/rubygems_ext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
abort "RubyGems only supports Ruby 3.1 or higher" if RUBY_VERSION < "3.1.0"
3+
abort "RubyGems only supports Ruby 3.2 or higher" if RUBY_VERSION < "3.2.0"
44

55
require_relative "path"
66

0 commit comments

Comments
 (0)