Class: BbDeploy::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bb_deploy/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#application_nameObject

Returns the value of attribute application_name.



5
6
7
# File 'lib/bb_deploy/config.rb', line 5

def application_name
  @application_name
end

#application_urlsObject

Returns the value of attribute application_urls.



5
6
7
# File 'lib/bb_deploy/config.rb', line 5

def application_urls
  @application_urls
end

#deployment_channelObject

Returns the value of attribute deployment_channel.



5
6
7
# File 'lib/bb_deploy/config.rb', line 5

def deployment_channel
  @deployment_channel
end

#engineering_channelObject

Returns the value of attribute engineering_channel.



5
6
7
# File 'lib/bb_deploy/config.rb', line 5

def engineering_channel
  @engineering_channel
end

#logentries_tokenObject

Returns the value of attribute logentries_token.



5
6
7
# File 'lib/bb_deploy/config.rb', line 5

def logentries_token
  @logentries_token
end

#slack_webhook_keyObject

Returns the value of attribute slack_webhook_key.



5
6
7
# File 'lib/bb_deploy/config.rb', line 5

def slack_webhook_key
  @slack_webhook_key
end

Class Method Details

.configurationObject



13
14
15
# File 'lib/bb_deploy/config.rb', line 13

def configuration
  @configuration ||= BbDeploy::Config.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



17
18
19
# File 'lib/bb_deploy/config.rb', line 17

def configure
  yield(configuration)
end

.configure_from_yaml(filepath) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/bb_deploy/config.rb', line 21

def configure_from_yaml(filepath)
  options = YAML.load_file(filepath)
  configure do |config|
    %w(application_name application_urls deployment_channel engineering_channel).each do |key|
      config.send("#{key}=", options[key])
    end
  end
end

.method_missing(method, *args) ⇒ Object



37
38
39
# File 'lib/bb_deploy/config.rb', line 37

def method_missing(method, *args)
  configuration.send(method, *args)
end

.set_heroku_fields!(phase:) ⇒ Object



30
31
32
33
34
35
# File 'lib/bb_deploy/config.rb', line 30

def set_heroku_fields!(phase:)
  configure do |config|
    config.logentries_token  = BbDeploy::Heroku.get_variable(phase, 'DEPLOY_LOG_TOKEN').freeze
    config.slack_webhook_key = BbDeploy::Heroku.get_variable(phase, 'SLACK_WEBHOOK').freeze
  end
end