RDocをメソッド名で検索したい

元ネタはhttp://www.plab.jp/blog/2009/04/10/bdochannarubygemsrdoc.htmlです。

$ gem server

だとメソッド名で検索できないので、それをrdocテンプレートのhannabdocで改善してみましょう。

インストール

Windows環境でも元エントリの通りにインストールできます。

[c:\]
$ gem sources -a http://gems.github.com
http://gems.github.com added to sources

[c:\]
$ gem install manalang-bdoc mislav-hanna
Successfully installed configuration-0.0.5
Successfully installed launchy-0.3.3
Successfully installed json-1.1.9-x86-mswin32
Successfully installed manalang-bdoc-0.2.2
Successfully installed rdoc-2.3.0
Successfully installed haml-2.0.10
Successfully installed mislav-hanna-0.1.8
7 gems installed
Installing ri documentation for launchy-0.3.3...
Installing ri documentation for json-1.1.9-x86-mswin32...
Installing ri documentation for manalang-bdoc-0.2.2...
Installing ri documentation for rdoc-2.3.0...
Installing ri documentation for haml-2.0.10...
Updating ri class cache with 3326 classes...
Installing RDoc documentation for launchy-0.3.3...
Installing RDoc documentation for json-1.1.9-x86-mswin32...
Installing RDoc documentation for manalang-bdoc-0.2.2...
Installing RDoc documentation for rdoc-2.3.0...
Installing RDoc documentation for haml-2.0.10...

hannaの実行は? (xargsないんですけど。orz)

元エントリではこんな風にすべてのgemsに対してhannaを一括実行しています。

# gem list --no-versions | xargs hanna --gems

Windows環境でもCygwinなひとはこれで実行できますが、ふつーのWindowsにはxargs様がいらっしゃいません。代わりにこんな風にやってみました("gem list --no-versions | ruby -ne 'print "hanna --gems ", $_' | cmd"だけ入力)↓

[c:\]
$ gem list --no-versions | ruby -ne 'print "hanna --gems ", $_' | cmd
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

[c:\]
$ hanna --gems actionmailer
Installing RDoc documentation for actionmailer-2.3.3...

[c:\]
$ hanna --gems actionpack
Installing RDoc documentation for actionpack-2.3.3...

#これ、めっちゃ時間掛かりますね。。。orz

参照するには

下記のようにコマンドを実行します。

[c:\]
$ bdoc

すると、ブラウザが立ち上がってドキュメントが参照できます。

メソッド名によるインクリメンタル検索もできます。