Class: ShootsDeploy::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/shoots_deploy/configuration.rb

Constant Summary collapse

CONFIG_FILE =
"shoots.yml"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(options = {})
  @main_bucket_name = options[:main_bucket_name]
  @region = options[:region]
  @secret_key = options[:secret_key]
  @access_key = options[:access_key]
end

Instance Attribute Details

#access_keyObject

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_nameObject

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

#regionObject

Returns the value of attribute region.



4
5
6
# File 'lib/shoots_deploy/configuration.rb', line 4

def region
  @region
end

#root_domainObject

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_nameObject

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_keyObject

Returns the value of attribute secret_key.



4
5
6
# File 'lib/shoots_deploy/configuration.rb', line 4

def secret_key
  @secret_key
end

#subdomainObject

Returns the value of attribute subdomain.



4
5
6
# File 'lib/shoots_deploy/configuration.rb', line 4

def subdomain
  @subdomain
end

#subdomain_urlObject

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_fileObject



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_fileObject



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_endpointObject



30
31
32
# File 'lib/shoots_deploy/configuration.rb', line 30

def s3_website_endpoint
  "#{main_bucket_name}.s3-website-#{region}.amazonaws.com"
end