-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
63 lines (50 loc) · 1.21 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
require "bundler/gem_tasks"
require "rubocop/rake_task"
require "rdoc/task"
task default: %i[lint test]
desc "Run lint"
task lint: %i[rubocop rbs:setup typecheck:run typecheck:stats rdoc]
RuboCop::RakeTask.new
RDoc::Task.new do |rdoc|
rdoc.main = "README.md"
rdoc.rdoc_dir = "doc"
rdoc.rdoc_files.include("README.md", "sig")
end
desc "Run test"
task :test do
sh "easytest"
end
namespace :typecheck do
desc "Run type-check"
task :run do
sh "steep check --with-expectations"
end
desc "Run type-check saving expectations"
task :save do
sh "steep check --save-expectations"
end
desc "Show type coverage stats"
task :stats do
sh "steep stats --format=table"
end
end
namespace :rbs do
desc "Set up RBS"
task :setup do
sh "rbs collection install"
end
desc "Generate RBS"
task :generate do
require "pathname"
ignored = %w[lib/easytest/version.rb]
Pathname.glob("lib/**/*.rb") do |infile|
if ignored.include? infile.to_s
puts "Ignored: #{infile}"
next
end
outfile = Pathname(infile.to_s.sub(/^lib/, "sig/_internal").sub(/\.rb$/, ".rbs"))
outfile.parent.mkpath
sh "rbs prototype rb #{infile} > #{outfile}"
end
end
end