Class: OAR::Scripting::Application
- Inherits:
-
Object
- Object
- OAR::Scripting::Application
- Includes:
- Mixlib::CLI
- Defined in:
- lib/oar/scripting/application.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Graph
Class Method Summary collapse
-
.exit!(msg, err = -1)) ⇒ Object
- Definition
-
fatal!(msg, err = -1).
- .fatal!(msg, err = -1)) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
-
#run ⇒ Object
- Definition
-
initialize.
-
#run_application ⇒ Object
- Definition
-
run.
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/oar/scripting/application.rb', line 12 def initialize super trap("TERM") do OAR::Scripting::Application.fatal!("SIGTERM received, stopping", 1) end trap("INT") do OAR::Scripting::Application.fatal!("SIGINT received, stopping", 2) end end |
Class Method Details
.exit!(msg, err = -1)) ⇒ Object
- Definition
-
fatal!(msg, err = -1)
42 43 44 |
# File 'lib/oar/scripting/application.rb', line 42 def exit!(msg, err = -1) Process.exit err end |
.fatal!(msg, err = -1)) ⇒ Object
37 38 39 40 |
# File 'lib/oar/scripting/application.rb', line 37 def fatal!(msg, err = -1) STDERR.puts("FATAL: #{msg}") Process.exit err end |
Instance Method Details
#run ⇒ Object
- Definition
-
initialize
24 25 26 27 28 29 30 |
# File 'lib/oar/scripting/application.rb', line 24 def run # use parse_options from Mixlib # Run application run_application end |
#run_application ⇒ Object
- Definition
-
run
32 33 34 |
# File 'lib/oar/scripting/application.rb', line 32 def run_application raise "#{self.to_s}: you must override run_application" end |