From 0b2f034208a1131900257a7923a71bf4e3b56a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 17 Dec 2024 16:28:08 +0100 Subject: [PATCH] [rubygems/rubygems] Fix missing `Gem::Uri.redact` on some Ruby 3.1 versions Our CI did not catch this because it was testing with Ruby 3.1 patch levels that include a RubyGems version that already has `Gem::Uri.redact`. We should make sure the system-rubygems workflow always tests against the oldest supportted Ruby/RubyGems combination. https://github.com/rubygems/rubygems/commit/3b695e3be1 --- lib/bundler/rubygems_ext.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 66976534854832..bc7f65c7f7eb26 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -455,4 +455,15 @@ def full_name Package::TarReader::Entry.prepend(FixFullNameEncoding) end + + require "rubygems/uri" + + # Can be removed once RubyGems 3.3.15 support is dropped + unless Gem::Uri.respond_to?(:redact) + class Uri + def self.redact(uri) + new(uri).redacted + end + end + end end