Add logfile option

This commit is contained in:
Dzmitry Plashchynski
2015-03-03 19:01:33 +02:00
parent 9675fc3517
commit 0ead66f626
4 changed files with 16 additions and 2 deletions

View File

@@ -42,9 +42,13 @@ module Crono
OptionParser.new do |opts|
opts.banner = "Usage: crono [options]"
opts.on("-c", "--cronotab cronotab.rb", "Cronotab file (Default: #{Crono.config.cronotab})") do |cronotab|
opts.on("-C", "--cronotab PATH", "Path to cronotab file (Default: #{Crono.config.cronotab})") do |cronotab|
Crono.config.cronotab = cronotab
end
opts.on("-L", "--logfile PATH", "Path to writable logfile (Default: #{Crono.config.logfile})") do |logfile|
Crono.config.logfile = logfile
end
end.parse!(argv)
end
end

View File

@@ -1,14 +1,17 @@
module Crono
class Config
CRONOTAB = "config/cronotab.rb"
include Singleton
CRONOTAB = "config/cronotab.rb"
LOGFILE = "log/crono.rb"
attr_accessor :schedule
attr_accessor :cronotab
attr_accessor :logfile
def initialize
self.schedule = Schedule.new
self.cronotab = CRONOTAB
self.logfile = LOGFILE
end
end

2
lib/crono/logging.rb Normal file
View File

@@ -0,0 +1,2 @@
module Crono
end