Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Fix hanna rubygems integration, you can install this version of hanna…
Browse files Browse the repository at this point in the history
…, then just do `gem rdoc --all` to get all hanna'd rdocs!
  • Loading branch information
raggi committed Jul 9, 2010
1 parent 1e2bd17 commit 9837f34
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
1 change: 1 addition & 0 deletions lib/hanna.rb
@@ -1 +1,2 @@
module Hanna; end
require 'hanna/hanna'
2 changes: 1 addition & 1 deletion lib/hanna/hanna.rb
Expand Up @@ -9,7 +9,7 @@
require 'sass'
require 'rdoc/rdoc'
require 'rdoc/generator'
require 'hanna/version' unless ::Hanna # meh
require 'hanna/version'

class RDoc::Generator::Hanna
STYLE = 'styles.sass'
Expand Down
32 changes: 6 additions & 26 deletions lib/rubygems_plugin.rb
@@ -1,28 +1,8 @@
unless defined?(::Hanna) or defined?(::RDoc)
require 'rubygems/doc_manager'
require 'rubygems/requirement'
# TODO for rubygems 1.3.8, should get Gem.register_plugin(:documtnation,
# 'hanna/rubygems').
# TODO some way of making this optional.

# define the Hanna namespace to prevent actions of rubygems_plugin from older versions
module ::Hanna; end
# Could use Gem.pre_install hooks, but that'd not work for `gem rdoc --all`.

class << Gem::DocManager
alias load_rdoc_without_version_constraint load_rdoc

# overwrite load_rdoc to load the exact version of RDoc that Hanna works with
def load_rdoc
unless defined? ::Hanna::VERSION
load File.expand_path(File.join(File.dirname(__FILE__), 'hanna', 'version.rb'))
end

Hanna::require_rdoc(false) # don't terminate if failed

# call the original method
load_rdoc_without_version_constraint
requirement = Gem::Requirement.create Hanna::RDOC_VERSION_REQUIREMENT

unless requirement.satisfied_by? rdoc_version
raise Gem::DocumentError, "ERROR: RDoc version #{requirement} not installed"
end
end
end
end
require 'rubygems/doc_manager'
Gem::DocManager.configured_args << '-f' << 'hanna'

0 comments on commit 9837f34

Please sign in to comment.