[rubygems/rubygems] Avoid standard requires while loading shared helpers

We should make sure Bundler does not trigger RubyGems require logic for
gem activation until it had the chance to register its own monkeypatches
to RubyGems.

https://github.com/rubygems/rubygems/commit/fbd2ff86b9
This commit is contained in:
David Rodriguez 2024-05-10 16:14:26 +02:00 коммит произвёл git
Родитель e926298343
Коммит 69c87619bd
3 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "rbconfig"
module Bundler
WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
FREEBSD = RbConfig::CONFIG["host_os"].to_s.include?("bsd")

Просмотреть файл

@ -4,9 +4,7 @@ require "rubygems" unless defined?(Gem)
module Bundler
class RubygemsIntegration
require "monitor"
EXT_LOCK = Monitor.new
autoload :Monitor, "monitor"
def initialize
@replaced_methods = {}
@ -173,7 +171,7 @@ module Bundler
end
def ext_lock
EXT_LOCK
@ext_lock ||= Monitor.new
end
def spec_from_gem(path)

Просмотреть файл

@ -1,15 +1,17 @@
# frozen_string_literal: true
require "pathname"
require "rbconfig"
require_relative "version"
require_relative "constants"
require_relative "rubygems_integration"
require_relative "current_ruby"
module Bundler
autoload :WINDOWS, File.expand_path("constants", __dir__)
autoload :FREEBSD, File.expand_path("constants", __dir__)
autoload :NULL, File.expand_path("constants", __dir__)
module SharedHelpers
autoload :Pathname, "pathname"
def root
gemfile = find_gemfile
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile