# Make sure there are no `done_installing` hooks defined yet, so there is know
# starting position.
raise unless Gem.done_installing_hooks.empty?

# Initialize the RubyGems RDoc hook.
require "rubygems/rdoc"

# Double check that there is only one `done_installing` hook loaded.
raise unless Gem.done_installing_hooks.size == 1

# Subsequently drop the hook.
Gem.done_installing_hooks.pop

module FedoraRDoc; end;

class FedoraRDoc::RubyGemsHook < RDoc::RubygemsHook
  def self.generation_hook installer, specs
    puts "FedoraRDoc.generation_hook - the `specs` could be modified to include additional `rdoc_options`"
    super
  end

  def document generator, options, destination
    puts "FedoraRDoc#document - The `generator` name could be modified here."
    super
  end
end

Gem.done_installing(&FedoraRDoc::RubyGemsHook.method(:generation_hook))
