Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Nested Rails Files
Joe Wirtley
2/23/2008 1:15:00 AM
I'm having trouble making nested Rakefiles work. Say I have the
following:
+ Raketest
Rakefile
+ Child
Rakefile
This is a Raketest folder containing a rakefile, and a child folder
containing a different rakefile. In the Raketest folder, I have the
following Rakefile:
task :default do
sh "cd Child;rake"
end
The Child folder under this has the following Rakefile:
task :default do
puts "Child Rake Default task"
end
The following shows the result of running rake first in the child
folder, then in the Raketest folder:
C:\Raketest\Child>rake
(in C:/Raketest/Child)
Child Rake Default task
C:\Raketest\Child>cd ..
C:\Raketest>rake
cd Child;rake
(in C:/Raketest)
The system cannot find the path specified.
rake aborted!
Command failed with status (1): [cd Child;rake...]
C:/Raketest/rakefile.rb:2
(See full trace by running task with --trace)
When I run rake in the child folder, it works. When I run rake in the
Raketest folder, I get the "The system cannot find the path specified."
message. So what am I missing?
Just for good measure, I uninstalled all versions of Rake (via gem) then
installed the latest version, which didn't change anything.
I've attached my zipped contrived sample. I'd appreciate any help.
Attachments:
http://www.ruby-...
attachment/1474/Ra...
--
Posted via
http://www.ruby-...
.
3 Answers
Mark Bush
2/23/2008 9:10:00 AM
0
Joe Wirtley wrote:
> When I run rake in the child folder, it works. When I run rake in the
> Raketest folder, I get the "The system cannot find the path specified."
> message. So what am I missing?
On UNIX (MacOS):
$ cat lib/tasks/Raketest/Rakefile
task :default do
sh "cd Child;rake"
end
$ cd lib/tasks/Raketest/
$ rake
(in /Users/bush/Src/Rails/sample/lib/tasks/Raketest)
cd Child;rake
(in /Users/bush/Src/Rails/sample/lib/tasks/Raketest/Child)
Child Rake Default task
$ rake --version
rake, version 0.8.1
My guess is that it has something to do with the way OS commands are
being executed under Windows. Can you run "cd Child; rake" like that
from the Windows prompt and get the right thing?
--
Posted via
http://www.ruby-...
.
Daniel Schömer
2/23/2008 9:30:00 AM
0
Mark Bush wrote:
> Joe Wirtley wrote:
>> When I run rake in the child folder, it works. When I run rake in the
>> Raketest folder, I get the "The system cannot find the path specified."
>> message. So what am I missing?
> [...]
>
> My guess is that it has something to do with the way OS commands are
> being executed under Windows. Can you run "cd Child; rake" like that
> from the Windows prompt and get the right thing?
For Windows cmd.exe, you can't use ';' to separate commands. You
have to use '&' to unconditionally them one after the other.
sh "cd Child & rake" # Windows only
Maybe '&&' will work on Unix and Windows.
sh "cd Child && rake"
Daniel
--
http://vorratsdatenspei...
Joe Wirtley
2/23/2008 4:28:00 PM
0
Daniel Schömer wrote:
> Mark Bush wrote:
>> Joe Wirtley wrote:
>>> When I run rake in the child folder, it works. When I run rake in the
>>> Raketest folder, I get the "The system cannot find the path specified."
>>> message. So what am I missing?
>> [...]
>>
> For Windows cmd.exe, you can't use ';' to separate commands. You
> have to use '&' to unconditionally them one after the other.
>
> sh "cd Child & rake" # Windows only
>
> Maybe '&&' will work on Unix and Windows.
>
> sh "cd Child && rake"
>
> Daniel
Thanks to both of you. I knew it had to be something simple. Both '&'
and '&&' appear to work on Windows.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Nested Rails Files
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password