Module: JobTick::WheneverSetup

Defined in:
lib/jobtick/whenever_setup.rb

Overview

Overrides Whenever’s built-in job types to wrap execution with jobtick pings.

Usage — add one line to config/schedule.rb:

JobTick::WheneverSetup.install!(self)

This replaces the :runner, :rake, and :command job types so that every scheduled job automatically sends started/completed/failed heartbeats without any per-job configuration.

Class Method Summary collapse

Class Method Details

.install!(schedule) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/jobtick/whenever_setup.rb', line 16

def self.install!(schedule)
  endpoint = JobTick.config.endpoint

  schedule.job_type :runner,  wrap(endpoint, "cd :path && bundle exec rails runner ':task' :output")
  schedule.job_type :rake,    wrap(endpoint, "cd :path && bundle exec rake :task :output")
  schedule.job_type :command, wrap(endpoint, "cd :path && :task :output")
end