Skip to content

Commit 0f9d067

Browse files
committed
Refactor Rakefile
1 parent 607af30 commit 0f9d067

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

Rakefile

+29-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
require 'html-proofer'
2+
require 'jekyll'
23

3-
desc 'Clean up generated site'
4+
Rake.application.options.trace = true
5+
6+
desc 'Remove all generated files: destination folder, metadata file, Sass and Jekyll caches.'
47
task :clean do
5-
sh 'rm -rf _site'
8+
Jekyll::Commands::Clean.process({})
9+
end
10+
11+
desc 'Build and serve the site'
12+
task serve: [:build] do
13+
Jekyll::Commands::Serve.process({})
14+
end
15+
16+
desc 'Build the site'
17+
task build: [:clean] do
18+
Jekyll::Commands::Build.process({})
619
end
720

8-
task :test do
9-
sh 'bundle exec jekyll build'
10-
HTMLProofer.check_directories(
11-
["./_site"], {
12-
:empty_alt_ignore => false,
13-
typhoeus: {
14-
headers: {
15-
"Accept-Encoding" => "gzip",
16-
}
21+
desc 'Build and test the site'
22+
task test: [:build] do
23+
options = {
24+
:check_html => true, # Validate HTML
25+
:empty_alt_ignore => false, # Allow images with empty alt tags
26+
:check_favicon => true, # Check whether favicons are valid
27+
:check_img_http => true, # Enforce that images use HTTPS
28+
typhoeus: {
29+
headers: {
30+
# This is required to validate links to docs.github.com
31+
"Accept-Encoding" => "gzip",
1732
}
18-
}).run
33+
}
34+
}
35+
HTMLProofer.check_directory("./_site", options).run
1936
end
2037

2138
task default: :test

0 commit comments

Comments
 (0)