|
| 1 | +#!/bin/sh -- |
| 2 | + |
| 3 | +# |
| 4 | +# FindAndSetVersion function |
| 5 | +# Find and update version string in form "Version = #.#.#" |
| 6 | +# Search is: case-insensitive, space, tabs, or nothing around '=', and one or more # in each placeholder. |
| 7 | +# Replace is: performed in-place inside of file; however, a backup (.bak) of the original file is also made. |
| 8 | +# |
| 9 | +# NOTE: sed on Mac doesn't include a case-insensitive option. To keep the search pattern equivalent for both |
| 10 | +# grep and sed, must use an expanded pattern for text where each letter is expressed in both upper/lower case. |
| 11 | +# ex: Ver should be [vV][eE][rR] |
| 12 | +# |
| 13 | +function FindAndSetVersion { |
| 14 | +if grep -q -E ${VERSIONPATTERN} ${VERSIONFILE} ; then |
| 15 | + if sed -i.bak -E "s/${VERSIONPATTERN}/${VERSIONSTRING}/" ${VERSIONFILE} ; then |
| 16 | + echo "Updated file \"${VERSIONFILE}\" to include \"${VERSIONSTRING}\"" |
| 17 | + fi |
| 18 | +else |
| 19 | + echo "ERROR: Unable to find version string in file \"${VERSIONFILE}\"" |
| 20 | +fi |
| 21 | +} |
| 22 | + |
| 23 | +VERSION=0.5.6 |
| 24 | + |
| 25 | +# |
| 26 | +# Adjust BlocklyPropClient.py file |
| 27 | +# |
| 28 | +VERSIONFILE =BlocklyPropClient.py |
| 29 | +VERSIONPATTERN =[vV][eE][rR][sS][iI][oO][nN][[:blank:]]*=[[:blank:]]*\"[0-9]+\.[0-9]+\.[0-9]+\" |
| 30 | +VERSIONSTRING ="VERSION = \"${VERSION}\"" |
| 31 | + |
| 32 | +FindAndSetVersion |
| 33 | + |
| 34 | + |
| 35 | +# |
| 36 | +# Adjust about.txt file |
| 37 | +# |
| 38 | +VERSIONFILE =about.txt |
| 39 | +VERSIONPATTERN =[vV][eE][rR][sS][iI][oO][nN]:[[:blank:]]*v[[:blank:]]*[0-9]+\.[0-9]+\.[0-9]+ |
| 40 | +VERSIONSTRING ="Version: v${VERSION}" |
| 41 | + |
| 42 | +FindAndSetVersion |
| 43 | + |
| 44 | + |
| 45 | +# |
| 46 | +# Adjust package/blocklypropclient-installer.iss file |
| 47 | +# |
| 48 | +VERSIONFILE =package/blocklypropclient-installer.iss |
| 49 | +VERSIONPATTERN =[mM][yY][aA][pP][pP][vV][eE][rR][sS][iI][oO][nN][[:blank:]]+\"[0-9]+\.[0-9]+\.[0-9]+\" |
| 50 | +VERSIONSTRING ="MyAppVersion \"${VERSION}\"" |
| 51 | + |
| 52 | +FindAndSetVersion |
0 commit comments