Class: HerokuFormationValidator::Plugins::Variables

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku_formation_validator/plugins/variables.rb

Class Method Summary collapse

Class Method Details

.run(heroku_api, app, values) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/heroku_formation_validator/plugins/variables.rb', line 5

def self.run(heroku_api, app, values)
  errors = []
  config = heroku_api.configvars(app)
  values.each do |key, value|
    if value.nil?
      if config.has_key?(key)
        errors << "\"#{key}\" is defined"
      end
    elsif !config.has_key?(key)
      errors << "\"#{key}\" is not defined"
    elsif config[key] != value
      errors << "\"#{key}\" doesn't match. expected \"#{value}\" but \"#{config[key]}\""
    end
  end
  errors
end