Skip to content

Instantly share code, notes, and snippets.

@upinetree
Created August 30, 2021 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save upinetree/cfd5c7c88b9a34bac9a43f86d8899c79 to your computer and use it in GitHub Desktop.
Save upinetree/cfd5c7c88b9a34bac9a43f86d8899c79 to your computer and use it in GitHub Desktop.
ディレクトリを指定して一括で rbs prototype rb を実行する便利ネタ
#!/usr/bin/env zsh
set -eu
test "$#" -ne 1 && echo "Usage: $0 ROOTDIR" && exit 1
root=$1
test ! -d $root && echo "$root is not a valid directory" && exit 1
for file in $(find $root -name '*.rb')
do
local ofile=sig/${file}s
test -f $ofile && echo "skip: $ofile exists" && continue
mkdir -p sig/$(dirname $file)
bundle exec rbs prototype rb $file > $ofile
echo "done: $file => $ofile"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment