RDocのささやかなカスタマイズ

自分でhtml_generatorみたいなのを書くのは大変なので、

if __FILE__ == $0
  # RDocを走らせるアプリケーション
else
  # テンプレートの定義
end

こんなん書いて'-T'オプションで指定することにした。


アプリ部分は具体的に言うとこんなの。

full_path = File.expand_path(__FILE__).sub(/\A[A-Z]:/, '')
ARGV.unshift '-SN'
ARGV.push '-T', full_path

require 'rdoc/rdoc'

begin
  r = RDoc::RDoc.new
  r.document(ARGV)
rescue RDoc::RDocError => e
  $stderr.puts e.message
  exit(1)
end

後半はまんまrdocコマンドからのコピペ。
テンプレートもrdoc/generators/template/html/html.rbをコピペして改変する。