Class: OpzWorks::Config
- Inherits:
-
Object
- Object
- OpzWorks::Config
- Defined in:
- lib/opzworks/config.rb
Instance Attribute Summary collapse
-
#aws_profile ⇒ Object
readonly
Returns the value of attribute aws_profile.
-
#aws_region ⇒ Object
readonly
Returns the value of attribute aws_region.
-
#berks_base_path ⇒ Object
readonly
Returns the value of attribute berks_base_path.
-
#berks_github_org ⇒ Object
readonly
Returns the value of attribute berks_github_org.
-
#berks_repository_path ⇒ Object
readonly
Returns the value of attribute berks_repository_path.
-
#berks_s3_bucket ⇒ Object
readonly
Returns the value of attribute berks_s3_bucket.
-
#berks_tarball_name ⇒ Object
readonly
Returns the value of attribute berks_tarball_name.
-
#ssh_user_name ⇒ Object
readonly
Returns the value of attribute ssh_user_name.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/opzworks/config.rb', line 13 def initialize file = ENV['AWS_CONFIG_FILE'] || "#{ENV['HOME']}/.aws/config" # abort unless required conditions are met abort "Config file #{file} not found, exiting!".foreground(:red) unless File.exist? file ini = IniFile.load(file) abort "Could not find [opzworks] config block in #{file}, exiting!".foreground(:red) if ini['opzworks'].empty? # set the region and the profile we want to pick up from ~/.aws/credentials @aws_profile = ENV['AWS_PROFILE'] || 'default' @aws_region = ENV['AWS_REGION'] || ini[@aws_profile]['region'] @ssh_user_name = ini['opzworks']['ssh-user-name'].strip unless ini['opzworks']['ssh-user-name'].nil? @berks_repository_path = ini['opzworks']['berks-repository-path'].strip unless ini['opzworks']['berks-repository-path'].nil? @berks_base_path = ini['opzworks']['berks-base-path'].strip unless ini['opzworks']['berks-base-path'].nil? @berks_s3_bucket = ini['opzworks']['berks-s3-bucket'].strip unless ini['opzworks']['berks-s3-bucket'].nil? @berks_tarball_name = ini['opzworks']['berks-tarball-name'].strip unless ini['opzworks']['berks-tarball-name'].nil? @berks_github_org = ini['opzworks']['berks-github-org'].strip unless ini['opzworks']['berks-github-org'].nil? end |
Instance Attribute Details
#aws_profile ⇒ Object (readonly)
Returns the value of attribute aws_profile.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def aws_profile @aws_profile end |
#aws_region ⇒ Object (readonly)
Returns the value of attribute aws_region.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def aws_region @aws_region end |
#berks_base_path ⇒ Object (readonly)
Returns the value of attribute berks_base_path.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def berks_base_path @berks_base_path end |
#berks_github_org ⇒ Object (readonly)
Returns the value of attribute berks_github_org.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def berks_github_org @berks_github_org end |
#berks_repository_path ⇒ Object (readonly)
Returns the value of attribute berks_repository_path.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def berks_repository_path @berks_repository_path end |
#berks_s3_bucket ⇒ Object (readonly)
Returns the value of attribute berks_s3_bucket.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def berks_s3_bucket @berks_s3_bucket end |
#berks_tarball_name ⇒ Object (readonly)
Returns the value of attribute berks_tarball_name.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def berks_tarball_name @berks_tarball_name end |
#ssh_user_name ⇒ Object (readonly)
Returns the value of attribute ssh_user_name.
10 11 12 |
# File 'lib/opzworks/config.rb', line 10 def ssh_user_name @ssh_user_name end |