Module: Roark::CLI::Shared
Instance Method Summary collapse
- #aws ⇒ Object
- #command_name ⇒ Object
- #help ⇒ Object
- #validate_account_ids_format ⇒ Object
- #validate_required_options(options) ⇒ Object
Instance Method Details
#aws ⇒ Object
30 31 32 33 34 |
# File 'lib/roark/cli/shared.rb', line 30 def aws Roark::Aws::Connection.new :access_key_id => @options[:access_key_id], :aws_secret_key => @options[:secret_access_key], :region => @options[:region] end |
#command_name ⇒ Object
22 23 24 |
# File 'lib/roark/cli/shared.rb', line 22 def command_name self.class.name.split('::').last.downcase end |
#help ⇒ Object
26 27 28 |
# File 'lib/roark/cli/shared.rb', line 26 def help puts option_parser.help end |
#validate_account_ids_format ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/roark/cli/shared.rb', line 13 def validate_account_ids_format @options[:account_ids].each do |a| unless a =~ /^[0-9]{12}$/ @logger.error "Account '#{a}' invalid. IDs must be 12 digits without dashes." exit 1 end end end |
#validate_required_options(options) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/roark/cli/shared.rb', line 4 def () .each do |o| unless @options[o] @logger.error "Option '#{o.to_s}' required." exit 1 end end end |