Skip to content

Commit e21e5bc

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Fix gem rdoc not working with newer versions of rdoc
ruby/rubygems@369f9b9311
1 parent 4323674 commit e21e5bc

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

lib/rubygems/rdoc.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
begin
66
require "rdoc/rubygems_hook"
77
module Gem
8-
RDoc = ::RDoc::RubygemsHook
9-
108
##
119
# Returns whether RDoc defines its own install hooks through a RubyGems
1210
# plugin. This and whatever is guarded by it can be removed once no
@@ -15,8 +13,14 @@ module Gem
1513
def self.rdoc_hooks_defined_via_plugin?
1614
Gem::Version.new(::RDoc::VERSION) >= Gem::Version.new("6.9.0")
1715
end
18-
end
1916

20-
Gem.done_installing(&Gem::RDoc.method(:generation_hook)) unless Gem.rdoc_hooks_defined_via_plugin?
17+
if rdoc_hooks_defined_via_plugin?
18+
RDoc = ::RDoc::RubyGemsHook
19+
else
20+
RDoc = ::RDoc::RubygemsHook
21+
22+
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
23+
end
24+
end
2125
rescue LoadError
2226
end

test/rubygems/test_gem_rdoc.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,7 @@ def setup
1818

1919
install_gem @a
2020

21-
hook_class = if defined?(RDoc::RubyGemsHook)
22-
RDoc::RubyGemsHook
23-
else
24-
Gem::RDoc
25-
end
26-
27-
@hook = hook_class.new @a
28-
29-
begin
30-
hook_class.load_rdoc
31-
rescue Gem::DocumentError => e
32-
pend e.message
33-
end
21+
@hook = Gem::RDoc.new @a
3422

3523
Gem.configuration[:rdoc] = nil
3624
end

0 commit comments

Comments
 (0)