[Rake-devel] The 'ruby' help on windows

Luis Lavena luislavena at gmail.com
Mon Sep 15 14:37:34 EDT 2008

On Mon, Sep 15, 2008 at 3:30 PM, Dave Thomas <dave at pragprog.com> wrote:
> One of our authors has Ruby under Windows installed in c:\Program Files\ruby
> In our rake tasks, we have
> ruby %{"#{BIBEXTRACT}" "#{t.source}" >"#{t.name}"}, :verbose => true
> When they run this, they see the tracing:
> c:/Program Files/ruby/bin/ruby
> "C:/Development/workspace/EBAND/PPStuff/util/bin/bibextract.rb" "book.xml"
> 'c:/Program' is not recognized as an internal or external command,
> The space in the 'Program Files' directory name is being taken as a
> separator, and so the command doesn't execute.
> Is there a simple workaround for this, or do I need o tell the author to
> reinstall Ruby somewhere with no spaces in the path?

Hello Dave,

A similar issue to this one  in RubyGems was reported to Ruby-core and
FileUtils was fixed.

Since rake is extending FileUtils and adding the RUBY constant, it
needs to be updated. in the similar way.

This is the solution I've implemented in RubyGems, based on Nobu's
commit to the ruby svn:

      # escape string in case path to ruby executable contain spaces.
      @ruby.sub!(/.*\s.*/m, '"\&"')

Luis Lavena
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

More information about the Rake-devel mailing list