setVersion.sh 1.19 KB
Newer Older
1 2
#!/bin/bash

Carsten  Rose's avatar
Carsten Rose committed
3 4
# Documentation/_make/conf.py: release, version
# Documentation/Settings.yml: version
5 6 7 8 9
# extension/ext_emconf.php: version

ST="'"

function confPy() {
Carsten  Rose's avatar
Carsten Rose committed
10
    FILE=Documentation/_make/conf.py
11 12

    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

Carsten  Rose's avatar
Carsten Rose committed
18
    FILE="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

}

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

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

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

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

Carsten  Rose's avatar
Carsten Rose committed
57
#confPy
58
settingsCfg
59
extEmConf
Carsten  Rose's avatar
Carsten Rose committed
60
versionFile