demarches-normaliennes/lib/tasks/jobs.rake

16 lines
490 B
Ruby
Raw Normal View History

2020-03-28 16:45:16 +01:00
namespace :jobs do
desc 'Schedule all cron jobs'
task schedule: :environment do
glob = Rails.root.join('app', 'jobs', '**', '*_job.rb')
Dir.glob(glob).each { |f| require f }
2020-12-08 15:21:35 +01:00
Cron::CronJob.subclasses.each(&:schedule)
2020-03-28 16:45:16 +01:00
end
desc 'Display schedule for all cron jobs'
task display_schedule: :environment do
glob = Rails.root.join('app', 'jobs', '**', '*_job.rb')
Dir.glob(glob).each { |f| require f }
2020-12-08 15:21:35 +01:00
Cron::CronJob.subclasses.each(&:display_schedule)
end
2020-03-28 16:45:16 +01:00
end