Skip to content

Commit 9b9dfa3

Browse files
committed
Created first draft of set_version script to update multiple file's version numbers. Updated .gitignore to ignore script's backup files. Updated text in about.txt from CurrentVersion to Version.
1 parent 2055266 commit 9b9dfa3

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ venv/
66
VPython/
77
*.app
88
*.pkg
9+
*.bak
910

1011
#################
1112
## Eclipse

about.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CurrentVersion: v0.5.3
1+
Version: v0.5.3
22

33
Contributors:
44
- Michel Lampo
@@ -8,4 +8,4 @@ Contributors:
88

99
Repository Source Code: http://github.com/parallaxinc/BlocklyPropClient
1010

11-
Copyright 2015 - 2017 Parallax Inc
11+
Copyright 2015 - 2017 Parallax Inc.

set_version

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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

Comments
 (0)