@@ -0,0 +1,78 @@
2+#===============================================================================
4+# FILE: bump-versions.sh
6+# USAGE: ./bump-versions.sh
8+# DESCRIPTION: Bump the versions for all servant packages
11+# REQUIREMENTS: bumper, bash >= 4
12+# CREATED: 11.05.2015 21:36
14+#===============================================================================
19+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
22+SOURCES_TXT="$( dirname $DIR)/sources.txt"
25+readarray -t SOURCES < "$SOURCES_TXT"
28+ echo " bump-versions <POSITION> [-d|--dry-run]"
29+ echo " | [-h|--help]"
30+ echo " Bumps the specified positional version of all servant packages."
31+ echo " POSITION is a number between 0 and 3, inclusive."
35+join () { local IFS="$1"; shift; echo "$*"; }
38+ local NUM=$(find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
39+ if [ 1 -eq $NUM ] ; then
42+ echo "versions of packages are not all the same!" && exit 1
46+if [ $# -eq 0 ] ; then
47+ echo "expecting one or more arguments. Got 0"
49+elif [ $# -gt 2 ] ; then
50+ echo "expecting one or more arguments"
56+while [ "${1:-unset}" != "unset" ] ; do
58+ -h | --help) usage ;;
59+ -d | --dry-run) DRY_RUN=true
61+ 0) if POSITION="none" ; then POSITION=0 ; else usage ; fi
63+ 1) if POSITION="none" ; then POSITION=1 ; else usage ; fi
65+ 2) if POSITION="none" ; then POSITION=2 ; else usage ; fi
67+ 3) if POSITION="none" ; then POSITION=3 ; else usage ; fi
74+ bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}")
76+ bumper -"$POSITION" $(join , "${SOURCES[@]}")