forked from ruby-conferences/ruby-conferences.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
42 lines (36 loc) · 891 Bytes
/
Rakefile
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
37
38
39
40
41
42
#!/usr/bin/env rake
require 'yaml'
require 'date'
require './data_file_validator'
desc "Build Jekyll site"
task :build do
exit 1 unless system "bundle exec jekyll build"
end
desc "Verify generated HTML"
task :verify_html do
exit 2 unless system "bundle exec htmlproofer ./_site"
end
desc "Verify event data"
task :verify_data do
allowed_keys = [
"name",
"location",
"start_date",
"end_date",
"url",
"twitter",
"reg_phrase",
"reg_date",
"cfp_phrase",
"cfp_date",
"video_link"
]
data = YAML.load File.read "_data/conferences.yml"
validator = DataFileValidator.validate(data, allowed_keys)
exit 3 if validator.missing_keys?
exit 4 if validator.bonus_keys?
events = validator.events
dates = events.map { |event| event["start_date"] }
exit 5 unless dates.sort == dates
end
task default: [:build, :verify_data, :verify_html]