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.



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

def application_name
  @application_name
end

#application_urlsObject

Returns the value of attribute application_urls.



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

def application_urls
  @application_urls
end

#deployment_channelObject

Returns the value of attribute deployment_channel.



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

def deployment_channel
  @deployment_channel
end

#engineering_channelObject

Returns the value of attribute engineering_channel.



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

def engineering_channel
  @engineering_channel
end

#logentries_tokenObject

Returns the value of attribute logentries_token.



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

def logentries_token
  @logentries_token
end

#slack_webhook_keyObject

Returns the value of attribute slack_webhook_key.



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

def slack_webhook_key
  @slack_webhook_key
end

Class Method Details

.configurationObject



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

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

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

Yields:



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

def configure
  yield(configuration)
  configuration
end

.configure_from_yaml(file_path) ⇒ Object



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

def configure_from_yaml(file_path)
  options = YAML.load(ERB.new(File.read(file_path)).result)
  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



39
40
41
# File 'lib/bb_deploy/config.rb', line 39

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

.set_heroku_fields!(phase) ⇒ Object



32
33
34
35
36
37
# File 'lib/bb_deploy/config.rb', line 32

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