Source

hpaco / bump-version

Full commit
#!/usr/bin/env bash
# Bump the version in several places:
# - the library cabal file (reporting the version to hackage)
# - the executable cabal file (reporting the version to hackage)
# - CommandArgs.hs (for --help)
# - phpaco in the /phpaco subdir
# - create a git repository tag
# Also auto-commits all the modified files.
VERSION=$1
cd `dirname $0`
sed -i'~' cli/hpaco.cabal -e '2,2s/^\(version:\s*\)[^\s]\+$/\1'$VERSION'/;s/^\(\s*\),\s*hpaco-lib.*$/\1, hpaco-lib == '$VERSION'/'
sed -i'~' hpaco-lib/hpaco-lib.cabal -e '2,2s/^\(version:\s*\)[^\s]\+$/\1'$VERSION'/'
sed -i'~' cli/CommandArgs.hs -e 's/^programVersion = .*$/programVersion = "'$VERSION'"/'
rm cli/hpaco.cabal~ cli/CommandArgs.hs~ hpaco-lib/hpaco-lib.cabal~
(
	echo "<?php"
	echo 'namespace Paco;'
	echo -n 'function getPacoVersion() { return "'
	echo -n $VERSION
	echo '"; }'
) > phpaco/common/Version.php

git commit -am"Bumped version"
git tag $VERSION
cd phpaco
git commit -am"Bumped version"
git tag $VERSION