Browse Source

increase-version-number: handle version numbers with single digit as last version number part accordingly.

tags/sipwise-2.4
Michael Prokop 10 years ago
parent
commit
3e1c39b8ca
2 changed files with 11 additions and 2 deletions
  1. +7
    -2
      increase-version-number
  2. +4
    -0
      tests/increase-version-number

+ 7
- 2
increase-version-number View File

@@ -29,9 +29,14 @@ else
LAST_PART=$(echo $BASE_VERSION | sed 's/.*\.\([0-9]*\)$/\1/')
fi

# raise version number (2 -> 3)
if echo "$LAST_PART" | grep -q -- '^0' ; then
## raise version number (2 -> 3)
# 0.9.0 -> 0.9.1
if echo "$LAST_PART" | grep -q -- '^0$' ; then
RAISE_VERSION=$((LAST_PART + 1))
# 0.9.00 -> 0.9.01
elif echo "$LAST_PART" | grep -q -- '^0' ; then
RAISE_VERSION="0$((LAST_PART + 1))"
# 0.8 -> 0.9
else
RAISE_VERSION=$((LAST_PART + 1))
fi


+ 4
- 0
tests/increase-version-number View File

@@ -12,6 +12,10 @@ testEquality()
assertEquals "$($SCRIPT 1:0.42-2)" 1:0.43-1
assertEquals "$($SCRIPT 2008.01.02)" 2008.01.03
assertEquals "$($SCRIPT 0.42~2)" 0.43
assertEquals "$($SCRIPT 0.9.0)" 0.9.1
assertEquals "$($SCRIPT 0.9.00)" 0.9.01
assertEquals "$($SCRIPT 0.8)" 0.9
assertEquals "$($SCRIPT 0.9)" 0.10
}

. /usr/share/shunit2/shunit2

Loading…
Cancel
Save