Chaining together Rakefiles

Hello.

Can someone explain the best way to chain together Rakefiles?

I am working on a project with the following layout:

comon libraries

depot/common

one rails appserver

depot/projectA

another rails appserver

depot/projectB

All of these projects (common, projectA, projectB) have their own
Rakefiles that allow the standard test targets (e.g. test,
test:units). I would like to have a Rakefile in the depot directory
be able to call into one or more of the projects’ Rakefiles. For
example, running “rake test” in depot would be able to run “rake test”
in one or more of the subprojects. I’d also like to do something
similar for code coverage tasks.

What is the best way to do this? Executing the projects’ Rakefiles
from the master Rakefile via something like this doesn’t work since
“rake test” needs to be run from the project’s base directory:

ruby(“projectA/Rakefile test”)

And even if that did work, it seems like there would be a cleaner way.

I appreciate any thoughts.

Jeff

On 5/1/07, Jeff J. [email protected] wrote:

And even if that did work, it seems like there would be a cleaner way.

def rake(*args)
ruby “-S”, “rake”, *args
end

namespace :projectA do
task :test do
Dir.chdir(“projectA”) { rake “test” }
end
end


rake projectA:test

Cheers,
/Nick

That works great. Thanks.

Jeff