-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
30 lines (26 loc) · 733 Bytes
/
Rakefile
File metadata and controls
30 lines (26 loc) · 733 Bytes
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
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb']
t.options = ['--title', 'Kernel Work Documentation', '--protected', '--private']
end
task :check_whitespace do
puts "Checking for trailing whitespace..."
files = Dir.glob('lib/**/*.rb') + Dir.glob('bin/*') + ['Rakefile']
errors = []
files.each do |file|
next if File.directory?(file)
lines = File.readlines(file)
lines.each_with_index do |line, index|
if line =~ /[ \t]+$/
errors << "#{file}:#{index + 1}: trailing whitespace found"
end
end
end
if errors.any?
puts errors.join("\n")
exit 1
else
puts "No trailing whitespace found."
end
end
task :default => [:check_whitespace, :yard]