forked from 2factorauth/twofactorauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.rb
36 lines (31 loc) · 951 Bytes
/
verify.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Load Yaml
require 'yaml'
begin
# Load each section, check for errors such as invalid syntax
# as well as if an image is missing
main = YAML.load_file('_data/main.yml')
main["sections"].each do |section|
data = YAML.load_file('_data/' + section["id"] + '.yml')
data['websites'].each do |website|
unless File.exists?("img/#{section['id']}/#{website['img']}")
raise "#{website['name']} image not found."
end
end
end
# Load each provider and look for each image
providers = YAML.load_file('_data/providers.yml')
providers["providers"].each do |provider|
unless File.exists?("img/providers/#{provider['img']}")
raise "#{provider['name']} image not found."
end
end
rescue Psych::SyntaxError => e
puts 'Error in the YAML'
puts e
exit 1
rescue => e
puts e
exit 1
else
puts 'No errors. You\'re good to go!'
end