forked from GSA/open-gsa-redesign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
79 lines (68 loc) · 2.22 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
69
70
71
72
73
74
75
76
77
78
79
require "eslintrb"
require "html-proofer"
require "rake/testtask"
desc "Serve the site with live reload for development"
task :serve do
sh "bundle exec jekyll liveserve", verbose: false
end
# This option may cause pages to not be rebuilt when an underlying data file
# (e.g., _data/*.yml) changes. In most cases it's OK, but you may need to use
# the 'serve' task instead if changing data files.
desc "Serve the site with live reload for development (incremental builds)"
task :incrementalserve do
sh "bundle exec jekyll liveserve --incremental", 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
Rake::TestTask.new do |t|
t.name = "unit"
t.libs << "test"
t.test_files = FileList['test/test_*.rb']
t.verbose = true
t.warning = false
end
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 do
puts "Building the website..."
sh "bundle exec jekyll build -q -d _test", verbose: false
puts "Running HTML Proofer on internal links..."
options = {
allow_hash_href: true,
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 do
puts "Building the website..."
sh "bundle exec jekyll build -q -d _test", verbose: false
puts "Running HTML Proofer on all links..."
options = {
allow_hash_href: true,
check_html: true,
empty_alt_ignore: true
}
HTMLProofer.check_directory("./_test", options).run
end
end
desc "Run all tests"
task all: ["unit", "eslint", "htmlproofer:all"]
# Don't check external links for CI since it's too much overhead. External links
# should be tested locally before pushing.
desc "Run continuous integration tests"
task ci: ["unit", "eslint", "htmlproofer:internal"]
end
task test: ["test:all"]
task default: :test