rdoc icon indicating copy to clipboard operation
rdoc copied to clipboard

Allow installing RDoc from a git source

Open st0012 opened this issue 1 year ago • 4 comments

This implements option 2 in #1107, which is to use extconf.rb to conditionally run rake generate when the gem is installed as a git source.

To make sure the target machine has the required dependencies for the generation, I modified rake generate to conditionally install the kpeg and racc.

st0012 avatar May 29 '24 18:05 st0012

@nobu Thanks for the suggestions 👍

st0012 avatar Jun 01 '24 11:06 st0012

@nobu Would you mind giving this another look? If you're not against it, I'd like to give it a try.

st0012 avatar Jun 25 '24 15:06 st0012

This does not work, at least when I tested it.

The problem is, extconf.rb is executed from the root directory, so the relative path (computed from Dir.pwd is wrong):

The fix is:

git_path = File.expand_path("../../.git", __dir__)
if File.exist?(git_path)
	system("rake generate")
end

At least that gets us to the next issue:

> ruby ./ext/rdoc/extconf.rb
Generating lib/rdoc/markdown.rb...
rake aborted!
Gem::GemNotFoundException: can't find gem kpeg (>= 0) with executable kpeg (Gem::GemNotFoundException)
/home/samuel/.gem/ruby/3.4.1/bundler/gems/rdoc-c75f094920b3/Rakefile:80:in 'block (2 levels) in <top (required)>'
Tasks: TOP => generate => lib/rdoc/markdown.rb
(See full trace by running task with --trace)
creating Makefile

ioquatix avatar Mar 21 '25 19:03 ioquatix

Would it be crazy to do this:

# rdoc.gemspec

  if ENV["RDOC_FROM_SOURCE"] # or something better???
    gem "kpeg"
    ...

ioquatix avatar Mar 21 '25 20:03 ioquatix