Class: ShootsDeploy::Configuration
- Inherits:
-
Object
- Object
- ShootsDeploy::Configuration
- Defined in:
- lib/shoots_deploy/configuration.rb
Constant Summary collapse
- CONFIG_FILE =
"shoots.yml"
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#main_bucket_name ⇒ Object
Returns the value of attribute main_bucket_name.
-
#region ⇒ Object
Returns the value of attribute region.
-
#root_domain ⇒ Object
Returns the value of attribute root_domain.
-
#secondary_bucket_name ⇒ Object
Returns the value of attribute secondary_bucket_name.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#subdomain_url ⇒ Object
Returns the value of attribute subdomain_url.
Class Method Summary collapse
Instance Method Summary collapse
- #create_config_file ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #s3_website_endpoint ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 13 |
# File 'lib/shoots_deploy/configuration.rb', line 8 def initialize( = {}) @main_bucket_name = [:main_bucket_name] @region = [:region] @secret_key = [:secret_key] @access_key = [:access_key] end |
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def access_key @access_key end |
#main_bucket_name ⇒ Object
Returns the value of attribute main_bucket_name.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def main_bucket_name @main_bucket_name end |
#region ⇒ Object
Returns the value of attribute region.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def region @region end |
#root_domain ⇒ Object
Returns the value of attribute root_domain.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def root_domain @root_domain end |
#secondary_bucket_name ⇒ Object
Returns the value of attribute secondary_bucket_name.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def secondary_bucket_name @secondary_bucket_name end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def secret_key @secret_key end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def subdomain @subdomain end |
#subdomain_url ⇒ Object
Returns the value of attribute subdomain_url.
4 5 6 |
# File 'lib/shoots_deploy/configuration.rb', line 4 def subdomain_url @subdomain_url end |
Class Method Details
.initialize_from_file ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/shoots_deploy/configuration.rb', line 15 def self.initialize_from_file configs = YAML.load_file(CONFIG_FILE) new({ main_bucket_name: configs['bucket_name'], region: configs['bucket_region'], secret_key: configs['secret_key'], access_key: configs['access_key'] }) end |
Instance Method Details
#create_config_file ⇒ Object
25 26 27 28 |
# File 'lib/shoots_deploy/configuration.rb', line 25 def create_config_file config_file = File.new(CONFIG_FILE, "w") config_file.puts("bucket_name: '#{main_bucket_name}'\nbucket_region: '#{region}'\naccess_key: '#{access_key}'\nsecret_key: '#{secret_key}'\n") end |
#s3_website_endpoint ⇒ Object
30 31 32 |
# File 'lib/shoots_deploy/configuration.rb', line 30 def s3_website_endpoint "#{main_bucket_name}.s3-website-#{region}.amazonaws.com" end |