Class: FlowdockBuildNotifier::Configuration

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

Constant Summary collapse

FLOWDOCK_CONFIG =
'.flowdock_build_notifier.yml'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Configuration

Returns a new instance of Configuration.



16
17
18
19
20
21
22
23
24
25
# File 'lib/flowdock_build_notifier/configuration.rb', line 16

def initialize(config)
  @flowdock_user_token = ENV['FLOWDOCK_USER_TOKEN'] || config.fetch('flowdock_user_token')
  @flow_name= config.fetch('flow_name')

  @email_map = config.fetch('email_map') { {} }

  @teamcity_url = config.fetch('teamcity_url')
  @teamcity_user = ENV['FLOWDOCK_NOTIFIER_TEAMCITY_USER'] || config.fetch('teamcity_user')
  @teamcity_password = ENV['FLOWDOCK_NOTIFIER_TEAMCITY_PASSWORD'] || config.fetch('teamcity_password')
end

Instance Attribute Details

#email_mapObject (readonly)

Returns the value of attribute email_map.



13
14
15
# File 'lib/flowdock_build_notifier/configuration.rb', line 13

def email_map
  @email_map
end

#flow_nameObject (readonly)

Returns the value of attribute flow_name.



13
14
15
# File 'lib/flowdock_build_notifier/configuration.rb', line 13

def flow_name
  @flow_name
end

#flowdock_user_tokenObject (readonly)

Returns the value of attribute flowdock_user_token.



13
14
15
# File 'lib/flowdock_build_notifier/configuration.rb', line 13

def flowdock_user_token
  @flowdock_user_token
end

#teamcity_passwordObject (readonly)

Returns the value of attribute teamcity_password.



13
14
15
# File 'lib/flowdock_build_notifier/configuration.rb', line 13

def teamcity_password
  @teamcity_password
end

#teamcity_urlObject (readonly)

Returns the value of attribute teamcity_url.



13
14
15
# File 'lib/flowdock_build_notifier/configuration.rb', line 13

def teamcity_url
  @teamcity_url
end

#teamcity_userObject (readonly)

Returns the value of attribute teamcity_user.



13
14
15
# File 'lib/flowdock_build_notifier/configuration.rb', line 13

def teamcity_user
  @teamcity_user
end

Class Method Details

.loadObject



7
8
9
10
11
# File 'lib/flowdock_build_notifier/configuration.rb', line 7

def self.load
  new(YAML.load_file(FLOWDOCK_CONFIG))
rescue Errno::ENOENT
  raise "#{FLOWDOCK_CONFIG} configuration not found"
end