forked from GSA/cto-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (50 loc) · 1.6 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
require "eslintrb"
require "html-proofer"
desc "Serve the site with live reload for development"
task :serve do
sh "bundle exec jekyll serve --livereload -H 0.0.0.0", verbose: false
end
desc "Build the site to the default Jekyll output directory"
task :build do
puts "Building the website..."
sh "bundle exec jekyll build -q", verbose: false
end
namespace :test do
desc "Run ESLint"
task :eslint do
puts "Running ESLint..."
puts Eslintrb.report(Dir.glob("assets/js/**/*.js"), :eslintrc)
end
namespace :htmlproofer do
desc "Run HTML Proofer on internal links"
task :internal_links do
puts "Building the website..."
sh "bundle exec jekyll build --trace -q -d _test", verbose: false
puts "Running HTML Proofer on internal links..."
options = {
check_html: true,
empty_alt_ignore: true,
disable_external: true
}
HTMLProofer.check_directory("./_test", options).run
end
desc "Run HTML Proofer on all links"
task :all_links do
puts "Building the website..."
sh "bundle exec jekyll build --trace -q -d _test", verbose: false
puts "Running HTML Proofer on all links..."
options = {
check_html: true,
empty_alt_ignore: true,
url_ignore: [/docs.google.com/, /ea.gsa.gov/]
}
HTMLProofer.check_directory("./_test", options).run
end
end
desc "Run all tests"
task all: ["eslint", "htmlproofer:internal_links"]
desc "Run all tests, including external link checks"
task all_external: ["eslint", "htmlproofer:all_links"]
end
task test: ["test:all"]
task default: :test