class AwsDockerUtils::AwsConfigStorage
Constants
- CONFIG_FILE_PATH
Attributes
config[RW]
Public Class Methods
new()
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 10 def initialize self.config = fetch_config end
Public Instance Methods
clear!()
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 18 def clear! `echo "# AWS credentials:" > #{file_name}` end
persist!(key, value)
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 14 def persist!(key, value) `echo '#{key}: "#{value}"' >> #{file_name}` end
valid?()
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 22 def valid? @config && @config.fetch('access_key') && @config.fetch('secret_key') end
Private Instance Methods
exists?()
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 28 def exists? !`ls #{file_name}`.empty? end
fetch_config()
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 32 def fetch_config clear! unless exists? YAML::load_file(file_name) end
file_name()
click to toggle source
# File lib/aws_docker_utils/aws_config_storage.rb, line 37 def file_name CONFIG_FILE_PATH end