rake broken on windows?

Discussion in 'Ruby' started by msoulier, Oct 16, 2006.

  1. msoulier

    msoulier Guest

    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
    msoulier, Oct 16, 2006
    #1
    1. Advertising

  2. msoulier

    Jan Svitok Guest

    On 10/16/06, msoulier <> 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).
    Jan Svitok, Oct 16, 2006
    #2
    1. Advertising

  3. Jan Svitok wrote:
    > On 10/16/06, msoulier <> 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
    Daniel Berger, Oct 16, 2006
    #3
  4. msoulier

    msoulier Guest

    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
    msoulier, Oct 16, 2006
    #4
  5. 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
    Nobuyoshi Nakada, Oct 16, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe Van Dyk
    Replies:
    2
    Views:
    102
    Damphyr
    Jan 31, 2006
  2. peppermonkey
    Replies:
    1
    Views:
    243
    Gregory Brown
    Feb 10, 2007
  3. Adam Anderson
    Replies:
    1
    Views:
    129
    Adam Anderson
    Sep 19, 2007
  4. James Mead
    Replies:
    0
    Views:
    143
    James Mead
    Jan 15, 2008
  5. thufir
    Replies:
    3
    Views:
    218
    Thufir
    Apr 12, 2008
Loading...

Share This Page