Module: Roark::CLI::Shared

Included in:
Create, Destroy
Defined in:
lib/roark/cli/shared.rb

Instance Method Summary collapse

Instance Method Details

#awsObject



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_nameObject



22
23
24
# File 'lib/roark/cli/shared.rb', line 22

def command_name
  self.class.name.split('::').last.downcase
end

#helpObject



26
27
28
# File 'lib/roark/cli/shared.rb', line 26

def help
  puts option_parser.help
end

#validate_account_ids_formatObject



13
14
15
16
17
18
19
20
# File 'lib/roark/cli/shared.rb', line 13

def 
  @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 validate_required_options(options)
  options.each do |o|
    unless @options[o]
      @logger.error "Option '#{o.to_s}' required."
      exit 1
    end
  end
end