Class: Nabokov::NabokovfileContentValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/nabokov/core/nabokovfile_content_validator.rb

Overview

This class is responsible for nabokovfile content validation The validation rules are for localizations_repo and project_repo settings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nabokovfile_hash) ⇒ NabokovfileContentValidator

Returns a new instance of NabokovfileContentValidator.



10
11
12
# File 'lib/nabokov/core/nabokovfile_content_validator.rb', line 10

def initialize(nabokovfile_hash)
  self.nabokovfile_hash = nabokovfile_hash
end

Instance Attribute Details

#nabokovfile_hashObject

Returns the value of attribute nabokovfile_hash.



8
9
10
# File 'lib/nabokov/core/nabokovfile_content_validator.rb', line 8

def nabokovfile_hash
  @nabokovfile_hash
end

Instance Method Details

#validateObject

Performs validation First rule: localizations_repo should be the type of Hash

localizations_repo_url should be valid URL with secure https scheme

Second rule: project_repo should be the type of Hash

project localizations_key should be the of Hash
project_localization_file_paths should point to existed files
project_local_path should point to valid folder


21
22
23
24
# File 'lib/nabokov/core/nabokovfile_content_validator.rb', line 21

def validate
  validate_localizations_repo
  validate_project_repo
end