-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
42 lines (33 loc) · 997 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
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
desc 'Run style checker'
RuboCop::RakeTask.new(:rubocop) do |task|
task.fail_on_error = true
end
desc 'Install commit hooks to ensure better practices'
task :install_hooks do
require 'fileutils'
Dir.glob('./git-hooks/*').each do |hook|
next if File.file?("./.git/hooks/#{File.basename(hook)}")
puts "Installing #{File.basename(hook)} git hook"
FileUtils.cp(hook, './.git/hooks/')
end
end
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.options = ['--fail-on-warning']
end
RSpec::Core::RakeTask.new(:spec)
desc 'Generate table of contents for README.md'
task :doctoc do
if `which doctoc`.strip.empty?
$stdout.puts 'Skipping doctoc generation; install via "npm install -g doctoc"'
else
$stdout.puts 'Generating table of contents for README.md'
`doctoc README.md`
end
end
task ci: %i[doctoc rubocop yard spec]
task default: %i[ci]