File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 12
12
Gem ::GemDirsVerification . verify ( Gem . path )
13
13
Gem ::GemDirsVerification . install_hook
14
14
15
- # Because did_you_mean was required directly without RubyGems.
16
- # did_you_mean is only required if --disable-gems was not passed.
15
+ # We register did_you_mean only here because it was required directly
16
+ # without RubyGems in post-boot.rb.
17
+
18
+ # did_you_mean is only registered as a gem if --disable-gems was not passed, as
19
+ # --disable-gems implies --disable-did-you-mean on MRI, i.e.,
20
+ # MRI raises NameError for `ruby --disable-gems -e DidYouMean.formatter`.
17
21
if Truffle ::Boot . get_option 'did_you_mean' and Truffle ::Boot . get_option 'rubygems'
18
22
begin
19
23
gem 'did_you_mean'
20
24
rescue LoadError
21
25
# Ignore, this happens when GEM_HOME and GEM_PATH are set and do not include
22
- # the default gem home. In such a case, did_you_mean was loaded already, but
23
- # it is no longer possible to register the Gem with RubyGems. This happens
24
- # for instance with 'bundle exec' after `bundle install --deployment`.
26
+ # the default gem home. In such a case, despite did_you_mean having been
27
+ # loaded already during post-boot.rb, it is no longer possible to register
28
+ # the gem with RubyGems. This happens for instance with 'bundle exec' after
29
+ # `bundle install --deployment`.
25
30
nil
26
31
end
27
32
end
Original file line number Diff line number Diff line change 51
51
Truffle ::Debug . log_warning "#{ File . basename ( __FILE__ ) } :#{ __LINE__ } #{ e . message } "
52
52
else
53
53
if Truffle ::Boot . get_option 'did_you_mean'
54
+ # Load DidYouMean here manually, to avoid loading RubyGems eagerly
54
55
Truffle ::Boot . print_time_metric :'before-did-you-mean'
55
56
begin
56
57
$LOAD_PATH << "#{ Truffle ::Boot . ruby_home } /lib/ruby/gems/#{ Truffle ::RUBY_BASE_VERSION } /gems/did_you_mean-1.1.0/lib"
You can’t perform that action at this time.
0 commit comments