Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > rake broken on windows?

Reply
Thread Tools

rake broken on windows?

 
 
msoulier
Guest
Posts: n/a
 
      10-16-2006
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

 
Reply With Quote
 
 
 
 
Jan Svitok
Guest
Posts: n/a
 
      10-16-2006
On 10/16/06, msoulier <(E-Mail Removed)> wrote:
> 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).

 
Reply With Quote
 
 
 
 
Daniel Berger
Guest
Posts: n/a
 
      10-16-2006

Jan Svitok wrote:
> On 10/16/06, msoulier <(E-Mail Removed)> wrote:
> > 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

 
Reply With Quote
 
msoulier
Guest
Posts: n/a
 
      10-16-2006

Jan Svitok wrote:
> 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

 
Reply With Quote
 
Nobuyoshi Nakada
Guest
Posts: n/a
 
      10-16-2006
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(" "))?

--
Nobu Nakada

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple rake build files? large rake files thufir Ruby 3 04-12-2008 07:28 AM
rake published rdoc version and arity of Rake::Task#execute - wrongnumber of arguments (0 for 1) James Mead Ruby 0 01-15-2008 05:42 PM
Rake TestTask running its block anytime rake is invoked Adam Anderson Ruby 1 09-19-2007 08:40 AM
Rake and rake aborted! Rake aborted! undefined method `gem' for main:Object peppermonkey Ruby 1 02-10-2007 04:43 AM
Rake 0.7.0 breaks "rake engine_migrate"? Joe Van Dyk Ruby 2 01-31-2006 12:11 AM



Advertisments