From 08aec152ad81e1fd6a345d04f420a6e44d4f1a24 Mon Sep 17 00:00:00 2001 From: tompng Date: Mon, 16 Dec 2024 00:25:16 +0900 Subject: [PATCH] Add attribute :force to RDoc::RubygemsHook just like RDoc::RubyGemsHook 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. --- lib/rdoc/rubygems_hook.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index 4c2a30d786..87ce470af1 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -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")) @@ -281,6 +281,7 @@ def initialize(spec, generate_rdoc = false, generate_ri = true) @spec = spec @generate_rdoc = generate_rdoc @generate_ri = generate_ri + @force = false end def generate @@ -288,7 +289,9 @@ def generate 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