
Playing around with Ruby under Windows, I found out two bugs when trying to use RDoc.
The first bug involves Rake and the RDocTask task. When running under Windows, I get the error message undefined method `exitstatus’ for nil:NilClass
. It turns out that instead of calling RDoc classes directly, Rake runs RDoc as a separate process using tt>Kernel.system(‘rdoc …’). Unfortunately, Windows finds the file rdoc in ruby\bin, but doesn't know what to do with it. When you type rdoc from the command line, Windows also finds rdoc.bat and executes the batch file instead, but not when using Kernel.system.
To solve this, edit rake/rdoctask.rb and change line 104 to read:
sh %{rdoc.bat -o #{@rdoc_dir} #{opts} #{@rdoc_files}}
The second bug involves rdoc.bat itself. The batch file uses "c:\ruby\bin\rdoc" %1 %2 %3 ... to pass up to 10 command line arguments to RDoc. But Rake and RubyGems pass each individual file name to RDoc, plus a bunch of options, so you need more than 10 command line arguments to get the right documentation.
To solve this, edit rdoc.bat so the line reads:
"c:\ruby\bin\ruby.exe" "c:\ruby\bin\rdoc" %*
Image by d.r.lynch
Economy Size Geek » Blog Archive » Labnotes » Blog Archive » Fixing Rake and RDoc under Windows