Drop dead rdoc/markdown handling from rubygems plugin#1700
Merged
st0012 merged 2 commits intoruby:masterfrom May 7, 2026
Merged
Drop dead rdoc/markdown handling from rubygems plugin#1700st0012 merged 2 commits intoruby:masterfrom
st0012 merged 2 commits intoruby:masterfrom
Conversation
lib/rdoc/markdown.rb is now generated and committed, so the LoadError-handling workaround that delayed hook registration when markdown.rb was absent during rdoc's own `bundle install` is no longer needed. Require markdown unconditionally and register the hooks at top level. https://claude.ai/code/session_01UJr3jZWKpHhtJvdvmSSzzB
The require existed only to gate hook registration via `rescue LoadError` (the previous commit's bootstrap workaround). Once that gate is gone, requiring rdoc/markdown at plugin-load time is dead weight — RDoc::RubyGemsHook never references RDoc::Markdown directly, and any markdown sources actually encountered during doc generation are loaded lazily by the parser dispatcher. https://claude.ai/code/session_01UJr3jZWKpHhtJvdvmSSzzB
There was a problem hiding this comment.
Pull request overview
This PR removes a now-unnecessary begin/rescue LoadError guard and the eager require_relative 'rdoc/markdown' from the RubyGems plugin, since lib/rdoc/markdown.rb is present in-repo and Markdown parsing is loaded lazily when actually needed. This reduces RubyGems startup overhead by avoiding loading the large kpeg-generated Markdown parser during gem/Bundler operations.
Changes:
- Drop the guarded
require_relative 'rdoc/markdown'fromlib/rubygems_plugin.rb. - Register
Gem.done_installingandGem.pre_uninstallhooks unconditionally.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
In the next PR, I will move require into the hooks so we can partially mitigate #1609 and also speed things up |
Collaborator
|
🚀 Preview deployment available at: https://b33421c8.rdoc-6cd.pages.dev (commit: 4ae08f2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lib/rubygems_plugin.rbcarries abegin / rescue LoadError / elseblock aroundrequire_relative 'rdoc/markdown', gating hook registration on the require succeeding. The accompanying comment explains the guard exists becausemarkdown.rbused to be kpeg-generated duringbundle installand could be absent mid-bootstrap.That window no longer exists.
lib/rdoc/markdown.rbis generated and committed, andRDoc::RubyGemsHookdoesn't referenceRDoc::Markdownitself — any markdown source actually encountered during doc generation is loaded lazily by the parser dispatcher. So both the guard and the require it gated are dead code.This drops both, and as a side effect skips parsing ~16k LOC of kpeg-generated parser on every
gemCLI invocation and everybundle installresolution path.