demarches-normaliennes/lib/tasks/jobs.rake

9 lines
236 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 }
CronJob.subclasses.each(&:schedule)
end
end