class Tomo::Plugin::Cron::Tasks

Public Instance Methods

install() click to toggle source
# File lib/tomo/plugin/cron/tasks.rb, line 9
def install
  require_setting :cron_schedule_path

  crontab = Whenever.cron(whenever_options)

  remote.run "echo #{crontab.shellescape} | crontab -"
end
show() click to toggle source
# File lib/tomo/plugin/cron/tasks.rb, line 5
def show
  remote.run "crontab -l", raise_on_error: false
end
uninstall() click to toggle source
# File lib/tomo/plugin/cron/tasks.rb, line 17
def uninstall
  remote.run "crontab -r"
end

Private Instance Methods

whenever_options() click to toggle source
# File lib/tomo/plugin/cron/tasks.rb, line 23
def whenever_options
  {}.tap do |options|
    options[:file] = settings[:cron_schedule_path]
    options[:set]  = "path=#{paths.current}"
    options[:set] += "&environment=#{settings.dig(:env_vars, :RAILS_ENV) || 'production'}"
  end
end