#!/bin/bash SCRIPT_DIR=$(cd $(dirname ${0}); pwd) . ${SCRIPT_DIR}/utils.sh BASEDIR=${SCRIPT_DIR}/devTeamDemo usage () { declaim "${0} [-s]" } # 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_command git add source git_command git commit -m "\"Formatting changes.\"" git_command git push sleepies 15 # Master creates a release branch declaim "Master creates another release branch" cd ${BASEDIR}/javaBootcampNoEclipse.mastersClone git_command git checkout REL2018.11 git_command git pull --prune origin git_command git checkout master git_command git pull --prune origin git_command git branch REL2019.02 master git_command 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_command git fetch --prune git_command git checkout REL2019.02 git_command git branch REL2019.02_dev1 git_command git checkout REL2019.02_dev1 git_command git push --set-upstream origin REL2019.02_dev1 sleepies 15 cat -v <"); out.println(""); EOF git_command git add source git_command git commit -m "\"Further variablisation.\"" git_command 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_command git checkout master git_command git fetch --prune for branch in $(git branch -l | grep -v master) do git_command git branch -D ${branch} done for branch in $(git branch -r | grep -v HEAD | sed 's/^\ \ origin\///') do git_command git branch ${branch} origin/${branch} done git_command git checkout master # Master does the merge declaim "Master merges Developer 1 and Developer 2's work for first release" git_command git checkout REL2018.11 git_command git merge --no-ff -m "\"Merge REL2018.11_dev1 following approved code-review\"" REL2018.11_dev1 git_command git merge --no-ff -m "\"Merge REL2018.11_dev2 following approved code-review\"" REL2018.11_dev2 git_command 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_command git fetch --prune git_command git checkout REL2018.11_dev1 git_command git pull origin REL2018.11 git_command 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_command git fetch --prune git_command git checkout REL2018.11_dev2 git_command git pull origin REL2018.11 git_command 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_command git fetch --prune git_command git checkout REL2018.11_dev1 cat -v <