Open
Description
Context
- RDoc uses parser generator
kpeg
for its markdown parser, which readslib/markdown.kpeg
to outputlib/markdown.rb
. - RDoc doesn't commit the generated
.rb
files, but relies on itsgenerate
rake task to generate them. generate
is a prerequisite of thebuild
task, which is part of therelease
task. So files likelib/markdown.rb
will be generated and packaged as part of the gem.
However, if users install RDoc from a git/github source, those generated files will be missing, and thus cause errors.
Reproduction Steps
- Run the command below
$ bundle exec ruby -e 'require "rdoc"; require "rdoc/markdown"; puts RDoc::Markdown'
RDoc::Markdown
- Add
gem "rdoc", github: "ruby/rdoc"
to the Gemfile - Run
bundle install
- Run the same command again, which should now show an error like:
bundle exec ruby -e 'require "rdoc"; require "rdoc/markdown"; puts RDoc::Markdown'
/opt/rubies/3.3.0/lib/ruby/3.3.0/rdoc/markdown.rb:182:in `require': cannot load such file -- /Users/hung-wulo/.gem/ruby/3.3.0/bundler/gems/rdoc-8a68a016b25a/lib/rdoc/markdown (LoadError)
from /opt/rubies/3.3.0/lib/ruby/3.3.0/rdoc/markdown.rb:182:in `<top (required)>'
from -e:1:in `require'
from -e:1:in `<main>'
Possible solutions
- Commit the generated files into the git repository too, and have a way to automatically update them when their grammar files changes.
- Utilize
extconf.rb
to runrake build
, which will be executed every time the gem is installed (PoC). - Rely on other markdown parsers that don't require parser generator?
Metadata
Metadata
Assignees
Labels
No labels