Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,159 @@
|
||||
#! /bin/bash
|
||||
|
||||
#Variables
|
||||
clean=false
|
||||
flywayClean=false
|
||||
flywayMigrate=false
|
||||
flywayRepair=false
|
||||
skip=false
|
||||
deploy=false
|
||||
cleanTomcat=false
|
||||
docs=false
|
||||
warDeploy=false
|
||||
currentDir=`pwd`
|
||||
branchName=""
|
||||
PROG="`basename $0`"
|
||||
|
||||
#Functions
|
||||
function cleanup(){
|
||||
echo "exiting"
|
||||
exit
|
||||
}
|
||||
|
||||
function errorexit(){
|
||||
true
|
||||
echo "errorexit"
|
||||
}
|
||||
|
||||
function clean_tomcat_dir(){
|
||||
echo "Cleaning tomcat directory"
|
||||
rm -rf $CATALINA_HOME/logs/*
|
||||
rm -rf $CATALINA_HOME/temp/*
|
||||
rm -rf $CATALINA_HOME/work/*
|
||||
}
|
||||
|
||||
function usage(){
|
||||
local error="$*"
|
||||
if [[ $error ]]; then
|
||||
echo ""
|
||||
echo "Error: ${error}"
|
||||
echo ""
|
||||
fi
|
||||
echo "Usage: $PROG [OPTION...]"
|
||||
echo ""
|
||||
echo "Options"
|
||||
echo " -h, --help show this usage text"
|
||||
echo " -j, --docs build the javadocs"
|
||||
echo " -b, --branch branch name to checkout and build"
|
||||
echo " -c, --clean performs mvn clean and cleans tomcat directory"
|
||||
echo " -f, --flyway-clean performs mvn flyway:clean (clears out database)"
|
||||
echo " -m, --flyway-migrate performs mvn flyway:migrate (runs one or more servers to update"
|
||||
echo " -r, --flyway-repair performs mvn flyway:repair (fixes checksums)"
|
||||
echo " -s, --skip skips jslint test on javascript"
|
||||
echo " -d, --deploy deploys app to tomcat directory"
|
||||
echo " -w, --war performs tomcat7:redeploy to deploy the war without having to "
|
||||
echo " clean/remove existing "
|
||||
echo " -t, --clean-tomcat cleans tomcats work, temp, and log directories"
|
||||
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
echo "Mac users: use short options only!"
|
||||
fi
|
||||
|
||||
if [[ $error ]]; then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
#main
|
||||
short_opts='cb:fmrsdhtjw'
|
||||
long_opts='help,clean,flyway-clean,flyway-migrate,flyway-repair,noskip,nodeploy,clean-tomcat,branch:,docs,war'
|
||||
|
||||
# note: for mac use short opts without the -o option
|
||||
if [ "`uname`" == "Darwin" ]; then
|
||||
#TEMP=`getopt ${short_opts} ${PROG} -- "$@"`
|
||||
TEMP=`getopt ${short_opts} $*`
|
||||
else
|
||||
TEMP=`getopt -o ${short_opts} --long ${long_opts} -n ${PROG} -- "$@"`
|
||||
fi
|
||||
|
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
eval set -- "$TEMP"
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-c|--clean) clean=true ; shift ;;
|
||||
-j|--docs) docs=true ; shift ;;
|
||||
-b|--branch) branchName=$2 ; shift 2 ;;
|
||||
-f|--flyway-clean) flywayClean=true ; shift ;;
|
||||
-m|--flyway-migrate) flywayMigrate=true ; shift ;;
|
||||
-r|--flyway-repair) flywayRepair ; shift ;;
|
||||
-s|--skip) skip=true ; shift ;;
|
||||
-d|--deploy) deploy=true ; shift ;;
|
||||
-t|--clean-tomcat) cleanTomcat=true ; shift ;;
|
||||
-w|--war) warDeploy=true ; shift ;;
|
||||
-h|--help) usage; shift;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd $PORTAL_HOME
|
||||
|
||||
if [ -n "$branchName" ]; then
|
||||
git checkout -f $branchName
|
||||
git pull origin $branchName
|
||||
fi
|
||||
|
||||
if [ $clean = true ]; then
|
||||
echo "Performing mvn clean..."
|
||||
mvn clean
|
||||
fi
|
||||
|
||||
if [ $flywayClean = true ]; then
|
||||
echo "Performing flyway clean"
|
||||
mvn flyway:clean
|
||||
fi
|
||||
|
||||
if [ $flywayMigrate = true ]; then
|
||||
echo "Performing flyway migrate"
|
||||
mvn flyway:migrate
|
||||
fi
|
||||
|
||||
if [ $flywayRepair = true ]; then
|
||||
echo "Performing flyway repair"
|
||||
mvn flyway:repair
|
||||
fi
|
||||
|
||||
if [ $docs = true ]; then
|
||||
echo "Building documents"
|
||||
cd $PORTAL_HOME/scripts
|
||||
./build-docs.sh
|
||||
fi
|
||||
|
||||
if [ $deploy = true ]; then
|
||||
echo "Undeploying server"
|
||||
cd $PORTAL_HOME/scripts
|
||||
./undeploy-server.sh
|
||||
if [ $cleanTomcat = true ]; then
|
||||
clean_tomcat_dir
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $PORTAL_HOME
|
||||
|
||||
mvn -DskipTests=$skip install
|
||||
|
||||
if [ $warDeploy = true ]; then
|
||||
mvn tomcat7:redeploy
|
||||
fi
|
||||
|
||||
if [ $deploy = true ]; then
|
||||
echo "Deploying webapp to server"
|
||||
cd $PORTAL_HOME/scripts
|
||||
./deploy-server.sh
|
||||
fi
|
||||
|
||||
cd $currentDir
|
||||
Reference in new issue
Block a user