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'~' hpaco/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'~' hpaco/CommandArgs.hs -e 's/^programVersion = .*$/programVersion = "'$VERSION'"/'
rm hpaco/hpaco.cabal~ hpaco/CommandArgs.hs~ hpaco-lib/hpaco-lib.cabal~
git commit -am"Bumped version"
git tag $VERSION
if [ -e phpaco ]
	then
		cd phpaco
		(
			echo "<?php"
			echo 'namespace Paco;'
			echo -n 'function getPacoVersion() { return "'
			echo -n $VERSION
			echo '"; }'
		) > common/Version.php
		git commit -am"Bumped version"
		git tag $VERSION
fi