Permalink
Browse files

Fix hanna rubygems integration, you can install this version of hanna…

…, then just do `gem rdoc --all` to get all hanna'd rdocs!
  • Loading branch information...
1 parent 1e2bd17 commit 9837f342c9d451526f834564f403e5a5ac8bfe8c @raggi committed Jul 9, 2010
Showing with 8 additions and 27 deletions.
  1. +1 −0 lib/hanna.rb
  2. +1 −1 lib/hanna/hanna.rb
  3. +6 −26 lib/rubygems_plugin.rb
View
@@ -1 +1,2 @@
+module Hanna; end
require 'hanna/hanna'
View
@@ -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'
View
@@ -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.