diff --git a/Rakefile b/Rakefile index 3908f45..7e77cda 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ require 'echoe' require 'lib/hanna/rdoc_version' Echoe.new('hanna') do |p| - p.version = '0.1.8' + p.version = '0.1.9' p.summary = "An RDoc template that scales" p.description = "Hanna is an RDoc implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind." diff --git a/hanna.gemspec b/hanna.gemspec index 9d67586..04aa6f1 100644 --- a/hanna.gemspec +++ b/hanna.gemspec @@ -2,17 +2,17 @@ Gem::Specification.new do |s| s.name = %q{hanna} - s.version = "0.1.8" + s.version = "0.1.9" s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= s.authors = ["Mislav Marohni\304\207"] - s.date = %q{2009-08-21} + s.date = %q{2009-09-16} s.default_executable = %q{hanna} s.description = %q{Hanna is an RDoc implemented in Haml, making its source clean and maintainable. It's built with simplicity, beauty and ease of browsing in mind.} s.email = %q{mislav.marohnic@gmail.com} s.executables = ["hanna"] - s.extra_rdoc_files = ["bin/hanna", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_index.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/method_search.js", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/hanna.rb", "README.markdown"] - s.files = ["bin/hanna", "hanna.gemspec", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_index.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/method_search.js", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/hanna.rb", "Manifest", "Rakefile", "README.markdown"] + s.extra_rdoc_files = ["README.markdown", "bin/hanna", "lib/hanna.rb", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_index.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/method_search.js", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/rubygems_plugin.rb"] + s.files = ["Manifest", "README.markdown", "Rakefile", "bin/hanna", "hanna.gemspec", "lib/hanna.rb", "lib/hanna/hanna.rb", "lib/hanna/rdoc_version.rb", "lib/hanna/rdoctask.rb", "lib/hanna/template_files/class_index.haml", "lib/hanna/template_files/file_index.haml", "lib/hanna/template_files/index.haml", "lib/hanna/template_files/layout.haml", "lib/hanna/template_files/method_index.haml", "lib/hanna/template_files/method_list.haml", "lib/hanna/template_files/method_search.js", "lib/hanna/template_files/page.haml", "lib/hanna/template_files/prototype-1.6.0.3.js", "lib/hanna/template_files/sections.haml", "lib/hanna/template_files/styles.sass", "lib/hanna/template_helpers.rb", "lib/hanna/template_page_patch.rb", "lib/rubygems_plugin.rb", "sample/output/classes/MockProject.html", "sample/output/classes/MockProject/EnterpriseProtocol.html", "sample/output/classes/MockProject/FunkyClass.html", "sample/output/created.rid", "sample/output/files/sample/source/LICENSE.html", "sample/output/index.html", "sample/output/styles.css"] s.homepage = %q{http://github.com/mislav/hanna} s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Hanna", "--main", "README.markdown"] s.require_paths = ["lib"] diff --git a/lib/rubygems_plugin.rb b/lib/rubygems_plugin.rb new file mode 100644 index 0000000..c142011 --- /dev/null +++ b/lib/rubygems_plugin.rb @@ -0,0 +1,27 @@ +unless defined?(Hanna) or defined?(RDoc) + require 'rubygems/doc_manager' + require 'rubygems/requirement' + require 'hanna/rdoc_version' + + 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 + requirement = Gem::Requirement.create Hanna::RDOC_VERSION_REQUIREMENT + + begin + gem 'rdoc', requirement.to_s + rescue Gem::LoadError + # ignore + end + + # call the original method + load_rdoc_without_version_constraint + + unless requirement.satisfied_by? rdoc_version + raise Gem::DocumentError, "ERROR: RDoc version #{requirement} not installed" + end + end + end +end