Sha256: 4c379a01eef0fc7c3c003bc2ce5616875e121559d32c6dbce74c62e15486e449

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 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_info.identifier} #{job_info.slug}"
  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
  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 expect the ruby-clock DSL to be available inside a job, but it is not"
  else
    puts '✅'
  end
end

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

# def schedule.around_trigger(job_info, &job_proc)
#   puts "ruby-clock 1-style around trigger!"
# end

every('2 seconds', blocking: true) do
  begin

    1.times {
      begin
        puts "hello from a stress test for the autonamer"
      end

    }
    # this is a comment!

  end
  # another comment

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-clock-2.0.1 example-app/Clockfile
ruby-clock-2.0.0 example-app/Clockfile
ruby-clock-2.0.0.beta10 example-app/Clockfile
ruby-clock-2.0.0.beta9 example-app/Clockfile