rake broken on windows?

M

msoulier

I installed ruby for windows with rubygems support. Rake comes
installed already as a gem.

I took an existing project and tried a "rake test".

C:\Documents and Settings\user\My Documents\work\tftpplus>rake test
(in C:/Documents and Settings/user/My Documents/work/tftpplus)
c:/ruby/bin/ruby: No such file or directory -- and (LoadError)
rake aborted!
Command failed with status (1): [c:/ruby/bin/ruby -w -IC:/Documents and
Set...]

(See full trace by running task with --trace)

c:\ruby\bin\ruby.exe exists.

C:\Documents and Settings\user\My Documents\work\tftpplus>rake test
--trace
(in C:/Documents and Settings/user/My Documents/work/tftpplus)
** Invoke test (first_time)
** Execute test
c:/ruby/bin/ruby: No such file or directory -- and (LoadError)
rake aborted!
Command failed with status (1): [c:/ruby/bin/ruby -w -IC:/Documents and
Set...]
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:722:in `sh'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:729:in `sh'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `sh'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:747:in `ruby'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:812:in `ruby'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/testtask.rb:117:in
`define'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:831:in `verbose'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/testtask.rb:102:in
`define'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
c:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
c:/ruby/bin/rake.bat:25:in `load'
c:/ruby/bin/rake.bat:25

rake is a batch file, that looks like this.

@echo off
if not "%~f0" == "~f0" goto WinNT
ruby -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofruby
:WinNT
"%~d0%~p0ruby" -x "%~f0" %*
goto endofruby
#!/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'
version = "> 0"
if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
if Gem::Version.correct?(ARGV[0][1..-2])
version = ARGV[0][1..-2]
ARGV.shift
end
end
require_gem 'rake', version
load 'rake'

__END__
:endofruby

I'm not sure what's happening here, but rake is apparently not working.


Any ideas?

Mike
 
J

Jan Svitok

Command failed with status (1): [c:/ruby/bin/ruby -w -IC:/Documents and
Set...]

Spaces in pathnames. #1 reason to not install ruby into Program Files.
Only way around this issue is to enclose the pathname in quotes as in

c:/ruby/bin/ruby -w -I"C:/Documents and Set..."

Problem is that you'll need to quote the path in so many places deep
in ruby... So far nobody dared to fix that. On unix, you can escape
the spaces with a backslash, on windows, I don't know of any such
possibility (see help for cmd.exe if you want).

Another way is to avoid such paths (possibly using subst).
 
D

Daniel Berger

Jan said:
Command failed with status (1): [c:/ruby/bin/ruby -w -IC:/Documents and
Set...]

Spaces in pathnames. #1 reason to not install ruby into Program Files.
Only way around this issue is to enclose the pathname in quotes as in

c:/ruby/bin/ruby -w -I"C:/Documents and Set..."

Problem is that you'll need to quote the path in so many places deep
in ruby... So far nobody dared to fix that. On unix, you can escape
the spaces with a backslash, on windows, I don't know of any such
possibility (see help for cmd.exe if you want).

Another way is to avoid such paths (possibly using subst).

Maybe I should talk to Jim about this. One solution might be to use
File.short_path (in the win32-file package):

irb(main):001:0> require 'win32/file'
irb(main):002:0> File.short_path("C:\\Documents and Settings")
=> "DOCUME~1"

The win32-file package now comes standard with Curt's one-click
installer. There's also a gem for win32-file, so it could be added as
a dependency for Rake on Windows if needed.

Regards,

Dan
 
M

msoulier

Jan said:
Spaces in pathnames. #1 reason to not install ruby into Program Files.

Ah. It's not installed there, but my working directory is "My
Documents". I've moved my sandbox to c:\work, and that works fine.

I think that this should be fixed to the best of our ability, for
cross-platform development. I don't normally work on windows, but in
some cases I must, and when I must, I'd like to use Ruby as my OS
abstraction layer. ;-)

Mike
 
N

Nobuyoshi Nakada

Hi,

At Tue, 17 Oct 2006 07:20:22 +0900,
Daniel Berger wrote in [ruby-talk:220104]:
Maybe I should talk to Jim about this. One solution might be to use
File.short_path (in the win32-file package):

irb(main):001:0> require 'win32/file'
irb(main):002:0> File.short_path("C:\\Documents and Settings")
=> "DOCUME~1"

Oops, how ugly.

And it can occur on other platforms. Is there any reason that
rake can't use system(*args) rather than system(args.join(" "))?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top