Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize RDoc::Options before calling RDoc::RDoc#parse_files #1274

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rdoc/rubygems_hook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ def generate
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

Expand Down
13 changes: 12 additions & 1 deletion test/rdoc/test_rdoc_rubygems_hook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ def setup
@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

Expand Down Expand Up @@ -112,6 +119,10 @@ def test_generate
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
Expand Down
Loading