#!/bin/bash SCRIPT_DIR=$(cd $(dirname ${0}); pwd) BASEDIR=${SCRIPT_DIR}/devTeamDemo declaim () { echo echo ${*} echo "===============" echo } usage () { declaim "${0} [-s]" } sleepies () { if [ "${SLEEPS}" = "Y" ]; then sleep ${1} fi } # We expect the group, project and branch as parameters export SLEEPS="N" while getopts "sh" opt; do case ${opt} in s) # We answer "Yes" to all questions SLEEPS="Y" ;; h) # We want to know how this works. usage exit 0 ;; *) usage exit 1 ;; esac done # shift to the first non-option parameter. shift $(( ${OPTIND} - 1 )); unset OPTIND declaim "Preparing..." cd rm -rf ${BASEDIR} mkdir -pv ${BASEDIR} cd ${BASEDIR} declaim "Initialising 'remote' git repository" # Create my sample git project cat <

- Bean example: <%= MyHelloWorld.getStrMyMessage() %>. + Bean example: <%= MyHelloWorld.getStrMyMessage() %>.

- The text in bold is the output of a call + The text in underline is the output of a call to MyHelloWorld.getStrMyMessage().

EOF git add source git commit -m "Formatting changes." git push sleepies 15 # Master creates a release branch declaim "Master creates another release branch" cd ${BASEDIR}/javaBootcampNoEclipse.mastersClone git checkout REL2018.11 git pull --prune origin git checkout master git pull --prune origin git branch REL2019.02 master git push origin REL2019.02 sleepies 15 # Developer 1 develops for the later release declaim "Developer 1 develops for the second release branch" cd ${BASEDIR}/javaBootcampNoEclipse.dev1 git fetch --prune git checkout REL2019.02 git branch REL2019.02_dev1 git checkout REL2019.02_dev1 git push --set-upstream origin REL2019.02_dev1 sleepies 15 cat -v <"); out.println(""); EOF git add source git commit -m "Further variablisation." git push sleepies 15 # Master prepares to merge development work to first release branch declaim "Master prepares for merge requests" cd ${BASEDIR}/javaBootcampNoEclipse.mastersClone git checkout master git fetch --prune for branch in $(git branch -l | grep -v master) do git branch -D ${branch} done for branch in $(git branch -r | grep -v HEAD | sed 's/^\ \ origin\///') do git branch ${branch} origin/${branch} done git checkout master # Master does the merge declaim "Master merges Developer 1 and Developer 2's work for first release" git checkout REL2018.11 git merge --no-ff -m "Merge REL2018.11_dev1 following approved code-review" REL2018.11_dev1 git merge --no-ff -m "Merge REL2018.11_dev2 following approved code-review" REL2018.11_dev2 git push origin sleepies 15 # Developer 1 merges the new merge into their own branch declaim "Developer 1 updates their working area following the merge" cd ${BASEDIR}/javaBootcampNoEclipse.dev1 git fetch --prune git checkout REL2018.11_dev1 git pull origin REL2018.11 git push origin sleepies 15 # Developer 2 merges the new merge into their own branch declaim "Developer 2 updates their working area following the merge" cd ${BASEDIR}/javaBootcampNoEclipse.dev2 git fetch --prune git checkout REL2018.11_dev2 git pull origin REL2018.11 git push origin sleepies 15 # Developer 1 develops for the first release declaim "Developer 1 makes an update for the first release" cd ${BASEDIR}/javaBootcampNoEclipse.dev1 git fetch --prune git checkout REL2018.11_dev1 cat -v <