aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-01-30 18:10:56 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-01-31 10:49:08 +0900
commit4cbfd87e5a8464db42657ee0019f9bd78c15c05c (patch)
treede7ad31c04756b2bbf51ec2895522a9d6f522a87 /lib/rubygems.rb
parent022acb9593c09a9e358215a80448b426ee366ac0 (diff)
downloadruby-4cbfd87e5a8464db42657ee0019f9bd78c15c05c.tar.gz
[rubygems/rubygems] Allow disabling RubyGems require decorations
Currently Bundler needs to do cumbersome operations to revert custom RubyGems require on a `bundler/setup` context. This causes issues when third party gems also monkeypatch require, since Bundler will also undo those decorations. This commit allows it to use the simpler approach of properly telling RubyGems that it needs to default to built-in require without any extra magic. https://github.com/rubygems/rubygems/commit/1df5009e14 Co-authored-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 102597b0f5..6631cd8481 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -181,6 +181,8 @@ module Gem
@default_source_date_epoch = nil
+ @discover_gems_on_require = true
+
##
# Try to activate a gem containing +path+. Returns true if
# activation succeeded or wasn't needed because it was already
@@ -1162,9 +1164,17 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
# RubyGems distributors (like operating system package managers) can
# disable RubyGems update by setting this to error message printed to
# end-users on gem update --system instead of actual update.
+
attr_accessor :disable_system_update_message
##
+ # Whether RubyGems should enhance builtin `require` to automatically
+ # check whether the path required is present in installed gems, and
+ # automatically activate them and add them to `$LOAD_PATH`.
+
+ attr_accessor :discover_gems_on_require
+
+ ##
# Hash of loaded Gem::Specification keyed by name
attr_reader :loaded_specs