J
Jim Menard
Herein is described a problem with using Rake's RDocTask on Windows, and a
proposed workaround. The workaround works well enough, but does anybody else
have a better one?
While prepping my latest project for gemhood, I came across a problem with the
rdoc task when used on Windows XP: it didn't work. This is documented in a few
old ruby-talk posts. (See
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/118963?help-en and
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/118968 for some
proposed solutions).
Even after fixing the problem by applying the patch described in 118968, there
was still another problem: the rdoc.bat file (and all Windows batch files)
only take up to nine arguments. Eight command line options are used by the
rdoc command before the first file is even mentioned:
rdoc.bat -o html --main 'README' --title 'MyProjectName' -T 'html' README TODO
lib/xx.rb lib/xx/file1.rb lib/xx/file2.rb ...
Here's what I have come up with: instead of the method proposed in 118968
def rdoc
RUBY_PLATFORM =~ /win32/ ? 'rdoc.bat' : 'rdoc'
end
(and the associated change in RDocTask#define that calls this method), I use
def rdoc
return 'rdoc' unless RUBY_PLATFORM =~ /win32/
require 'rbconfig'
bindir = Config::CONFIG['bindir']
return "#{File.join(bindir, 'ruby.exe')} #{File.join(bindir, 'rdoc')}"
end
Will this work on all Windows systems, and is it the right thing to do? If so,
is it an appropriate addition to Rake itself?
Jim
proposed workaround. The workaround works well enough, but does anybody else
have a better one?
While prepping my latest project for gemhood, I came across a problem with the
rdoc task when used on Windows XP: it didn't work. This is documented in a few
old ruby-talk posts. (See
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/118963?help-en and
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/118968 for some
proposed solutions).
Even after fixing the problem by applying the patch described in 118968, there
was still another problem: the rdoc.bat file (and all Windows batch files)
only take up to nine arguments. Eight command line options are used by the
rdoc command before the first file is even mentioned:
rdoc.bat -o html --main 'README' --title 'MyProjectName' -T 'html' README TODO
lib/xx.rb lib/xx/file1.rb lib/xx/file2.rb ...
Here's what I have come up with: instead of the method proposed in 118968
def rdoc
RUBY_PLATFORM =~ /win32/ ? 'rdoc.bat' : 'rdoc'
end
(and the associated change in RDocTask#define that calls this method), I use
def rdoc
return 'rdoc' unless RUBY_PLATFORM =~ /win32/
require 'rbconfig'
bindir = Config::CONFIG['bindir']
return "#{File.join(bindir, 'ruby.exe')} #{File.join(bindir, 'rdoc')}"
end
Will this work on all Windows systems, and is it the right thing to do? If so,
is it an appropriate addition to Rake itself?
Jim