Created
April 21, 2015 13:18
-
-
Save benregn/1d9229e4e81348d6345e to your computer and use it in GitHub Desktop.
Bump project version when version is stored in VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
is-executable() { | |
local BIN=`command -v "$1" 2>/dev/null` | |
if [[ ! $BIN == "" && -x $BIN ]]; then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
# a wrapper for versionbump | |
# https://github.com/vortec/versionbump | |
# defaults to patch | |
# assumes a VERSION file exists only containing current version | |
# $1 - place to bump | |
function bump () { | |
if is-executable versionbump; then | |
if [ -z "$1" ]; then | |
version_place='patch' | |
else | |
version_place=$1 | |
fi | |
current_version=`cat VERSION` | |
`versionbump -c $current_version $version_place VERSION` 2> /dev/null | |
return 0 | |
else | |
echo "versionbump not installed, install by running 'pip install versionbump'" | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment