Created
August 30, 2021 15:22
-
-
Save upinetree/cfd5c7c88b9a34bac9a43f86d8899c79 to your computer and use it in GitHub Desktop.
ディレクトリを指定して一括で rbs prototype rb を実行する便利ネタ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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