Class: Hercules::Hercules
- Inherits:
-
Object
- Object
- Hercules::Hercules
- Defined in:
- lib/hercules.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(arguments, stdin) ⇒ Hercules
constructor
A new instance of Hercules.
- #run ⇒ Object
Constructor Details
#initialize(arguments, stdin) ⇒ Hercules
Returns a new instance of Hercules.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hercules.rb', line 18 def initialize(arguments, stdin) @arguments = arguments @stdin = stdin # Set default options @options = OpenStruct.new @options.config_file = 'config.yml' @options.verbose = false @options.log_file = nil @options.pid_file = 'hercules.pid' @options.foreground = false @config = nil @pid_file = nil @log = nil end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/hercules.rb', line 16 def @options end |
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/hercules.rb', line 35 def run set_logger read_config be_verbose if @options.verbose # if -f is not present we fork into the background and write hercules.pid @options.foreground ? process_command : daemonize @log.close end |