-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
65 lines (59 loc) · 1.78 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
# frozen_string_literal: true
require 'English'
require 'html-proofer'
require 'rubocop/rake_task'
require 'jekyll'
task :build, [:options] do |_t, args|
# Build twice to handle FastImage issue of non-existent images on init build
puts 'Building site...'.yellow.bold
args.with_defaults(options: {})
orig_stdout = $stdout.clone
$stdout.reopen('/dev/null', 'w')
Jekyll::Commands::Build.process({})
$stdout.reopen(orig_stdout)
Jekyll::Commands::Build.process(args[:options])
end
task :clean do
puts 'Cleaning up _site...'.yellow.bold
Jekyll::Commands::Clean.process({})
end
desc 'Test website with html_proofer'
task :html_proofer do
puts 'Running html proofer...'.yellow.bold
HTMLProofer.check_directory(
'_site/',
{
check_html: 'true',
check_opengraph: 'true',
enforce_https: 'true',
check_external_hash: 'true',
check_favicon: 'true',
check_img_http: 'true', # Fails http images
validation: {
report_eof_tags: 'true',
report_invalid_tags: 'true',
report_mismatched_tags: 'true',
report_missing_doctype: 'true',
report_missing_names: 'true',
report_script_embeds: 'true'
},
# Fixes internal links checks.
url_swap: { 'https://www.averyjfischer.com' => '' },
ignore_status_codes: [999], # `999 No Error` from LinkedIn
ignore_urls: [/docnetwork.org/], # Time outs; assume possible filtering from datacenter IPs?
internal_domains: ['www.averyjfischer.com', 'averyjfischer.com'],
url_ignore: []
}
).run
end
desc 'Run RuboCop'
task :rubocop do
puts 'Running RuboCop Validator...'.yellow.bold
RuboCop::RakeTask.new
end
desc 'Run all tests'
task :test do
Rake::Task['rubocop'].invoke
Rake::Task['build'].invoke
Rake::Task['html_proofer'].invoke
end