Module: Tacoma::Tool

Extended by:
CacheEnvironment
Defined in:
lib/tacoma/command.rb

Constant Summary collapse

DEFAULT_AWS_REGION =
'eu-west-1'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from CacheEnvironment

environment_cache_path, read_environment_from_cache, update_environment_to_cache

Class Attribute Details

.aws_access_key_idObject

Returns the value of attribute aws_access_key_id.



12
13
14
# File 'lib/tacoma/command.rb', line 12

def aws_access_key_id
  @aws_access_key_id
end

.aws_identity_fileObject

Returns the value of attribute aws_identity_file.



10
11
12
# File 'lib/tacoma/command.rb', line 10

def aws_identity_file
  @aws_identity_file
end

.aws_secret_access_keyObject

Returns the value of attribute aws_secret_access_key.



11
12
13
# File 'lib/tacoma/command.rb', line 11

def aws_secret_access_key
  @aws_secret_access_key
end

.regionObject

Returns the value of attribute region.



13
14
15
# File 'lib/tacoma/command.rb', line 13

def region
  @region
end

.repoObject

Returns the value of attribute repo.



14
15
16
# File 'lib/tacoma/command.rb', line 14

def repo
  @repo
end

.s3cfgObject

Returns the value of attribute s3cfg.



15
16
17
# File 'lib/tacoma/command.rb', line 15

def s3cfg
  @s3cfg
end

Class Method Details

.configObject



19
20
21
22
# File 'lib/tacoma/command.rb', line 19

def config
  filename = File.join(Dir.home, '.tacoma.yml')
  YAML.load_file(filename)
end

.current_environmentObject

Assume there is a ~/.aws/credentials file with a valid format



38
39
40
# File 'lib/tacoma/command.rb', line 38

def current_environment
  read_environment_from_cache
end

.load_vars(environment) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/tacoma/command.rb', line 24

def load_vars(environment)
  return false unless exists?(environment)

  config = Tool.config
  @aws_identity_file = config[environment]['aws_identity_file']
  @aws_secret_access_key = config[environment]['aws_secret_access_key']
  @aws_access_key_id = config[environment]['aws_access_key_id']
  @region = config[environment]['region'] || DEFAULT_AWS_REGION
  @repo = config[environment]['repo']
  @s3cfg = config[environment]['s3cfg'] || {}
  validate_vars
end