Skip to content

Commit 3f14bc2

Browse files
hsbtclaude
andcommitted
Explicitly require did_you_mean in Bundler::CLI::Common#gem_not_found_message
Since error enhancer gems are now lazy-loaded, did_you_mean is not available until the first exception display. Bundler uses DidYouMean::SpellChecker directly, so it needs to require the gem explicitly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 31398b3 commit 3f14bc2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/bundler/cli/common.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def self.gem_not_found_message(missing_gem_name, alternatives)
9898
alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
9999
if alternate_names.include?(missing_gem_name.downcase)
100100
message += "\nDid you mean '#{missing_gem_name.downcase}'?"
101-
elsif defined?(DidYouMean::SpellChecker)
101+
else
102+
require "did_you_mean"
102103
suggestions = DidYouMean::SpellChecker.new(dictionary: alternate_names).correct(missing_gem_name)
103104
message += "\nDid you mean #{word_list(suggestions)}?" unless suggestions.empty?
104105
end

0 commit comments

Comments
 (0)