Print schedule on load

This commit is contained in:
Dzmitry Plashchynski
2015-03-05 14:06:40 +02:00
parent 007989fa2c
commit 8ce3673368
3 changed files with 9 additions and 5 deletions

View File

@@ -48,6 +48,10 @@ module Crono
def print_banner
Crono.logger.info "Loading Crono #{Crono::VERSION}"
Crono.logger.info "Running in #{RUBY_DESCRIPTION}"
Crono.logger.info "Schedule:"
Crono.schedule.jobs.each do |job|
Crono.logger.info job.description
end
end
def load_rails

View File

@@ -1,13 +1,13 @@
module Crono
class Schedule
attr_accessor :schedule
attr_accessor :jobs
def initialize
self.schedule = []
self.jobs = []
end
def add(job)
schedule << job
jobs << job
end
def next
@@ -16,7 +16,7 @@ module Crono
private
def queue
schedule.sort { |a,b| a.next <=> b.next }
jobs.sort { |a,b| a.next <=> b.next }
end
end
end