-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
110 lines (95 loc) · 3.04 KB
/
Rakefile
File metadata and controls
110 lines (95 loc) · 3.04 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new
task default: %i[spec rubocop]
# Link checking tasks
namespace :check do
desc "Check internal documentation links only (recommended for CI)"
task :links do
puts "Checking internal documentation links..."
puts "(External URLs are skipped to avoid anti-bot measures)"
puts
# Check if lychee is installed
unless system("which lychee > /dev/null 2>&1")
puts "\n❌ Error: lychee is not installed."
puts "\nInstall lychee using one of these methods:"
puts " - cargo install lychee (requires Rust)"
puts " - brew install lychee (macOS)"
puts " - See https://lychee.cli.rs/ for more options"
exit 1
end
# Run lychee with --offline to check only internal links
success = system(
"lychee",
"--config", "lychee.toml",
"--offline",
"--format", "detailed",
"docs/**/*.adoc",
"README.adoc"
)
if success
puts "\n✅ All internal documentation links are valid!"
else
puts "\n❌ Broken internal links found. See output above for details."
exit 1
end
end
desc "Check all links including external URLs (may have false positives)"
task :links_all do
puts "Checking all documentation links (internal + external)..."
puts "⚠️ Note: External URLs may fail due to rate limiting or anti-bot measures"
puts
unless system("which lychee > /dev/null 2>&1")
puts "\n❌ Error: lychee is not installed."
puts "\nInstall lychee using one of these methods:"
puts " - cargo install lychee (requires Rust)"
puts " - brew install lychee (macOS)"
puts " - See https://lychee.cli.rs/ for more options"
exit 1
end
success = system(
"lychee",
"--config", "lychee.toml",
"--format", "detailed",
"docs/**/*.adoc",
"README.adoc"
)
if success
puts "\n✅ All links are valid!"
else
puts "\n❌ Some links failed validation."
puts "Note: External URL failures may be due to anti-bot measures, not actual broken links."
exit 1
end
end
desc "Check documentation links (verbose output)"
task :links_verbose do
puts "Checking internal documentation links (verbose)..."
unless system("which lychee > /dev/null 2>&1")
puts "\n❌ Error: lychee is not installed."
puts "\nInstall lychee using one of these methods:"
puts " - cargo install lychee (requires Rust)"
puts " - brew install lychee (macOS)"
puts " - See https://lychee.cli.rs/ for more options"
exit 1
end
success = system(
"lychee",
"--config", "lychee.toml",
"--offline",
"--format", "detailed",
"--verbose",
"docs/**/*.adoc",
"README.adoc"
)
if success
puts "\n✅ All internal links are valid!"
else
puts "\n❌ Broken links found. See output above for details."
exit 1
end
end
end