I have a project that consists of multiple projects, something like:
my_project\ proj_A\ (code, tests, Rakefile, etc) proj_B\ (code, tests, Rakefile, etc) proj_C\ (code, tests, Rakefile, etc)
I'd like to create a Rakefile under "my_project" that can execute the Rakefile's in the other pr开发者_Go百科ojects. For example to package up the entire app I need to run tasks defined in the Rakefile's in proj_A, proj_B and then proj_C (in that order).
What's the best way to do this? Just have a Rakefile that defines tasks which call out to the other Rakefiles?
Create a rake task that depends on all the other projects.
import 'projdir1/Rakefile'
import 'projdir2/Rakefile'
task :finalproject => [:project1, :project2] do
# do nothing or maybe some cleanup
end
The tasks :project1 and :project2 would be defined in the external rakefiles being included.
Also look at this page for more complex examples. http://rake.rubyforge.org/files/doc/rakefile_rdoc.html
精彩评论