Class: Fission::Command::Stop
- Inherits:
-
Fission::Command
- Object
- Fission::Command
- Fission::Command::Stop
- Defined in:
- lib/fission/command/stop.rb
Instance Attribute Summary
Attributes inherited from Fission::Command
Instance Method Summary collapse
Methods inherited from Fission::Command
#command_name, help, #initialize, #ui
Methods included from Fission::CommandHelpers
#incorrect_arguments, #parse_arguments
Constructor Details
This class inherits a constructor from Fission::Command
Instance Method Details
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fission/command/stop.rb', line 5 def execute super incorrect_arguments unless @args.count == 1 vm = VM.new @args.first output "Stopping '#{vm.name}'" response = vm.stop if response.successful? output "VM '#{vm.name}' stopped" else output_and_exit "There was an error stopping the VM. The error was:\n#{response.}", response.code end end |
#option_parser ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/fission/command/stop.rb', line 21 def option_parser optparse = OptionParser.new do |opts| opts. = "Usage: fission stop TARGET_VM" opts.separator '' opts.separator 'Stop TARGET_VM.' end optparse end |
#summary ⇒ Object
31 32 33 |
# File 'lib/fission/command/stop.rb', line 31 def summary 'Stop a VM' end |