-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
64 lines (52 loc) · 1.61 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
require "tempfile"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/test_*.rb"]
end
require "rubocop/rake_task"
RuboCop::RakeTask.new
task default: %i[lint test readme:outdated cache:outdated]
desc "Shortcut for `rake rubocop`"
task lint: :rubocop
desc "Shortcut for `rake rubocop:autocorrect`"
task fix: :"rubocop:autocorrect"
namespace "readme" do
desc "Check if the readme needs to be regenerated"
task :outdated do
Tempfile.open("readme") do |file|
sh "bundle exec ruby script/generate_readme.rb > #{file.path}"
sh "diff -q README.md #{file.path}"
end
end
desc "Regenerate the readme"
task :generate do
Tempfile.open("readme") do |file|
sh "bundle exec ruby script/generate_readme.rb > #{file.path}"
mv file.path, "README.md"
end
end
end
namespace "cache" do
desc "Check if the cache needs to be regenerated"
task :outdated do
sh "bundle exec ruby script/generate_search_index.rb outdated"
sh "bundle exec ruby script/generate_formatted_output.rb outdated"
sh "bundle exec ruby script/generate_list.rb outdated"
end
desc "Regenerate the cache"
task :generate do
sh "bundle exec ruby script/generate_search_index.rb generate"
sh "bundle exec ruby script/generate_formatted_output.rb generate"
sh "bundle exec ruby script/generate_list.rb generate"
end
end
namespace "fixture" do
desc "Regenerate the test fixtures"
task :generate do
sh "bundle exec ruby script/generate_test_fixtures.rb"
end
end