31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/baleen/validator.rb', line 31
def validate
unless @project
hl_error "Your baleen.yml is missing the following mandatory section"
hl_warn " :#{@section}"
raise Baleen::Error::Validator::MandatoryMissing
end
mandatory = mandatory_attributes
@project.keys.each do |k|
mandatory.delete k
unless attributes.include? k
hl_error "Your baleen.yml has the following invalid attribute at :#{@section} section"
hl_warn " :#{k}"
return false
end
end
unless mandatory.empty?
hl_error "Following attributes are mandatory at :#{@section} section of baleen.yml"
mandatory.each {|m| hl_warn " :#{m}"}
raise Baleen::Error::Validator::MandatoryMissing
end
true
end
|