Module: AWSConfig::Store
- Included in:
- AWSConfig
- Defined in:
- lib/aws_config/store.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/aws_config/store.rb', line 47
def method_missing(id, *args)
if has_profile?(id)
self[id]
else
super
end
end
|
Instance Method Details
#[](profile) ⇒ Object
35
36
37
|
# File 'lib/aws_config/store.rb', line 35
def [](profile)
profiles[profile.to_s]
end
|
#config_file ⇒ Object
17
18
19
|
# File 'lib/aws_config/store.rb', line 17
def config_file
@config_file || ENV["AWS_CONFIG_FILE"] || File.join(ENV["HOME"], ".aws/config")
end
|
#config_file=(path) ⇒ Object
21
22
23
24
|
# File 'lib/aws_config/store.rb', line 21
def config_file=(path)
@config_file = path
@profiles = nil
end
|
#credentials_file ⇒ Object
26
27
28
|
# File 'lib/aws_config/store.rb', line 26
def credentials_file
@credentials_file || ENV["AWS_SHARED_CREDENTIALS_FILE"] || File.join(ENV["HOME"], ".aws/credentials")
end
|
#credentials_file=(path) ⇒ Object
30
31
32
33
|
# File 'lib/aws_config/store.rb', line 30
def credentials_file=(path)
@credentials_file = path
@profiles = nil
end
|
#has_profile?(profile) ⇒ Boolean
39
40
41
|
# File 'lib/aws_config/store.rb', line 39
def has_profile?(profile)
profiles.has_key?(profile.to_s)
end
|
#profiles ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/aws_config/store.rb', line 4
def profiles
@profiles ||= begin
if File.exist?(config_file)
profile_resolver = ProfileResolver.new
profile_resolver.add Parser.parse(File.read(credentials_file), true)
profile_resolver.add Parser.parse(File.read(config_file))
profile_resolver.profiles
else
Hash.new
end
end
end
|
#respond_to?(id, include_all = false) ⇒ Boolean
43
44
45
|
# File 'lib/aws_config/store.rb', line 43
def respond_to?(id, include_all = false)
has_profile?(id) || super
end
|