forked from kubevirt/kubevirt.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
54 lines (47 loc) · 1.79 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
#encoding: utf-8
desc 'Generate HTML of Kubevirt.io'
task :build do
puts "Building"
sh "bundle exec jekyll build"
end
namespace :links do
require 'html-proofer'
require 'optparse'
desc 'Checks html files looking for external dead links'
task :test_external => :build do
options = {
:assume_extension => true,
:only_4xx => true,
:log_level => :info,
:internal_domains => ["https://instructor.labs.sysdeseng.com", "https://www.youtube.com"],
:external_only => true,
:url_ignore => [ /http(s)?:\/\/(www.)?katacoda.com.*/ ],
:url_swap => {'https://kubevirt.io/' => '',},
:http_status_ignore => [429],
}
parser = OptionParser.new
parser.banner = "Usage: rake -- [arguments]"
# Added option -u which will remove the url_swap option to from the map
parser.on("-u", "--us", "Remove url_swap from htmlProofer") do |url_swap|
options.delete(:url_swap)
end
args = parser.order!(ARGV) {}
parser.parse!(args)
puts "Checking External links..."
HTMLProofer.check_directory("./_site", options).run
end
desc 'Checks html files looking for internal dead links'
task :test_internal => :build do
options = {
:assume_extension => true,
:only_4xx => true,
:allow_hash_href => true,
:log_level => :info,
:disable_external => true
}
puts "Checking Internal links..."
HTMLProofer.check_directory("./_site", options).run
end
end
desc 'The default task will execute all tests in a row'
task :default => ['links:test_external', 'links:test_internal']