forked from dduugg/yard-sorbet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
61 lines (51 loc) · 1.65 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
# typed: strict
# frozen_string_literal: true
require 'bundler/audit/task'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
Bundler::Audit::Task.new
RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop)
YARD::Rake::YardocTask.new
desc 'Update sorbet rbi files'
task :rbi do
sh 'bundle update'
sh 'bundle clean'
sh 'rm -r sorbet/rbi/{gems,hidden-definitions,sorbet-typed,todo.rbi}'
sh 'bundle exec srb rbi sorbet-typed'
sh 'bundle exec srb rbi gems'
sh 'bundle exec srb rbi hidden-definitions'
sh 'bundle exec srb rbi todo'
# sadly, the above commands don't limit themselves to the files/folders that they describe
sh 'git checkout -- sorbet/rbi/contexts'
# this is a weird and unnecessary artifact, just delete it
sh 'rm sorbet/rbi/gems/yard-sorbet.rbi'
end
desc 'Typecheck files with sorbet'
namespace :typecheck do |typecheck_namespace|
desc 'Typecheck Gemfile'
task :gemfile do
sh 'bundle exec srb typecheck Gemfile sorbet/rbi/contexts/gemfile.rbi'
end
desc 'Typecheck Rakefile'
task :rakefile do
sh 'bundle exec srb typecheck Rakefile sorbet/rbi/contexts/rakefile.rbi'
end
desc 'Typecheck spec/ files'
task :spec do
sh 'bundle exec srb typecheck spec/ sorbet/rbi/contexts/spec.rbi'
end
desc 'Typecheck library files'
task :lib do
sh 'bundle exec srb typecheck . bin/console yard-sorbet.gemspec'
end
desc 'Run all typecheck tasks'
task :all do
typecheck_namespace.tasks.each { |typecheck_task| Rake::Task[typecheck_task].invoke }
end
end
task default: %i[typecheck:all rubocop spec]
desc 'Tasks to run in CI'
task ci: %i[bundle:audit default]