[ruby/rdoc] Finalize RDoc::Options before calling
RDoc::RDoc#parse_files (https://github.com/ruby/rdoc/pull/1274) Commit https://github.com/ruby/rdoc/commit/6cf6e1647b97, which went to v6.5.0, changed `RDoc::Options#parse` to not call `#finish` in it. While the commit adjusted other call sites, it missed `lib/rdoc/rubygems_hook.rb`. `RDoc::Options#finish` prepares the include paths for `:include:` directives. This has to be done before starting to parse sources. I think this should fix https://github.com/ruby/net-http/issues/193 + https://github.com/ruby/net-http/pull/194. https://github.com/ruby/rdoc/commit/d62da8ca09
This commit is contained in:
parent
62a1528020
commit
e728170043
@ -181,10 +181,10 @@ class RDoc::RubyGemsHook
|
||||
options = ::RDoc::Options.new
|
||||
options.default_title = "#{@spec.full_name} Documentation"
|
||||
options.parse args
|
||||
options.quiet = !Gem.configuration.really_verbose
|
||||
options.finish
|
||||
end
|
||||
|
||||
options.quiet = !Gem.configuration.really_verbose
|
||||
|
||||
@rdoc = new_rdoc
|
||||
@rdoc.options = options
|
||||
|
||||
|
@ -37,8 +37,15 @@ class TestRDocRubyGemsHook < Test::Unit::TestCase
|
||||
@a.loaded_from = File.join(@tempdir, 'a-2', 'a-2.gemspec')
|
||||
|
||||
FileUtils.mkdir_p File.join(@tempdir, 'a-2', 'lib')
|
||||
FileUtils.touch File.join(@tempdir, 'a-2', 'lib', 'a.rb')
|
||||
FileUtils.touch File.join(@tempdir, 'a-2', 'README')
|
||||
File.open(File.join(@tempdir, 'a-2', 'lib', 'a.rb'), 'w') do |f|
|
||||
f.puts '# comment'
|
||||
f.puts '# :include: include.txt'
|
||||
f.puts 'class A; end'
|
||||
end
|
||||
File.open(File.join(@tempdir, 'a-2', 'include.txt'), 'w') do |f|
|
||||
f.puts 'included content'
|
||||
end
|
||||
|
||||
@hook = RDoc::RubyGemsHook.new @a
|
||||
|
||||
@ -112,6 +119,10 @@ class TestRDocRubyGemsHook < Test::Unit::TestCase
|
||||
assert_equal %w[README lib], rdoc.options.files.sort
|
||||
|
||||
assert_equal 'MyTitle', rdoc.store.main
|
||||
|
||||
klass = rdoc.store.find_class_named('A')
|
||||
refute_nil klass
|
||||
assert_includes klass.comment.text, 'included content'
|
||||
end
|
||||
|
||||
def test_generate_all
|
||||
|
Loading…
x
Reference in New Issue
Block a user