You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix rubygems hook execution when gemspec.rdoc_options contains --ri (#1347)
Probably fixes#1343
`options.finish` is called twice while generating document through
rubygems_hook.
If gemspec has `spec.rdoc_options << '--ri'`, document generation fails.
Looks like this double-finish is introduced in #1274
### Detail of the bug
```ruby
options = ::RDoc::Options.new
options.parse args # if --ri is specified, generator is set to 'ri'
options.finish # @template='ri' and @template_dir=nil is configured here
@rdoc.parse_files options.files
document 'ri', options, @rdoc_dir
document 'darkfish', options, @rdoc_dir # Calls options.setup_generator('darkfish') and options.finish but @template_dir is already configured for 'ri'
```
### Fix
Constraints are:
- Need to call finish only once for each RDoc::Options instance
- `finish` should be called before `rdoc.parse_files(options.files)`
- `finish` should be called after `options.setup_generator`
- It is better to call `rdoc.parse_files` only once
We need to use a different RDoc::Options object for parse_files phase
and document generation phase.
0 commit comments