From 4681de5ebce4c0dce6d395cf79868937fa38c89c Mon Sep 17 00:00:00 2001 From: "masaru.terada" Date: Sun, 5 Jan 2025 10:45:49 +0900 Subject: [PATCH 1/3] Fix: #1269 `gem server` doesn't work because `Gem::Rdoc.load_rdoc` raise `NoMethodError` --- lib/rdoc/rubygems_hook.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index 87ce470af1..e0a84bf84e 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -273,6 +273,10 @@ class RubygemsHook attr_accessor :generate_rdoc, :generate_ri, :force + class << self + attr_accessor :rdoc_version + end + def self.default_gem? !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb")) end @@ -310,5 +314,9 @@ def self.generation_hook installer, specs # Generate document for compatibility if this is a default gem. RubyGemsHook.generate(installer, specs) end + + def self.load_rdoc + @rdoc_version = RubyGemsHook.load_rdoc + end end end From 4c9b663cab701a6b5c5b96310b0a1daf096b9215 Mon Sep 17 00:00:00 2001 From: mterada1228 <49284339+mterada1228@users.noreply.github.com> Date: Sun, 5 Jan 2025 16:54:34 +0900 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Sutou Kouhei --- lib/rdoc/rubygems_hook.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index e0a84bf84e..9869837dfb 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -273,10 +273,6 @@ class RubygemsHook attr_accessor :generate_rdoc, :generate_ri, :force - class << self - attr_accessor :rdoc_version - end - def self.default_gem? !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb")) end @@ -316,7 +312,11 @@ def self.generation_hook installer, specs end def self.load_rdoc - @rdoc_version = RubyGemsHook.load_rdoc + RubyGemsHook.load_rdoc + end + + def self.rdoc_version + RubyGemsHook.rdoc_version end end end From 03e1f2825fb0a4470a041b444a93a2c8516a56a1 Mon Sep 17 00:00:00 2001 From: "masaru.terada" Date: Mon, 6 Jan 2025 08:24:53 +0900 Subject: [PATCH 3/3] add `rdoc_installed?` and `ri_installed?` --- lib/rdoc/rubygems_hook.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index 9869837dfb..bc6065438b 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -318,5 +318,13 @@ def self.load_rdoc def self.rdoc_version RubyGemsHook.rdoc_version end + + def rdoc_installed? + RubyGemsHook.new(@spec).rdoc_installed? + end + + def ri_installed? + RubyGemsHook.new(@spec).ri_installed? + end end end