foodsoft/lib/tasks/multicoops.rake

20 lines
645 B
Ruby
Raw Normal View History

namespace :multicoops do
desc 'Runs a specific rake task for each registered foodcoop, use rake multicoops:run db:migrate'
task :run => :environment do
task_to_run = ARGV[1]
FoodsoftConfig.each_coop do |coop|
puts "Run '#{task_to_run}' for #{coop}"
Rake::Task[task_to_run].invoke
end
end
2012-12-24 12:50:37 +01:00
desc 'Runs a specific rake task for a single coop, use rake mutlicoops:run_single db:migrate FOODCOOP=demo'
task :run_single => :environment do
task_to_run = ARGV[1]
FoodsoftConfig.select_foodcoop ENV['FOODCOOP']
puts "Run '#{task_to_run}' for #{ENV['FOODCOOP']}"
Rake::Task[task_to_run].invoke
end
end