summaryrefslogtreecommitdiffstats
path: root/tools/rename
blob: 46173680896f51b20fe36386a0bcf29b38499ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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