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
|
# File 'lib/todo-rbi.rb', line 15
def self.main
File.delete(OUTPUT) if File.exist?(OUTPUT)
IO.popen(
[
File.realpath("#{__dir__}/../bin/srb"),
'tc',
'--print=missing-constants',
'--stdout-hup-hack',
'--silence-dev-message',
'--no-error-count',
],
err: '/dev/null',
) do |io|
missing_constants = io.read.split("\n")
output = String.new
output << HEADER
missing_constants.each do |const|
next if const.include?("<") || const.include?("class_of")
output << "module #{const.gsub('T.untyped::', '')}; end\n"
end
File.write(OUTPUT, output) if output != HEADER
end
end
|