Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation improvements, including date checking #258

Merged
merged 3 commits into from
Jan 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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