Skip to content

Instantly share code, notes, and snippets.

@takahashim
Created March 27, 2022 14:27
Show Gist options
  • Save takahashim/d7e908eb02fca9196da82d0a2eb632c8 to your computer and use it in GitHub Desktop.
Save takahashim/d7e908eb02fca9196da82d0a2eb632c8 to your computer and use it in GitHub Desktop.
require 'fileutils'
Dir.glob("lib/**/*.rb") do |file|
rbs_file = file.sub('lib/', 'sig/').sub(/\.rb$/, '.rbs')
FileUtils.mkdir_p(File.dirname(rbs_file))
puts "#{file} -> #{rbs_file}"
cmd = "rbs prototype rb #{file} > #{rbs_file}"
system(cmd)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment