Sha256: 01fde0b03158b1147a286b114800c8df255a03a124cc817a540f53ff57788ac6

Contents?: true

Size: 711 Bytes

Versions: 3

Compression:

Stored size: 711 Bytes

Contents

#!/usr/bin/env ruby

require 'ruby-clock'
require 'method_source'

class Rufus::Scheduler::Job
  def identifier
    @identifier ||= begin
      name || handler.source.split("\n").reject(&:empty?).grep_v(/#.*/)[-2].strip
    rescue
      begin
        source_location.join('-')
      rescue
        'error-calculating-job-identifier'
      end
    end
  end
end

include RubyClock

listen_to_signals
prepare_rake
schedule.pause

load ARGV[0] || 'Clockfile'

if defined?(::Rails)
  schedule.instance_eval do
    @old_around_trigger = method :around_trigger
    def around_trigger(job)
      ::Rails.application.reloader.wrap do
        @old_around_trigger.call(job){ yield }
      end
    end
  end
end

run_jobs

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-clock-1.0.0 exe/clock
ruby-clock-0.8.0.rc3 exe/clock
ruby-clock-0.8.0.rc2 exe/clock