diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-07-19 13:20:49 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-07-19 13:20:49 +0200 |
commit | fa2af2d93790b488e438038decc81f474bc107ff (patch) | |
tree | 3b4bc2329f43f3c3cdfea68bcf98e4ae25b682ca /tools/rename | |
parent | de0463bcf0f76ef8b07f2719679c9e0d72745c5d (diff) | |
download | RustAndDust-fa2af2d93790b488e438038decc81f474bc107ff.zip RustAndDust-fa2af2d93790b488e438038decc81f474bc107ff.tar.gz |
add tools/rename, you'll never know
Diffstat (limited to 'tools/rename')
-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 |