Skip to content

RDoc doesn't have complete files when being installed from git/github source #1107

Open
@st0012

Description

@st0012

Context

  • RDoc uses parser generator kpeg for its markdown parser, which reads lib/markdown.kpeg to output lib/markdown.rb.
  • RDoc doesn't commit the generated .rb files, but relies on its generate rake task to generate them.
  • generate is a prerequisite of the build task, which is part of the release task. So files like lib/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

  1. Run the command below
$ bundle exec ruby -e 'require "rdoc"; require "rdoc/markdown"; puts RDoc::Markdown'
RDoc::Markdown
  1. Add gem "rdoc", github: "ruby/rdoc" to the Gemfile
  2. Run bundle install
  3. 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 run rake 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions