Sha256: 3433dda694e14892b6cff83f90753a459c12ae0d7c4a1eefd8ebfe4e4197f2f8

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

using RubyClock::DSL

on_error do |job, error|
  case job
  when String
    puts "#{job}: #{error.class}: #{error.message}"
  else
    puts "An error has occurred with job #{job.identifier}: #{error.class}: #{error.message}"
  end
end

# on_error do |job, error|
#   raise error
# end

around_action do |job_proc, job_info|
  puts "before1 #{job_info.class}"
  job_proc.call
  puts "after1"
end

around_action do |job_proc|
  puts "before2"
  job_proc.call
  puts "after2"
end

every('2 seconds') do
  puts "hello from a ruby-clock job"
end

every('2 seconds') do
  RubyClock::Runners.shell 'say hello'
end

every('2 seconds') do
  raise "🐈️ this error is expected, to test the error catcher"
end

cron('*/10 * * * * *') do
  puts "cron running on every 10th second #{Time.now}"
end

every('2 seconds') do
  if defined?(schedule)
    raise "💥 we do not expect the ruby-clock DSL to be available inside a job, but it is"
  end
end

every('2 seconds') do
  if defined?(shell) || defined?(rake)
    puts "💥 we do not expect runners to be available inside a job, but it is"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-clock-2.0.0.beta4 example-app/Clockfile