`rake` fails: Exec format error

I’m trying to start rake running for a sub-component of our system.
However Ruby doesn’t like rake and produces the following error…

ruby -e “rake” (it gives the same error inside my .rb files)

-e:1:in ``’: Exec format error - rake (Errno::ENOEXEC)

I worked around it by creating a .rb file that contains:
Rake::Task[‘taskname’].invoke

Is there a better way or a standard practice for invoking an external
Rake process from inside Ruby?

Thanks,
Larry

A more complete version of what I’m doing is…

crntDir = Dir.pwd
Dir.chdir("other_directory_path")
%x{ruby -e "require 'Rakefile'; Rake::Task['some_task'].invoke "}
Dir.chdir(crntDir)

Is there a more elegant ruby-ism that accomplishes this?

Alle venerdì 10 agosto 2007, Larry F. ha scritto:

A more complete version of what I’m doing is…

crntDir = Dir.pwd
Dir.chdir("other_directory_path")
%x{ruby -e "require 'Rakefile'; Rake::Task['some_task'].invoke "}
Dir.chdir(crntDir)

Is there a more elegant ruby-ism that accomplishes this?

If you want to execute a rakefile, I think you can do:

%x{rake …}

Stefano

If you want to execute a rakefile, I think you can do:
%x{rake …}
ruby -e ‘%x{rake}’ produces the same error message

Nobuyoshi N. wrote:

It depends on what’s your platform and how you’ve installed
rake.

We’re running Windows XP. ruby -v says:
ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
I don’t know much more than that. I’m guessing we used the one-click
installation.

Larry

Larry F. wrote:

I’m guessing we used the one-click installation.

There are 3 rake files in my ruby installation directory:
rake - near the top it reads # This file was generated by RubyGems.
rake.bat - very similar to rake
rake.cmd - one line: @ruby “C:/ruby/bin/rake” %*

Nobuyoshi N. wrote:

rake.cmd would work.

Just tried it and yes, rake.cmd works.
Thank you,
Larry

Hi,

At Fri, 10 Aug 2007 08:37:15 +0900,
Larry F. wrote in [ruby-talk:264040]:

I’m trying to start rake running for a sub-component of our system.
However Ruby doesn’t like rake and produces the following error…

ruby -e “rake” (it gives the same error inside my .rb files)

-e:1:in ``’: Exec format error - rake (Errno::ENOEXEC)

It depends on what’s your platform and how you’ve installed
rake.

Hi,

At Sat, 11 Aug 2007 00:28:16 +0900,
Larry F. wrote in [ruby-talk:264105]:

There are 3 rake files in my ruby installation directory:
rake - near the top it reads # This file was generated by RubyGems.
rake.bat - very similar to rake
rake.cmd - one line: @ruby “C:/ruby/bin/rake” %*

rake.cmd would work.