Skip to content

Commit

Permalink
Add attribute :force to RDoc::RubygemsHook just like RDoc::RubyGemsHook
Browse files Browse the repository at this point in the history
Rubygems creates an instance of RDoc::RubygemsHook, sets `doc.force = overwrite`, then calls `doc.generate` the document.
RDoc::RubygemsHook needs attribute `:force` just like RDoc::RubyGemsHook.
  • Loading branch information
tompng committed Dec 15, 2024
1 parent c6193bf commit 08aec15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/rdoc/rubygems_hook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def setup
module RDoc
class RubygemsHook

attr_accessor :generate_rdoc, :generate_ri
attr_accessor :generate_rdoc, :generate_ri, :force

def self.default_gem?
!File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
Expand All @@ -281,14 +281,17 @@ def initialize(spec, generate_rdoc = false, generate_ri = true)
@spec = spec
@generate_rdoc = generate_rdoc
@generate_ri = generate_ri
@force = false
end

def generate
# Do nothing if this is NOT a default gem.
return unless self.class.default_gem?

# Generate document for compatibility if this is a default gem.
RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri).generate
hook = RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri)
hook.force = @force
hook.generate
end

def remove
Expand Down

0 comments on commit 08aec15

Please sign in to comment.