15 lines
490 B
Ruby
15 lines
490 B
Ruby
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 }
|
|
Cron::CronJob.subclasses.each(&:schedule)
|
|
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 }
|
|
Cron::CronJob.subclasses.each(&:display_schedule)
|
|
end
|
|
end
|