Add ExceptionNotifier to multicoops:run task

This commit is contained in:
Patrick Gansterer 2019-10-21 22:53:26 +02:00
parent e498f9cb58
commit 241d504a76

View file

@ -7,11 +7,18 @@ namespace :multicoops do
desc 'Runs a specific rake task for each registered foodcoop, use rake multicoops:run TASK=db:migrate'
task :run => :environment do
task_to_run = ENV['TASK']
last_error = nil
FoodsoftConfig.each_coop do |coop|
begin
rake_say "Run '#{task_to_run}' for #{coop}"
Rake::Task[task_to_run].execute
rescue => error
last_error = error
ExceptionNotifier.notify_exception(error, data: {foodcoop: coop})
end
end
raise last_error if last_error
end
desc 'Runs a specific rake task for a single coop, use rake mutlicoops:run_single TASK=db:migrate FOODCOOP=demo'
task :run_single => :environment do