Skip to content

Commit

Permalink
Merge pull request #258 from OSAS/validate-fixes-including-date-checking
Browse files Browse the repository at this point in the history
Validation improvements, including date checking
  • Loading branch information
garrett authored Jan 10, 2017
2 parents 1ed7c8c + c27321c commit 4f36478
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

valid = true

Dir.glob('*/*.yml').each do |file|
Dir.glob('20*/*.yml').sort.each do |file|
begin
yaml_file = YAML.load_file(file)
doc = yaml_file
Expand All @@ -22,6 +22,27 @@
end
end

if doc['talks']
doc['talks'].each do |talk|
begin
if talk['start']
date_type = 'start'
DateTime.parse(talk['start'])
end

if talk['end']
date_type = 'end'
DateTime.parse(talk['start'])
end

rescue StandardError
valid = false
puts "Error: #{file}: Invalid #{date_type} time: " \
"'#{talk[date_type]}' in '#{talk['title']}'"
end
end
end

rescue StandardError => err
valid = false

Expand Down

0 comments on commit 4f36478

Please sign in to comment.