Class: BigBrother::CLI
- Inherits:
-
Rack::Server
- Object
- Rack::Server
- BigBrother::CLI
- Defined in:
- lib/big_brother/cli.rb
Defined Under Namespace
Classes: Options
Instance Method Summary collapse
- #default_options ⇒ Object
-
#initialize(options = nil) ⇒ CLI
constructor
A new instance of CLI.
- #opt_parser ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ CLI
Returns a new instance of CLI.
40 41 42 |
# File 'lib/big_brother/cli.rb', line 40 def initialize( = nil) super end |
Instance Method Details
#default_options ⇒ Object
77 78 79 80 81 82 |
# File 'lib/big_brother/cli.rb', line 77 def super.merge( :big_brother_config => '/etc/big_brother.conf', :config_dir => '/etc/big_brother' ) end |
#opt_parser ⇒ Object
44 45 46 |
# File 'lib/big_brother/cli.rb', line 44 def opt_parser Options.new end |
#start ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/big_brother/cli.rb', line 48 def start unless File.exists?([:big_brother_config]) puts "Could not find #{[:big_brother_config]}. Specify correct location with -c file" exit 1 end BigBrother.logger.level = BigBrother::Logger::Level::DEBUG if [:verbose] BigBrother.config_dir = [:config_dir] Thin::Callbacks.after_connect do EM.syslog_setup('0.0.0.0', 514) BigBrother.logger.info "Starting big brother on port #{[:Port]}" EM.synchrony do BigBrother.configure([:big_brother_config]) BigBrother.start_ticker! end Signal.trap("HUP") do EM.synchrony do BigBrother.logger.info "HUP trapped. Reconfiguring big brother" BigBrother.reconfigure end end end super end |