Class: RokuBuilder::ConfigValidator
- Inherits:
-
Object
- Object
- RokuBuilder::ConfigValidator
- Defined in:
- lib/roku_builder/config_validator.rb
Overview
Validate Config File
Class Method Summary collapse
-
.error_codes ⇒ Array
Error code messages for config validation.
-
.validate_config(config:) ⇒ Array
Validates the roku config.
Class Method Details
.error_codes ⇒ Array
Error code messages for config validation
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/roku_builder/config_validator.rb', line 54 def self.error_codes() [ #===============FATAL ERRORS===============# "Valid Config.", "Devices config is missing.", "Devices default is missing.", "Devices default is not a hash.", "Projects config is missing.", "Projects default is missing.", #5 "Projects default is not a hash.", "A device config is missing its IP address.", "A device config is missing its username.", "A device config is missing its password.", "A project config is missing its app_name.", #10 "A project config is missing its directorty.", "A project config is missing its folders.", "A project config's folders is not an array.", "A project config is missing its files.", "A project config's files is not an array.", #15 "A project stage is missing its branch.", "A project stage is missing its script.", "A project as an invalid stage method.", #===============WARNINGS===============# "A project is missing its stage method." ] end |
.validate_config(config:) ⇒ Array
Validates the roku config
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/roku_builder/config_validator.rb', line 31 def self.validate_config(config:) codes = [] validate_device_structure(codes: codes, config: config) validate_project_structure(codes: codes, config: config) if config[:devices] config[:devices].each {|k,v| next if k == :default validate_device(codes: codes, device: v) } end if config[:projects] config[:projects].each {|project,v| next if project == :default validate_project(codes: codes, project: v) } end codes.uniq! codes.push(0) if codes.empty? codes end |