-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
68 lines (57 loc) · 1.32 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require "yaml"
task :validate do
valid = []
errors = []
yaml_files = Dir.glob(File.join("**", "*.yml"))
yaml_files.each do |yaml_file|
print "."
begin
YAML.load_file yaml_file
valid << yaml_file
rescue Exception => e
errors << e
end
end
puts
puts
puts "Validated #{yaml_files.count} YAML files"
if errors.any?
puts
puts "ERRORS in #{errors.size} files:"
puts
errors.each do |error|
puts error
end
exit 1
end
end
task :test do
ruby "spec.rb"
end
namespace :courses do
desc "Run yaml-lint on courses directory"
task :linter do
output = `bundle exec yaml-lint courses`
puts output
end
desc "Run kwalify schema validation on courses directory"
task :schema do
output = `bundle exec kwalify -lf schema_course.yml courses/*`
puts output
end
task check: [:linter, :schema]
end
namespace :modules do
desc "Run yaml-lint on modules directory"
task :linter do
output = `bundle exec yaml-lint modules`
puts output
end
desc "Run kwalify schema validation on modules directory"
task :schema do
output = `bundle exec kwalify -lf schema_module.yml modules/*`
puts output
end
task check: [:linter, :schema]
end
task default: ["courses:check", "modules:check"]