mirror of
https://github.com/plashchynski/crono.git
synced 2026-06-12 09:44:27 +02:00
Add Crono::Cronotab to process cronotab
This commit is contained in:
+1
-1
@@ -21,6 +21,7 @@ module Crono
|
||||
|
||||
write_pid
|
||||
load_rails
|
||||
Cronotab.process(File.expand_path(config.cronotab))
|
||||
print_banner
|
||||
|
||||
check_jobs
|
||||
@@ -71,7 +72,6 @@ module Crono
|
||||
require 'rails'
|
||||
require File.expand_path('config/environment.rb')
|
||||
::Rails.application.eager_load!
|
||||
require File.expand_path(config.cronotab)
|
||||
end
|
||||
|
||||
def check_jobs
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
module Crono
|
||||
class Cronotab
|
||||
def self.process(cronotab_path = nil)
|
||||
cronotab_path ||= ENV['CRONOTAB'] || (defined?(Rails) &&
|
||||
File.join(Rails.root, Config::CRONOTAB))
|
||||
fail 'No cronotab defined' unless cronotab_path
|
||||
require cronotab_path
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user