Module: Options
- Included in:
- Runner
- Defined in:
- lib/options.rb
Instance Method Summary collapse
- #opts ⇒ Object
- #parse_attach_volume_options(args, defaults = {}) ⇒ Object
- #parse_spinup_options(args, defaults = {}) ⇒ Object
- #parse_ssh_options(args, defaults = {}) ⇒ Object
Instance Method Details
#opts ⇒ Object
5 6 7 |
# File 'lib/options.rb', line 5 def opts @opts ||= OptionParser.new end |
#parse_attach_volume_options(args, defaults = {}) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/options.rb', line 28 def (args, defaults={}) opts.on("-v", "--volume-id VOLUME_ID") { |volume_id| defaults[:volume_id] = volume_id } opts.on("-d", "--device [DEVICE]") { |device| defaults[:device] = device } opts. = "Usage: goec2 attach_volume INSTANCE_NAME [options]" opts.parse!(args) defaults end |
#parse_spinup_options(args, defaults = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/options.rb', line 9 def (args, defaults={}) opts.on('-n', '--name NAME', "The name to use for the instance (note: this is local to this machine. It does not affect Amazon EC2 AT ALL") { |name| defaults[:name] = name } opts.on('-s', '--size SIZE', "The size of the instance per EC2 documentation") { |size| defaults[:instance_size] = size } opts.on('-f', '--user-data-file PATH', "Path to a user data file to pass into the instance") { |path| defaults[:user_data_file] = path } opts.on('-a', '--ami-id AMI_ID', "The AMI ID of the image with which to boot this machine") { |ami_id| defaults[:ami_id] = ami_id } opts.on('-z', '--zone ZONE', "The zone in which to boot this machine per EC2 documentation") { |zone| defaults[:zone] = zone } opts. = "Usage: goec2 spinup [options]" opts.parse!(args) defaults end |
#parse_ssh_options(args, defaults = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/options.rb', line 20 def (args, defaults={}) opts.on("-u", "--user [NAME]", "The user to pass to ssh") { |name| defaults[:user] = name } opts.on("-i", "--private-key [KEY_PATH]", "The path to the SSH private key") { |name| defaults[:keypair_path] = name } opts. = "Usage: goec2 ssh INSTANCE_NAME [options]" opts.parse!(args) defaults end |