Class: Command
Direct Known Subclasses
Configure, Console, Create, Describe, Destroy, SetPrefix, SetSecurityGroups, Start, Status, Stop, Teardown, VolumesCommand, Wait
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#maws ⇒ Object
Returns the value of attribute maws.
Instance Method Summary collapse
- #add_generic_options(parser) ⇒ Object
- #add_specific_options(parser) ⇒ Object
- #description ⇒ Object
-
#initialize(config) ⇒ Command
constructor
A new instance of Command.
- #instances ⇒ Object
- #process_options ⇒ Object
- #run! ⇒ Object
- #verify_configs ⇒ Object
- #verify_options ⇒ Object
Constructor Details
#initialize(config) ⇒ Command
Returns a new instance of Command.
15 16 17 18 |
# File 'lib/maws/command.rb', line 15 def initialize(config) @config = config @maws = nil end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/maws/command.rb', line 4 def connection @connection end |
#maws ⇒ Object
Returns the value of attribute maws.
4 5 6 |
# File 'lib/maws/command.rb', line 4 def maws @maws end |
Instance Method Details
#add_generic_options(parser) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/maws/command.rb', line 29 def (parser) available_roles = @config.available_roles.join(', ') parser.opt :selection, "Selection of instances any of the following: zones (a, b, c, etc.) indexes (2, 1-10, 5-, -10, *) where * is all existing indexes and blank means all defined in profile role names (available: #{available_roles}) in any order and separated by spaces", :type => :string, :default => nil parser.opt :prefix, "Prefix", :short => '-p', :type => :string, :default => "" parser.opt :region, "Region", :short => '-R', :type => :string, :default => @config.config.default_region end |
#add_specific_options(parser) ⇒ Object
41 42 |
# File 'lib/maws/command.rb', line 41 def (parser) end |
#description ⇒ Object
6 7 8 |
# File 'lib/maws/command.rb', line 6 def description "command - does nothing" end |
#instances ⇒ Object
10 11 12 |
# File 'lib/maws/command.rb', line 10 def instances maws.instances end |
#process_options ⇒ Object
44 45 46 47 |
# File 'lib/maws/command.rb', line 44 def @config.region = @config.command_line.region @config.prefix = @config.command_line.prefix end |
#run! ⇒ Object
24 25 26 |
# File 'lib/maws/command.rb', line 24 def run! puts "generic command does nothing" end |
#verify_configs ⇒ Object
59 60 |
# File 'lib/maws/command.rb', line 59 def verify_configs end |
#verify_options ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/maws/command.rb', line 49 def if @config.command_line.region.blank? Trollop::die "Region must be specified in command line options OR as 'default_region' in #{@config.config.paths.config}" end if @config.command_line.selection.nil? Trollop::die "Must specify a selection of some instances" end end |