Skip to content

Document why rubygems.rb requires BUNDLER_SETUP at the end - #9769

Merged
hsbt merged 1 commit into
masterfrom
claude/bundler-setup-comment
Aug 6, 2026
Merged

Document why rubygems.rb requires BUNDLER_SETUP at the end#9769
hsbt merged 1 commit into
masterfrom
claude/bundler-setup-comment

Conversation

@hsbt

@hsbt hsbt commented Aug 6, 2026

Copy link
Copy Markdown
Member

The require ENV["BUNDLER_SETUP"] at the bottom of lib/rubygems.rb carries no explanation, so it looks removable. It makes bundler/setup run before error_highlight, did_you_mean and syntax_suggest load, which is what lets the Gemfile pin their versions ([Bug #19089]).

Ruby 4.1 autoloads those three ([Feature #21951]) and unsets BUNDLER_SETUP while loading RubyGems, so the line is dead there. It is still live on 3.2 through 4.0, which required_ruby_version still supports. Dropping it on 3.4 reproduces You have already activated error_highlight 0.7.2, but your Gemfile requires 0.7.0. The comment records the condition for removing it later.

Comment only, no behavior change.

The require makes bundler/setup run before error_highlight, did_you_mean
and syntax_suggest are loaded, so the Gemfile controls their versions
([Bug #19089]). Ruby 4.1 autoloads them and unsets the variable while
loading RubyGems, but rubygems-update still supports 3.2, so record the
condition for dropping the line instead of dropping it now.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hsbt
hsbt enabled auto-merge August 6, 2026 09:00
@hsbt
hsbt merged commit 2361605 into master Aug 6, 2026
107 checks passed
@hsbt
hsbt deleted the claude/bundler-setup-comment branch August 6, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant