[Rake-devel] rdoctask bug

Kevin Smith wxruby at qualitycode.com
Tue Jun 8 22:21:12 EDT 2004


Pierre Baillet wrote:
> I suggest the following change :
> 
> 	if RUBY_PLATFORM =~ /win32$/
> 		sh %{rdoc.bat -o #{@rdoc_dir} #{opts} #{@rdoc_files}}
>     else  
> 		sh %{rdoc -o #{@rdoc_dir} #{opts} #{@rdoc_files}}
> 	end

As a refactoring nut who hates code duplication, I would prefer 
something like this (untested):

   if RUBY_PLATFORM =~ /win32$/
     rdoc = 'rdoc.bat'
   else
     rdoc = 'rdoc'
   end
   sh %{#{rdoc} -o #{@rdoc_dir} #{opts} #{@rdoc_files}}

I haven't looked at the code, but is there some central place that holds 
all the platform-specific stuff? If so, the setting of rdoc could take 
place there (at which point it might become $rdoc or $rdoc_cmd.

Cheers,

Kevin


More information about the Rake-devel mailing list