Class: Elastic::Beanstalk::Config
- Inherits:
-
Dry::Config::Base
- Object
- Dry::Config::Base
- Elastic::Beanstalk::Config
- Includes:
- Singleton
- Defined in:
- lib/elastic/beanstalk/config.rb
Overview
If this behavior of merging arrays or the defaults are somehow un-sensible, file an issue and we’ll revisit it.
Instance Method Summary collapse
- #find_inactive_setting(name) ⇒ Object
- #find_inactive_setting_value(name) ⇒ Object
- #find_option_setting(name) ⇒ Object
- #find_option_setting_value(name) ⇒ Object
- #inactive_settings ⇒ Object
-
#initialize(options = {}) ⇒ Config
constructor
it’s a singleton, thus implemented as a self-extended module extend self.
- #load!(environment = nil, filename = resolve_path('config/eb.yml')) ⇒ Object
-
#option_settings ⇒ Object
custom methods for the specifics of eb.yml settings.
- #resolve_path(relative_path) ⇒ Object
- #set_option(namespace, option_name, value) ⇒ Object
- #to_option_setting(namespace, option_name, value) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
it’s a singleton, thus implemented as a self-extended module extend self
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/elastic/beanstalk/config.rb', line 21 def initialize( = {}) # seed the sensible defaults here = { symbolize: true, interpolation: false, default_configuration: { environment: nil, secrets_dir: '~/.aws', disallow_environments: %w(cucumber test), strategy: :blue_green, package: { dir: 'pkg', verbose: false, includes: %w(**/* .ebextensions/**/*), exclude_files: [], exclude_dirs: %w(pkg tmp log test-reports) }, options: {}, inactive: {} } }.merge() super() end |
Instance Method Details
#find_inactive_setting(name) ⇒ Object
87 88 89 |
# File 'lib/elastic/beanstalk/config.rb', line 87 def find_inactive_setting(name) find_setting(name, inactive) end |
#find_inactive_setting_value(name) ⇒ Object
91 92 93 |
# File 'lib/elastic/beanstalk/config.rb', line 91 def find_inactive_setting_value(name) find_setting_value(name, inactive) end |
#find_option_setting(name) ⇒ Object
79 80 81 |
# File 'lib/elastic/beanstalk/config.rb', line 79 def find_option_setting(name) find_setting(name, ) end |
#find_option_setting_value(name) ⇒ Object
83 84 85 |
# File 'lib/elastic/beanstalk/config.rb', line 83 def find_option_setting_value(name) find_setting_value(name, ) end |
#inactive_settings ⇒ Object
66 67 68 |
# File 'lib/elastic/beanstalk/config.rb', line 66 def inactive_settings generate_settings(inactive) end |
#load!(environment = nil, filename = resolve_path('config/eb.yml')) ⇒ Object
46 47 48 |
# File 'lib/elastic/beanstalk/config.rb', line 46 def load!(environment = nil, filename = resolve_path('config/eb.yml')) super(environment, filename) end |
#option_settings ⇒ Object
custom methods for the specifics of eb.yml settings
62 63 64 |
# File 'lib/elastic/beanstalk/config.rb', line 62 def option_settings generate_settings() end |
#resolve_path(relative_path) ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/elastic/beanstalk/config.rb', line 51 def resolve_path(relative_path) if defined?(Rails) Rails.root.join(relative_path) elsif defined?(Rake.original_dir) File.(relative_path, Rake.original_dir) else File.(relative_path, Dir.pwd) end end |
#set_option(namespace, option_name, value) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/elastic/beanstalk/config.rb', line 70 def set_option(namespace, option_name, value) = to_option_setting(namespace, option_name, value) namespace = [:namespace].to_sym option_name = [:option_name].to_sym [namespace] = {} if [namespace].nil? [namespace][option_name] = value end |
#to_option_setting(namespace, option_name, value) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/elastic/beanstalk/config.rb', line 95 def to_option_setting(namespace, option_name, value) erb_value = "#{value}".scan(/<%=.*%>/).first unless erb_value.nil? value = ERB.new(erb_value).result end { :'namespace' => "#{namespace}", :'option_name' => "#{option_name}", :'value' => "#{value}" } end |