-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
60 lines (46 loc) · 1.2 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
require "rubocop/rake_task"
require "bump/tasks"
RuboCop::RakeTask.new
task default: %i[spec rubocop steep]
desc "Build parser files generated by racc"
task racc: [
"lib/yard_to_rbs_inline/yard_type/parser.rb"
]
desc "Build rbs files"
task rbs: ["rbs:collection", "rbs:inline"]
namespace :rbs do
desc "Install collections"
task :collection do
sh "bundle exec rbs collection install"
end
desc "Generate RBS files"
task inline: "rbs:inline:build"
namespace :inline do
desc "Generate RBS files from rbs-inline"
task :build do
sh "bundle exec rbs-inline lib --opt-out --output=sig/inline"
end
desc "Watch files to build rbs-inline"
task :watch do
require "listen"
listener = Listen.to("lib", only: /\.rb$/) do
Rake::Task["rbs:inline:build"].execute
end
listener.start
sleep
ensure
listener&.stop
end
end
end
desc "Type check the code"
task steep: ["rbs:collection", "rbs:inline"] do
sh "bundle exec steep check"
end
rule ".rb" => ".y" do |t|
sh "bundle exec racc #{t.source} -o #{t.name}"
end