Skip to content

Commit d62da8c

Browse files
authored
Finalize RDoc::Options before calling RDoc::RDoc#parse_files (#1274)
Commit 6cf6e16, 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 ruby/net-http#193 + ruby/net-http#194.
1 parent b6a8224 commit d62da8c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/rdoc/rubygems_hook.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ def generate
181181
options = ::RDoc::Options.new
182182
options.default_title = "#{@spec.full_name} Documentation"
183183
options.parse args
184+
options.quiet = !Gem.configuration.really_verbose
185+
options.finish
184186
end
185187

186-
options.quiet = !Gem.configuration.really_verbose
187-
188188
@rdoc = new_rdoc
189189
@rdoc.options = options
190190

test/rdoc/test_rdoc_rubygems_hook.rb

+12-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ def setup
3737
@a.loaded_from = File.join(@tempdir, 'a-2', 'a-2.gemspec')
3838

3939
FileUtils.mkdir_p File.join(@tempdir, 'a-2', 'lib')
40-
FileUtils.touch File.join(@tempdir, 'a-2', 'lib', 'a.rb')
4140
FileUtils.touch File.join(@tempdir, 'a-2', 'README')
41+
File.open(File.join(@tempdir, 'a-2', 'lib', 'a.rb'), 'w') do |f|
42+
f.puts '# comment'
43+
f.puts '# :include: include.txt'
44+
f.puts 'class A; end'
45+
end
46+
File.open(File.join(@tempdir, 'a-2', 'include.txt'), 'w') do |f|
47+
f.puts 'included content'
48+
end
4249

4350
@hook = RDoc::RubyGemsHook.new @a
4451

@@ -112,6 +119,10 @@ def test_generate
112119
assert_equal %w[README lib], rdoc.options.files.sort
113120

114121
assert_equal 'MyTitle', rdoc.store.main
122+
123+
klass = rdoc.store.find_class_named('A')
124+
refute_nil klass
125+
assert_includes klass.comment.text, 'included content'
115126
end
116127

117128
def test_generate_all

0 commit comments

Comments
 (0)