From: Joe Wirtley Date: 2008-02-14T09:44:17+09:00 Subject: Re: New Ruby developer Rake questions Thanks for the suggestion. I'm having trouble making this work. I've created a couple test scripts to illustrate. In the Raketest folder, I have the following Rakefile.rb script: task :default do sh "cd Child;rake" end The Child folder under this has the following Rakefile.rb: 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. Dave Baldwin wrote: > On 12 Feb 2008, at 20:22, Joe Wirtley wrote: > >> Child Project 1 >> that >> I want to be referenced from the child project rakefiles. I'm not >> thrilled about something like: >> >> require '..\..\Support.rb' >> >> but it does seem to work. What is the "best" way to handle this? I >> would rather that the scripts work on any machine with the same >> relative >> directory structures. >> > > Not sure why you don't like this. An alternative would be to change > your load path variable: > > $:.unshift '..\..' > require 'Support' > > >> >> magic >> I don't know). So what's the best way to approach this? >> > > I often do something along the lines of: > > sh "cd childDir; rake -f ../../Rakefile build" > > in the top level Rakefile which will change to the child directory and > then run a fresh ruby and rake session. > > Dave. Attachments: http://www.ruby-forum.com/attachment/1430/Raketest.zip -- Posted via http://www.ruby-forum.com/.