Module: Lamma::SharedHelpers
- Included in:
- CLI::Deploy, CLI::Init, CLI::Rollback
- Defined in:
- lib/lamma/shared_helpers.rb
Constant Summary collapse
- DEFAULT_PROFILE =
'default'
Instance Method Summary collapse
- #ini_config(profile = DEFAULT_PROFILE) ⇒ Object
- #ini_credentials(profile = DEFAULT_PROFILE) ⇒ Object
- #region_or_raise(profile = DEFAULT_PROFILE) ⇒ Object
- #search_conf_path(from) ⇒ Object
Instance Method Details
#ini_config(profile = DEFAULT_PROFILE) ⇒ Object
9 10 11 |
# File 'lib/lamma/shared_helpers.rb', line 9 def ini_config(profile=DEFAULT_PROFILE) load_inifile(File.(File.join('~', '.aws', 'config')), profile) end |
#ini_credentials(profile = DEFAULT_PROFILE) ⇒ Object
13 14 15 |
# File 'lib/lamma/shared_helpers.rb', line 13 def ini_credentials(profile=DEFAULT_PROFILE) load_inifile(File.(File.join('~', '.aws', 'credentials')), profile) end |
#region_or_raise(profile = DEFAULT_PROFILE) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lamma/shared_helpers.rb', line 17 def region_or_raise(profile=DEFAULT_PROFILE) region = ENV['AWS_REGION'] || ENV['AWS_DEFAULT_REGION'] || ini_config(profile)['region'] if region return region else raise Exception.new("Region must be specified by either AWS_REGION, AWS_DEFAULT_REGION or ~/.aws/config file") end end |
#search_conf_path(from) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lamma/shared_helpers.rb', line 29 def search_conf_path(from) bn = File.basename(File.(from)) dn = File.dirname(File.(from)) pn = Pathname(dn) while pn != pn.parent cp = File.join(pn, bn) if File.exist?(cp) return cp end pn = pn.parent end '' end |