diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/rename | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/rename b/tools/rename new file mode 100755 index 0000000..4617368 --- /dev/null +++ b/tools/rename @@ -0,0 +1,28 @@ +#! /bin/bash + +if [ $# -lt 2 ]; then + echo "usage $0 old_name new_name" + exit 1 +fi + +OLD=$1 +NEW=$2 +OLD_L=$(echo $OLD | tr '[:upper:]' '[:lower:]') +NEW_L=$(echo $NEW | tr '[:upper:]' '[:lower:]') + +WHERE="core android desktop ios html build.gradle run" + +./gradlew clean + +for F in $(ack -l $OLD $WHERE); do + sed -i "s/$OLD/$NEW/" $F +done +for F in $(ack -l $OLD_L $WHERE); do + sed -i "s/$OLD_L/$NEW_L/" $F +done + +DIR=$(find . -type d -name $OLD_L) +mv $DIR ${DIR%/*}/$NEW_L + +FILE=$(find . -type f -name $OLD.java) +mv $FILE ${FILE%/*}/$NEW.java |