On Monday 02 May 2005 06:32, Alexey Verkhovsky wrote:
> If you have ever wondered, why none of the rdoc tasks in any rakefile
> ever work with your One Click Installer Ruby, here is the explanation.
>
> c:\ruby\bin contains both 'rdoc' and 'rdoc.bat'. c:\ruby\bin is on the
> system path.
>
>  From Windows point of view, rdoc is not an executable. rdoc.bat is an
> executable, but in its eternal struggle to protect the user from
> himself, Windows doesn't notice that. Hence:
>
> irb(main):001:0> `rdoc`
> Errno::ENOEXEC: Exec format error - rdoc
> ...
> irb(main):002:0> `rdoc.bat`
> ... works...
>
> Unfortunately system 'rdoc ...' is exactly what Rake does. Not sure
> where and how it can be dealt with. Can One Click Installer somehow cope
> with it? Or can Rake invoke rdoc.rb directly, rather than via an
> executable?
>
> An ugly but effective workaround is to hack your local copy of
> lib/rake/rdoctask.rb, replacing sh %{rdoc -o  with sh %{rdoc.bat -o

An easy and clean way to solve this problem is to invoke rdoc
programmatically. This is what I do for Rant:

    require 'rdoc/rdoc'
    # args is an array of strings which you would otherwise give
    # on the commandline to rdoc
    RDoc::RDoc.new.document(args)

This should really work everywhere ruby runs.

> P.S. I am fully aware of the common opinion that the _proper_ workaround
> is to ditch Windows. But circumstances force me :)
Surely the best solution!

Stefan