-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
45 lines (38 loc) · 961 Bytes
/
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
# frozen_string_literal: true
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
desc 'Generate doc'
task :doc do
sh 'yardoc'
end
desc 'Verify doc coverage'
task :verify_doc do
sh <<-SCRIPT.gsub(/^\s+\|/, '').chomp
|yard stats --list-undoc | ruby -e "
| while (line = gets)
| warnings ||= line.start_with?('[warn]:')
| coverage ||= line[/([\\d\.]+)% documented/, 1]
| end
|
| exit(1) if warnings || Float(coverage) != 100
|"
SCRIPT
sh <<-SCRIPT.gsub(/^\s+\|/, '').chomp
|yard doc --no-cache | ruby -e "
| while (line = gets)
| warnings ||= line.start_with?('[warn]:')
| errors ||= line.start_with?('[error]:')
| end
|
| exit(1) if warnings || errors
|"
SCRIPT
end
desc 'Run Rubocop'
task :rubocop do
sh 'bundle exec rubocop'
end
desc 'Run all examples'
RSpec::Core::RakeTask.new(:spec)
task default: %i[verify_doc rubocop spec]