diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2025-07-11 00:05:49 +0200 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-07-14 11:52:14 +0900 |
| commit | a93c684077fe713bc4ff6a58cf851137bd9bed52 (patch) | |
| tree | a3542c9c2ed005fdd31ee676854127bd2e5fe76a | |
| parent | 1c48aa6f4a52e60fa46f838b5810556defb2604a (diff) | |
[rubygems/rubygems] Change helper to load only Bundler extensions to RubyGems
We'll want to reuse this helper in other situations where we don't want
all Bundler loaded.
https://github.com/rubygems/rubygems/commit/9e7018b0a1
| -rw-r--r-- | lib/rubygems.rb | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index f291355cff..87651eaeb3 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -637,30 +637,27 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} end ## - # Load Bundler, making sure to avoid redefinition warnings in platform - # constants + # Load Bundler extensions to RubyGems, making sure to avoid redefinition + # warnings in platform constants - def self.load_bundler + def self.load_bundler_extensions require "bundler/version" + return if Bundler::VERSION >= "2.6.9" - if Bundler::VERSION > "2.6.9" - require "bundler" - else - previous_platforms = {} + previous_platforms = {} - platform_const_list = ["JAVA", "MSWIN", "MSWIN64", "MINGW", "X64_MINGW_LEGACY", "X64_MINGW", "UNIVERSAL_MINGW", "WINDOWS", "X64_LINUX", "X64_LINUX_MUSL"] + platform_const_list = ["JAVA", "MSWIN", "MSWIN64", "MINGW", "X64_MINGW_LEGACY", "X64_MINGW", "UNIVERSAL_MINGW", "WINDOWS", "X64_LINUX", "X64_LINUX_MUSL"] - platform_const_list.each do |platform| - previous_platforms[platform] = Gem::Platform.const_get(platform) - Gem::Platform.send(:remove_const, platform) - end + platform_const_list.each do |platform| + previous_platforms[platform] = Gem::Platform.const_get(platform) + Gem::Platform.send(:remove_const, platform) + end - require "bundler" + require "bundler/rubygems_ext" - platform_const_list.each do |platform| - Gem::Platform.send(:remove_const, platform) if Gem::Platform.const_defined?(platform) - Gem::Platform.const_set(platform, previous_platforms[platform]) - end + platform_const_list.each do |platform| + Gem::Platform.send(:remove_const, platform) if Gem::Platform.const_defined?(platform) + Gem::Platform.const_set(platform, previous_platforms[platform]) end end @@ -1172,7 +1169,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path) require_relative "rubygems/user_interaction" - Gem.load_bundler + Gem.load_bundler_extensions + require "bundler" begin Gem::DefaultUserInteraction.use_ui(ui) do Bundler.ui.silence do |
