Sha256: f9915045c2a1f4ed6db2e3f525e63f46fee20f95dd50314ce931b9517685e06a

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

require 'rake'

module ScheduledJob
  class Job
    include Rake::DSL if defined? Rake::DSL

    def install_tasks
      def check_schedule_job(job)
        if job.respond_to?(:time_to_recur)
          job.schedule_job
        else
          job.descendants.each { |j| check_schedule_job(j) }
        end
      end

      namespace:jobs do
        desc "Will schedule all scheduled jobs"
        task :reschedule => :environment do
          ScheduledJob.classes.each do |job|
            check_schedule_job(job)
          end
        end
      end
    end
  end
end

ScheduledJob::Job.new.install_tasks

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scheduled_job-0.0.9 lib/tasks/jobs.rb