QGIS/scripts/rename_class.sh
lbartoletti 124e26815d Standardize shebangs (was Usr bin env) (#6229)
* Use portable /usr/bin/env/{perl,python} instead of /usr/bin/{perl,python}

* fix perl;add bash

* Fix indentation using modified scripts

* Revert "fix perl;add bash"

This reverts commit be8b9113c25f7c2fb9c8c9bad556fbca2f0c0ba2.

* python3 everywhere

* more bash

* rebase
change perl

* Linux perl; missing from last PR

* fix doxygen_space

* Use portable /usr/bin/env/{perl,python} instead of /usr/bin/{perl,python}

* fix perl;add bash

* Fix indentation using modified scripts

* Revert "fix perl;add bash"

This reverts commit be8b9113c25f7c2fb9c8c9bad556fbca2f0c0ba2.

* python3 everywhere

* more bash

* rebase
change perl

* fix doxygen_space
2018-02-05 03:38:02 -09:00

39 lines
863 B
Bash
Executable File

#!/usr/bin/env bash
#
# Denis Rouzaud
# 13.01.2016
#set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FILEPATH=$1
OLDCLASS=$2
NEWCLASS=$3
OLDCLASSUPPER="${OLDCLASS^^}"
OLDCLASSLOWER="${OLDCLASS,,}"
NEWCLASSUPPER="${NEWCLASS^^}"
NEWCLASSLOWER="${NEWCLASS,,}"
if [[ ${FILEPATH:(-1)} = "/" ]]; then
PATH="${FILEPATH::-1}"
fi
FILES=`git ls-tree --name-only -r HEAD | grep ".*\.\(sip\|cpp\|h\|txt\)$"`
for f in $FILES
do
sed -i s/"$OLDCLASS"/"$NEWCLASS"/g "$f"
sed -i s/"$OLDCLASSUPPER"/"$NEWCLASSUPPER"/g "$f"
sed -i s/"$OLDCLASSLOWER"/"$NEWCLASSLOWER"/g "$f"
done
git mv $DIR/../src/$FILEPATH/$OLDCLASSLOWER.h $DIR/../src/$FILEPATH/$NEWCLASSLOWER.h
git mv $DIR/../src/$FILEPATH/$OLDCLASSLOWER.cpp $DIR/../src/$FILEPATH/$NEWCLASSLOWER.cpp
git mv $DIR/../python/$FILEPATH/$OLDCLASSLOWER.sip $DIR/../python/$FILEPATH/$NEWCLASSLOWER.sip