1. Nov 1st, 2005

    Fixing Rake and RDoc under Windows

    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

    1. Feb 9th, 2006

      Economysizegeek

      This no longer seems to apply to Rake 0.7.0 – any idea how to fix it?

    2. Feb 21st, 2006

      Economysizegeek

      Turns out this is not xp specific :(

      http://dev.rubyonrails.org/search?q=–line-numbers&wiki=on&changeset=on&ticket=on

      It’s an easy enough fix – which I assume will be cleaned up in the next release

    3. Feb 24th, 2007

      Economy Size Geek » Blog Archive » Labnotes » Blog Archive » Fixing Rake and RDoc under Windows

      [...] Labnotes » Blog Archive » Fixing Rake and RDoc under Windows [...]

    Your comment, here ⇓