-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
65 lines (52 loc) · 1.82 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rdoc/task"
require "rake/testtask"
require "rubocop/rake_task"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
t.warning = false
end
desc "Run rubocop"
RuboCop::RakeTask.new(:rubocop)
task default: :test
namespace :coverage do
desc "Aggregates coverage reports"
task :report do
return unless ENV.key?("CI")
require "simplecov"
SimpleCov.collate Dir["coverage/**/.resultset.json"]
end
end
# Doc
rdoc_opts = ["--line-numbers", "--title", "Rodauth Select Account: Multiple Accounts per session in rodauth."]
rdoc_opts.concat(["--main", "README.md"])
RDOC_FILES = %w[README.md CHANGELOG.md lib/**/*.rb] + Dir["doc/*.rdoc"]
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.options += rdoc_opts
rdoc.rdoc_files.add RDOC_FILES
end
desc "Check configuration method documentation"
task :check_method_doc do
docs = {}
Dir["doc/*.rdoc"].sort.each do |f|
meths = File.binread(f).split("\n").grep(/\A(\w+[!?]?(\([^\)]+\))?) :: /).map { |line| line.split(/( :: |\()/, 2)[0] }.sort
docs[File.basename(f).sub(/\.rdoc\z/, "")] = meths unless meths.empty?
end
require "rodauth/select-account"
docs.each do |f, doc_meths|
require "./lib/rodauth/features/#{f}"
feature = Rodauth::FEATURES[f.to_sym]
meths = (feature.auth_methods + feature.auth_value_methods + feature.auth_private_methods).map(&:to_s).sort
unless (undocumented_meths = meths - doc_meths).empty?
puts "#{f} undocumented methods: #{undocumented_meths.join(', ')}"
end
unless (bad_doc_meths = doc_meths - meths).empty?
puts "#{f} documented methods that don't exist: #{bad_doc_meths.join(', ')}"
end
end
puts "#{docs.values.flatten.length} total documented configuration methods"
end