2016-02-29 02:20:58 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-07-17 00:25:13 +03:00
|
|
|
PROJECT="../../"
|
2016-02-29 02:20:58 +03:00
|
|
|
SETTINGS="../../lib/core/settings.py"
|
2016-07-17 00:25:13 +03:00
|
|
|
CHECKSUM="../../txt/checksum.md5"
|
2016-02-29 02:20:58 +03:00
|
|
|
|
|
|
|
declare -x SCRIPTPATH="${0}"
|
|
|
|
|
2016-07-17 00:25:13 +03:00
|
|
|
PROJECT_FULLPATH=${SCRIPTPATH%/*}/$PROJECT
|
|
|
|
SETTINGS_FULLPATH=${SCRIPTPATH%/*}/$SETTINGS
|
|
|
|
CHECKSUM_FULLPATH=${SCRIPTPATH%/*}/$CHECKSUM
|
2016-02-29 02:20:58 +03:00
|
|
|
|
2016-07-17 00:25:13 +03:00
|
|
|
if [ -f $SETTINGS_FULLPATH ]
|
2016-02-29 02:20:58 +03:00
|
|
|
then
|
2016-08-02 13:00:21 +03:00
|
|
|
LINE=$(grep -o ${SETTINGS_FULLPATH} -e 'VERSION = "[0-9.]*"')
|
|
|
|
declare -a LINE
|
2016-03-17 19:06:11 +03:00
|
|
|
INCREMENTED=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); _.append(0) if len(_) < 3 else _; _[-1] = str(int(_[-1]) + 1); month = str(time.gmtime().tm_mon); _[-1] = '0' if _[-2] != month else _[-1]; _[-2] = month; print sys.argv[1].replace(version, '.'.join(_))" "$LINE")
|
2016-02-29 02:20:58 +03:00
|
|
|
if [ -n "$INCREMENTED" ]
|
|
|
|
then
|
2016-08-02 12:55:11 +03:00
|
|
|
sed -i "s/${LINE}/${INCREMENTED}/" $SETTINGS_FULLPATH
|
2016-08-02 13:00:21 +03:00
|
|
|
echo "Updated ${INCREMENTED} in ${SETTINGS_FULLPATH}"
|
2016-02-29 02:20:58 +03:00
|
|
|
else
|
|
|
|
echo "Something went wrong in VERSION increment"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-08-02 12:50:42 +03:00
|
|
|
git add "$SETTINGS_FULLPATH"
|
2016-08-02 13:00:21 +03:00
|
|
|
fi
|
2016-08-02 12:50:42 +03:00
|
|
|
|
|
|
|
truncate -s 0 "$CHECKSUM_FULLPATH"
|
|
|
|
cd $PROJECT_FULLPATH && for i in $(find . -name "*.py" -o -name "*.xml" -o -iname "*_" | sort); do git ls-files $i --error-unmatch &>/dev/null && md5sum $i | sed 's/\.\///' >> "$CHECKSUM_FULLPATH"; git add "$CHECKSUM_FULLPATH"; done
|