Class: Daemon::Command
- Inherits:
-
Object
- Object
- Daemon::Command
- Includes:
- UserInterface
- Defined in:
- lib/onapp/engine/command.rb,
lib/onapp/engine/command/options.rb,
lib/onapp/engine/command/base_command.rb,
lib/onapp/engine/command/stop_command.rb,
lib/onapp/engine/command/start_command.rb,
lib/onapp/engine/command/status_command.rb,
lib/onapp/engine/command/user_interface.rb
Defined Under Namespace
Modules: UserInterface Classes: BaseCommand, Options, StartCommand, StatusCommand, StopCommand
Constant Summary
- START =
'start'.freeze
- STOP =
'stop'.freeze
- STATUS =
'status'.freeze
- COMMANDS =
[START, STOP, STATUS]
Instance Attribute Summary
Attributes included from UserInterface
Instance Method Summary (collapse)
-
- (Command) initialize(argv, out = $stdout, err = $stderr)
constructor
A new instance of Command.
-
- (Object) run
Parses options and launches command.
Methods included from UserInterface
Constructor Details
- (Command) initialize(argv, out = $stdout, err = $stderr)
Returns a new instance of Command
25 26 27 |
# File 'lib/onapp/engine/command.rb', line 25 def initialize(argv, out = $stdout, err = $stderr) @options = Options.new(argv, out, err) end |
Instance Method Details
- (Object) run
Parses options and launches command
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/onapp/engine/command.rb', line 30 def run exit(1) unless @options.parse! case @options.command when START StartCommand.new(@options).execute when STOP StopCommand.new(@options).execute when STATUS StatusCommand.new(@options).execute end end |