Add ExceptionNotifier to multicoops:run task
This commit is contained in:
parent
e498f9cb58
commit
241d504a76
1 changed files with 9 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue