-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
64 lines (51 loc) · 1.51 KB
/
Rakefile
File metadata and controls
64 lines (51 loc) · 1.51 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
require 'bundler/setup'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rubocop/rake_task'
require 'rubygems'
require 'rubygems/package_task'
require 'yard'
require 'yard/rake/yardoc_task'
HATEMILE_GEM = Gem::Specification.load('hatemile.gemspec')
Gem::PackageTask.new(HATEMILE_GEM) do |p|
p.gem_spec = HATEMILE_GEM
end
YARD::Rake::YardocTask.new do |p|
p.files = ['lib/**/*.rb', '-', 'README.md', 'CODE_OF_CONDUCT.md', 'LICENSE']
p.options = %w[--protected --private]
end
RuboCop::RakeTask.new(:rubocop) do |p|
p.patterns = ['Rakefile', 'hatemile.gemspec', 'lib/**/*.rb', 'test/**/*.rb']
p.fail_on_error = true
end
namespace(:doc) do
desc('Check documentation coverage')
task(:coverage) do
# Reference https://github.com/umbrellio/lamian/blob/master/Rakefile
Rake::Task['yard'].reenable
Rake::Task['yard'].invoke
YARD::Registry.load
objs = YARD::Registry.select do |o|
puts("pending #{o}") if o.docstring =~ /TODO|FIXME|@pending|@todo/
o.docstring.blank?
end
next if objs.empty?
puts('No documentation found for:')
objs.each do |x|
puts("\t#{x}")
end
abort('100% document coverage required')
end
end
Rake::TestTask.new do |p|
p.libs << 'test'
p.test_files = FileList['test/test*.rb']
p.verbose = true
end
desc('Generate documentation')
task('doc' => 'yard')
desc('Analyze code to flag bugs and stylistic errors.')
task('lint' => ['rubocop', 'doc:coverage'])
desc('Build the gem if not has errors')
task('build' => %w[lint gem])