Class: Depends::Commands::Base
- Inherits:
-
Object
- Object
- Depends::Commands::Base
- Includes:
- Mixlib::CLI
- Defined in:
- lib/depends/commands/base.rb
Class Method Summary collapse
- .exit!(msg, err = -1)) ⇒ Object
-
.fatal!(msg, err = -1)) ⇒ Object
Log a fatal error message to both STDERR and the Logger, exit the application.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #reconfigure ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/depends/commands/base.rb', line 7 def initialize super trap("TERM") do Depends::Commands::Base.fatal!("SIGTERM received, stopping", 1) end trap("INT") do Depends::Commands::Base.fatal!("SIGINT received, stopping", 2) end processor, platform, *rest = RUBY_PLATFORM.split("-") unless RUBY_PLATFORM =~ /mingw32|mswin32/ trap("QUIT") do Depends::Log.info("SIGQUIT received, call stack:\n " + caller.join("\n ")) end trap("HUP") do Depends::Log.info("SIGHUP received, reconfiguring") reconfigure end end end |
Class Method Details
Instance Method Details
#reconfigure ⇒ Object
33 34 35 36 37 |
# File 'lib/depends/commands/base.rb', line 33 def reconfigure configure_depends configure_logging end |
#run ⇒ Object
39 40 41 42 43 |
# File 'lib/depends/commands/base.rb', line 39 def run reconfigure setup_application run_application end |