Module: Diffend::Configs::Validator

Defined in:
lib/diffend/configs/validator.rb

Overview

Class responsible for validating the config from .diffend.yml

Constant Summary collapse

KNOWN_KEYS =

List of known config keys

{
  project_id: [String],
  shareable_id: [String],
  shareable_key: [String],
  build_path: [String],
  env: [String],
  command: [String],
  ignore_errors?: [TrueClass, FalseClass],
  development?: [TrueClass, FalseClass]
}.freeze

Class Method Summary collapse

Class Method Details

.call(config) ⇒ Object

Parameters:



22
23
24
25
26
27
28
29
30
31
# File 'lib/diffend/configs/validator.rb', line 22

def call(config)
  KNOWN_KEYS.each_key do |key|
    if missing?(config, key)
      config.errors << ErrorMessages.missing_key(key)
      next
    end

    config.errors << ErrorMessages.invalid_key(config, key) if invalid?(config, key)
  end
end