Class: Kumo::Commands
- Inherits:
-
Object
- Object
- Kumo::Commands
- Defined in:
- lib/kumo/commands.rb
Overview
Commands for managing instances
Class Method Summary collapse
-
.dns(global_options, options, args) ⇒ Object
Print the public DNS of an instance.
-
.launch(global_options, options, args) ⇒ Object
Launch an instance.
-
.list(global_options, options, args) ⇒ Object
List all instances with the same tag.
-
.start(global_options, options, args) ⇒ Object
Start an instance.
-
.stop(global_options, options, args) ⇒ Object
Stop an instance.
-
.terminate(global_options, options, args) ⇒ Object
Terminate an instance.
Class Method Details
.dns(global_options, options, args) ⇒ Object
Print the public DNS of an instance
Examples:
kumo dns
72 73 74 75 76 77 78 79 |
# File 'lib/kumo/commands.rb', line 72 def dns(, , args) Kumo.initialize_config(File.([:'config-file']), (), parse_sets()) if args[0] puts Kumo::Server.find_by_id(args[0]).public_dns else puts last_server.public_dns end end |
.launch(global_options, options, args) ⇒ Object
Launch an instance
Examples:
kumo launch
20 21 22 23 |
# File 'lib/kumo/commands.rb', line 20 def launch(, , args) Kumo.initialize_config(File.([:'config-file']), (), parse_sets()) puts Kumo::Server.launch.id end |
.list(global_options, options, args) ⇒ Object
List all instances with the same tag
Example:
kumo list
10 11 12 13 |
# File 'lib/kumo/commands.rb', line 10 def list(, , args) Kumo.initialize_config(File.([:'config-file']), (), parse_sets()) Kumo::Server.find_all.each { |server| puts "%-15s%-15s%-15s%-30s%-45s" % [server.id, server.tag, server.state, server.launch_time.localtime, server.public_dns] } end |
.start(global_options, options, args) ⇒ Object
Start an instance
Examples:
kumo start
44 45 46 47 48 49 50 51 |
# File 'lib/kumo/commands.rb', line 44 def start(, , args) Kumo.initialize_config(File.([:'config-file']), (), parse_sets()) if args[0] Kumo::Server.find_by_id(args[0]).start else last_server.start end end |
.stop(global_options, options, args) ⇒ Object
Stop an instance
Examples:
kumo stop
58 59 60 61 62 63 64 65 |
# File 'lib/kumo/commands.rb', line 58 def stop(, , args) Kumo.initialize_config(File.([:'config-file']), (), parse_sets()) if args[0] Kumo::Server.find_by_id(args[0]).stop else last_server.stop end end |
.terminate(global_options, options, args) ⇒ Object
Terminate an instance
Examples:
kumo terminate
30 31 32 33 34 35 36 37 |
# File 'lib/kumo/commands.rb', line 30 def terminate(, , args) Kumo.initialize_config(File.([:'config-file']), (), parse_sets()) if args[0] Kumo::Server.find_by_id(args[0]).terminate else last_server.terminate end end |