-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
49 lines (39 loc) · 1.11 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "yard"
require "pathname"
require "launchy"
require "uri"
ROOT = Pathname.new(__FILE__).join("..")
RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:lint)
YARD::Rake::YardocTask.new(:doc) do |t|
t.files = Dir[ROOT.join("lib/**/*.rb")]
t.options = %w[--private]
end
def open_in_browser(path)
Launchy.open(URI.join("file:///", path.to_s))
end
namespace :doc do
desc "open doc"
task open: :doc do
open_in_browser ROOT.join("doc/frames.html")
end
desc "checks doc coverage"
task coverage: :doc do
# ideally you've already generated the database to .load it
# if not, have this task depend on the docs task.
YARD::Registry.load
objs = YARD::Registry.select do |o|
puts "pending #{o}" if /TODO|FIXME|@pending/.match?(o.docstring)
o.docstring.blank?
end
next if objs.empty?
puts "No documentation found for:"
objs.each { |x| puts "\t#{x}" }
raise "100% document coverage required"
end
end
task default: %i[lint doc:coverage spec]