setVersion.sh 1.21 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash

# extension/Documentation/_make/conf.py: release, version
# extension/Documentation/Settings.yml: version
# extension/ext_emconf.php: version

ST="'"

function confPy() {
    FILE=extension/Documentation/_make/conf.py

    sed -i -r 's/^\s*version\s*=.+$/version = '"'"$SHORT"'"'/g'  ${FILE}
13
    sed -i -r 's/^\s*release\s*=.+$/release = '"'"$VERSION"'"'/g'  ${FILE}
14
15
}

16
function settingsCfg() {
17

18
    FILE="extension/Documentation/Settings.cfg"
19

20
21
    sed -i -r 's/^\s*version\s*=.+$/version     = '$SHORT'/g'  ${FILE}
    sed -i -r 's/^\s*release\s*=.+$/release     = '$VERSION'/g'  ${FILE}
22
23
24
25
26
27
28
29
30

}

function extEmConf() {
    FILE="extension/ext_emconf.php"

    sed  -i -r 's/^\s*'${ST}'version'${ST}'\s*=>.+$/    '${ST}'version'${ST}' => '${ST}${VERSION}${ST}'/g'  ${FILE}
}

bbaer's avatar
bbaer committed
31
32
33
34
35
function versionFile() {
    FILE="version"
    echo ${VERSION} > ${FILE}
}

36
37
38
39
40
41
42
function myExit() {
    [ ! -z "$2" ] && echo "$2"

    exit $1
}

#==================================
Carsten  Rose's avatar
Carsten Rose committed
43
44
45
46
47
OLDIFS=$IFS
IFS=.
set $1
IFS=$OLDIFS

48
49
50
51
MAJOR="$1"
MINOR="$2"
MICRO="$3"

Carsten  Rose's avatar
Carsten Rose committed
52
[ -z "$MAJOR" -o -z "$MINOR" -o -z "$MICRO" ] && echo "Usage: $0 <major>.<minor>.<mirco>" && myExit 1 "Missing Version"
53
54
55
56
57

VERSION="$MAJOR.$MINOR.$MICRO"
SHORT="$MAJOR.$MINOR"

confPy
58
settingsCfg
59
extEmConf