Skip to content

Instantly share code, notes, and snippets.

@jamiecobbett
Created November 30, 2009 11:42
Show Gist options
  • Save jamiecobbett/245400 to your computer and use it in GitHub Desktop.
Save jamiecobbett/245400 to your computer and use it in GitHub Desktop.
Run a rake task for each rakefile in directories under the current one
# Adapted from http://stackoverflow.com/questions/1686779/multifile-rake-build
# Runs a task (in this case the default task) for each Rakefile nested in the current directory
task :default do
FileList["*/**/Rakefile"].each do |project|
next if project =~ /^admin_console/
next if project =~ /^logging/
# clear current tasks
Rake::Task.clear
#load tasks from this project
load project
if !Rake::Task.task_defined?(:default)
puts "No default task defined in #{project}, aborting!"
exit -1
else
dir = project.pathmap("%d")
Dir.chdir(dir) do
default_task = Rake::Task[:default]
default_task.invoke()
end
end
end
puts "Done building projects"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment