diff --git a/Gemfile b/Gemfile index 19e532bc0b..7a8c5604b0 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ elsif RUBY_ENGINE == "jruby" end group :documentation do - gem 'rdoc', '2.1' + gem 'rdoc', '2.2' end if ENV['CI'] diff --git a/Rakefile b/Rakefile index 0ee7647a12..204f3381dc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,6 @@ +gem 'rdoc', '= 2.2' +require 'rdoc' + require 'rake' require 'rake/rdoctask' require 'rake/gempackagetask' @@ -68,7 +71,15 @@ Rake::RDocTask.new do |rdoc| rdoc.options << '--charset' << 'utf-8' rdoc.options << '--main' << 'railties/README' - rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : './doc/template/horo' + # Workaround: RDoc assumes that rdoc.template can be required, and that + # rdoc.template.upcase is a constant living in RDoc::Generator::HTML + # which holds the actual template class. + # + # We put 'doc/template' in the load path to be able to set the template + # to the string 'horo' and thus meet those RDoc's assumptions. + $:.unshift('doc/template') + + rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : 'horo' rdoc.rdoc_files.include('railties/CHANGELOG') rdoc.rdoc_files.include('railties/MIT-LICENSE') diff --git a/doc/template/horo.rb b/doc/template/horo.rb index e028422a2e..b38fa28cde 100644 --- a/doc/template/horo.rb +++ b/doc/template/horo.rb @@ -11,8 +11,12 @@ if defined?(RDoc::Diagram) end end +require 'rdoc/generator/html' + module RDoc -module Page +module Generator +class HTML +class HORO FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif" @@ -28,7 +32,7 @@ a:hover { } body, td, p { - font-family: %fonts%; + font-family: <%= values['fonts'] %>; background: #FFF; color: #000; margin: 0px; @@ -206,7 +210,7 @@ dd { } CSS -XHTML_PREAMBLE = %{ +XHTML_PREAMBLE = %{"?> @@ -221,9 +225,9 @@ XHTML_FRAMESET_PREAMBLE = %{ HEADER = XHTML_PREAMBLE + < - %title% - - + <%= values['title'] %> + +