2018-11-23 15:05:45 -05:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
|
|
|
|
RELEASE_DEPS="rsync sed";
|
|
|
|
|
|
|
|
rc() {
|
|
|
|
local _cmd="${1}"; shift;
|
|
|
|
printf "%s >>> %s %s\n" "$(date +"%d-%^b-%Y %H:%M:%S")" "${_cmd}" "${*}";
|
|
|
|
"${_cmd}" "${@}";
|
|
|
|
};
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "usage: ${0} [-h] old_version new_version" >&2;
|
|
|
|
echo " -h.........: show this screen" >&2;
|
|
|
|
};
|
|
|
|
|
|
|
|
main() {
|
2018-11-23 15:26:24 -05:00
|
|
|
local _opt="" _version_new="" _version_new_code="" _version_old="";
|
2018-11-23 15:05:45 -05:00
|
|
|
while getopts hv _opt; do
|
|
|
|
case "${_opt}" in
|
|
|
|
h) usage; exit 0; ;;
|
|
|
|
*) usage; exit 1; ;;
|
|
|
|
esac; done;
|
|
|
|
shift $((${OPTIND}-1));
|
|
|
|
if [ -z "${1}" ]; then
|
|
|
|
echo "error: empty or missing old version number argument" >&2; usage; exit 1;
|
|
|
|
elif [ -z "${2}" ]; then
|
|
|
|
echo "error: empty or missing new version number argument" >&2; usage; exit 1;
|
|
|
|
else
|
|
|
|
_version_old="${1}"; _version_new="${2}";
|
2018-11-23 15:26:24 -05:00
|
|
|
_version_new_code="$(echo "${_version_new}" | sed -e 's,\.,,g' -e 's/^[0-9]/&00/')";
|
2018-11-23 15:05:45 -05:00
|
|
|
fi;
|
|
|
|
for _cmd in ${RELEASE_DEPS_CMD}; do
|
|
|
|
if ! which "${_cmd}" >/dev/null; then
|
|
|
|
echo "error: missing prerequisite command \`${_cmd}'";
|
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
done;
|
2018-11-23 15:26:24 -05:00
|
|
|
rc sed -i"" '/version="/s/\(version=\)"'"${_version_old}"'"/\1"'"${_version_new}"'"/' \
|
2018-11-23 15:05:45 -05:00
|
|
|
asciiblaster-cordoba/config.xml;
|
2018-11-23 15:26:24 -05:00
|
|
|
rc sed -i"" '/"version":/s/\("version":\s*\)"'"${_version_old}"'"/\1"'"${_version_new}"'"/' \
|
|
|
|
asciiblaster-cordoba/package.json \
|
|
|
|
asciiblaster-cordoba/package-lock.json;
|
|
|
|
rc sed -i"" '/android:versionCode="/s/\(android:versionCode=\)"[0-9]\+"/\1"'"${_version_new_code}"'"/' \
|
|
|
|
asciiblaster-cordoba/platforms/android/app/src/main/AndroidManifest.xml;
|
|
|
|
rc sed -i"" '/android:versionName="/s/\(android:versionName=\)"'"${_version_old}"'"/\1"'"${_version_new}"'"/' \
|
|
|
|
asciiblaster-cordoba/platforms/android/app/src/main/AndroidManifest.xml;
|
|
|
|
rc sed -i"" '/version="/s/\(version=\)"'"${_version_old}"'"/\1"'"${_version_new}"'"/' \
|
|
|
|
asciiblaster-cordoba/platforms/android/app/src/main/res/xml/config.xml;
|
|
|
|
rc sed -i"" '/"version":/s/\("version":\s*\)"'"${_version_old}"'"/\1"'"${_version_new}"'"/' \
|
|
|
|
asciiblaster-nw/package.json \
|
|
|
|
asciiblaster-nw/package-lock.json;
|
|
|
|
rc sed -i"" '/<title>[^<]\+ v/s/\(<title>[^<]\+ v\)'"${_version_old}"'\(<\)/\1'"${_version_new}"'\2/' \
|
2018-11-25 07:49:49 -05:00
|
|
|
index.html assets/html/help.html;
|
2018-11-23 15:26:24 -05:00
|
|
|
rc rsync -aiLPv --delete \
|
|
|
|
asciiblaster-cordoba/www/ \
|
2018-11-23 15:05:45 -05:00
|
|
|
asciiblaster-cordoba/platforms/android/app/src/main/assets/www/;
|
|
|
|
rc git add asciiblaster-cordoba/platforms/android/app/src/main/assets/www;
|
|
|
|
rc git commit -avm "Bump to v${_version_new}.";
|
|
|
|
};
|
|
|
|
|
|
|
|
set -o errexit -o noglob;
|
|
|
|
main "${@}";
|
|
|
|
|
|
|
|
# vim:foldmethod=marker sw=8 ts=8 tw=120
|