git.iko.soy/typeable/servant
on master help sign in
Make bump-versions.sh work

This also makes it behave when called from from any directory.

commit627158845b55db76fbd612d5d54014c3825a159a authorChristian Marie <christian@ponies.io> dateMon 6 Jul 2015, 17:05 (11 years ago) parentfa6cfbb
2 files changed+9−4
scripts/bump-versions.sh+7−3 scripts/lib/common.sh+2−1
scripts/bump-versions.sh+7−3
@@ -16,7 +16,8 @@
1616set -o nounset
1717set -o errexit
1818
19−. lib/common.sh
19+DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
20+. "${DIR}/scripts/lib/common.sh"
2021
2122usage () {
2223 echo " bump-versions.sh <POSITION> [-d|--dry-run]"
@@ -54,8 +55,11 @@ while [ "${1:-unset}" != "unset" ] ; do
5455done
5556
5657if $DRY_RUN ; then
57− bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}")
58+ echo "Would have bumped position ${POSITION} on these packages:"
59+ ( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}") )
5860else
59− bumper -"$POSITION" $(join , "${SOURCES[@]}")
61+ ( cd "$ROOT" && bumper -"$POSITION" $(join , "${SOURCES[@]}") )
6062fi
6163
64+# Trailing newline, bumper does not ship with its own.
65+echo
scripts/lib/common.sh+2−1
@@ -11,6 +11,7 @@
1111
1212
1313DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
14+ROOT=$( dirname $DIR )
1415DRY_RUN=false
1516POSITION="none"
1617SOURCES_TXT="$( dirname $DIR)/sources.txt"
@@ -23,7 +24,7 @@ readarray -t SOURCES < "$SOURCES_TXT"
2324join () { local IFS="$1"; shift; echo "$*"; }
2425
2526versions_equal () {
26− local NUM=$(find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
27+ local NUM=$(cd "$ROOT" && find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
2728 if [ 1 -eq $NUM ] ; then
2829 return 0
2930 else