git.iko.soy/typeable/servant
on v0.6 help sign in
typeable/servant/scripts/bump-versions.sh
62 lines 1.8 kB history raw
1#!/usr/bin/env bash
2#===============================================================================
3#
4# FILE: bump-versions.sh
5#
6# USAGE: ./bump-versions.sh
7#
8# DESCRIPTION: Bump the versions for all servant packages
9#
10# OPTIONS: See usage
11# REQUIREMENTS: bumper, bash >= 4
12# CREATED: 11.05.2015 21:36
13# REVISION: ---
14#===============================================================================
16set -o nounset
17set -o errexit
19DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
20. "${DIR}/scripts/lib/common.sh"
22usage () {
23 echo " bump-versions.sh <POSITION> [-d|--dry-run]"
24 echo " | [-h|--help]"
25 echo " Bumps the specified positional version of all servant packages."
26 echo " POSITION is a number between 0 and 3, inclusive."
27 exit 0
30if [ $# -eq 0 ] ; then
31 echo "expecting one or more arguments. Got 0"
32 usage
33elif [ $# -gt 2 ] ; then
34 echo "expecting one or more arguments"
35 usage
36fi
38versions_equal
40while [ "${1:-unset}" != "unset" ] ; do
41 case "$1" in
42 -h | --help) usage ;;
43 -d | --dry-run) DRY_RUN=true
44 shift ;;
45 0) if POSITION="none" ; then POSITION=0 ; else usage ; fi
46 shift ;;
47 1) if POSITION="none" ; then POSITION=1 ; else usage ; fi
48 shift ;;
49 2) if POSITION="none" ; then POSITION=2 ; else usage ; fi
50 shift ;;
51 3) if POSITION="none" ; then POSITION=3 ; else usage ; fi
52 shift ;;
53 *) usage ;;
54 esac
55done
57if $DRY_RUN ; then
58 echo "Would have bumped position ${POSITION} on these packages:"
59 ( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , $SOURCES tutorial) )
60else
61 ( cd "$ROOT" && bumper -"$POSITION" $(join , $SOURCES tutorial) )
62fi