summaryrefslogtreecommitdiffstats
path: root/tools/rename
blob: c91f64a67d1a6ee6ebe8be682c4440aca0f15e1d (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
29
30
31
32
33
34
35
36
37
38
39
40
#! /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

echo "replace '$OLD with $NEW'"
for F in $(ack -l $OLD $WHERE); do
    sed -i "s/$OLD/$NEW/g" $F
done

echo "replace '$OLD_L' with '$NEW_L'"
for F in $(ack -l $OLD_L $WHERE); do
    sed -i "s/$OLD_L/$NEW_L/g" $F
done

echo "move '$OLD_L' directories into '$NEW_L'"
for D in $(find .  -type d -name $OLD_L); do
    mv $D ${D%/*}/$NEW_L
done

echo "move '$OLD.java' files into '$NEW.java'"
for F in $(find .  -type f -name $OLD.java); do
    mv $F ${F%/*}/$NEW.java
done

echo "mv core/src/${OLD}.gwt.xml core/src/${NEW}.gwt.xml"
mv core/src/${OLD}.gwt.xml core/src/${NEW}.gwt.xml

vim $(find desktop/src/ -name DesktopLauncher.java)