Class: AwsEnvironmentConfig
- Inherits:
-
Object
- Object
- AwsEnvironmentConfig
- Defined in:
- lib/ebx/aws_environment_config.rb
Class Method Summary collapse
- .config_exists? ⇒ Boolean
- .config_path ⇒ Object
- .create_dir(name) ⇒ Object
- .init_config ⇒ Object
- .read_config ⇒ Object
Class Method Details
.config_exists? ⇒ Boolean
10 11 12 |
# File 'lib/ebx/aws_environment_config.rb', line 10 def config_exists? FileTest.file?(config_path) end |
.config_path ⇒ Object
6 7 8 |
# File 'lib/ebx/aws_environment_config.rb', line 6 def config_path File.("eb/environment.yml", Dir.pwd) end |
.create_dir(name) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/ebx/aws_environment_config.rb', line 29 def create_dir(name) dir = File.(name, Dir.pwd) raise "#{name} exists and is not a directory" if FileTest.file?(dir) unless FileTest.directory?(dir) Dir.mkdir(dir) end end |
.init_config ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ebx/aws_environment_config.rb', line 18 def init_config create_dir('.ebextentions') create_dir('eb') unless FileTest.file?(config_path) FileUtils.cp(File.('../../generators/templates/environment.yml', __FILE__), config_path) end read_config end |
.read_config ⇒ Object
14 15 16 |
# File 'lib/ebx/aws_environment_config.rb', line 14 def read_config @config ||= YAML.load_file(config_path) end |