mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[rubygems/rubygems] Fix gem rdoc
not working with newer versions of rdoc
369f9b9311
This commit is contained in:
parent
4323674fe4
commit
e21e5bc814
Notes:
git
2025-03-10 03:43:59 +00:00
2 changed files with 9 additions and 17 deletions
|
@ -5,8 +5,6 @@ require_relative "../rubygems"
|
|||
begin
|
||||
require "rdoc/rubygems_hook"
|
||||
module Gem
|
||||
RDoc = ::RDoc::RubygemsHook
|
||||
|
||||
##
|
||||
# Returns whether RDoc defines its own install hooks through a RubyGems
|
||||
# plugin. This and whatever is guarded by it can be removed once no
|
||||
|
@ -15,8 +13,14 @@ begin
|
|||
def self.rdoc_hooks_defined_via_plugin?
|
||||
Gem::Version.new(::RDoc::VERSION) >= Gem::Version.new("6.9.0")
|
||||
end
|
||||
end
|
||||
|
||||
Gem.done_installing(&Gem::RDoc.method(:generation_hook)) unless Gem.rdoc_hooks_defined_via_plugin?
|
||||
if rdoc_hooks_defined_via_plugin?
|
||||
RDoc = ::RDoc::RubyGemsHook
|
||||
else
|
||||
RDoc = ::RDoc::RubygemsHook
|
||||
|
||||
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
end
|
||||
|
|
|
@ -18,19 +18,7 @@ class TestGemRDoc < Gem::TestCase
|
|||
|
||||
install_gem @a
|
||||
|
||||
hook_class = if defined?(RDoc::RubyGemsHook)
|
||||
RDoc::RubyGemsHook
|
||||
else
|
||||
Gem::RDoc
|
||||
end
|
||||
|
||||
@hook = hook_class.new @a
|
||||
|
||||
begin
|
||||
hook_class.load_rdoc
|
||||
rescue Gem::DocumentError => e
|
||||
pend e.message
|
||||
end
|
||||
@hook = Gem::RDoc.new @a
|
||||
|
||||
Gem.configuration[:rdoc] = nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue