updated script to work with both apps

This commit is contained in:
Martin Donnelly 2016-09-29 09:39:15 +01:00
parent 88a9245b51
commit 2d0825fa85

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
GIT_SERVER="https://censis.visualstudio.com/DefaultCollection/SmartOffice/_git/mDotServer" GIT_FRONTEND="https://censis.visualstudio.com/DefaultCollection/SmartOffice/_git/mDotServer"
GIT_BACKEND="http://gitlab.silvrtree.co.uk/martind2000/mqttArchiver.git"
NVM="$HOME/.nvm" NVM="$HOME/.nvm"
NVM_VERSION="6.6.0" NVM_VERSION="6.6.0"
DEV="$HOME/dev" DEV="$HOME/dev"
LIVE="$HOME/live" LIVE="$HOME/live"
STAGING="$HOME/staging" STAGING="$HOME/staging"
SERVER="mDotServer" SERVER="mqttArchiver"
FRONT="mdot_server" FRONT="mdot_server"
SWAP="/swapfile" SWAP="/swapfile"
NGINXFILE='mdot'; NGINXFILE='mdot';
@ -51,9 +52,10 @@ case $i in
shift # past argument=value shift # past argument=value
;; ;;
-i|--install) -i|--install)
UPDATESYSTEM=YES
UPDATE=YES UPDATE=YES
NGINX=YES NGINX=YES
DATABASE=YES #DATABASE=NO
INSTALL=YES INSTALL=YES
shift # past argument=value shift # past argument=value
;; ;;
@ -80,15 +82,15 @@ if [ ! -d "$DEV" ]; then
fi fi
if [ ! -d "$LIVE" ]; then if [ ! -d "$LIVE" ]; then
mkdir -p $LIVE mkdir -p $LIVE/$SERVER
mkdir -p $LIVE/$FRONT
fi fi
if [ ! -d "$STAGING" ]; then if [ ! -d "$STAGING" ]; then
rm -rf $STAGING rm -rf $STAGING
mkdir -p $STAGING
else
mkdir -p $STAGING
fi fi
mkdir -p $STAGING/$SERVER
mkdir -p $STAGING/$FRONT
if [[ $UPDATESYSTEM = "YES" ]]; then if [[ $UPDATESYSTEM = "YES" ]]; then
@ -161,45 +163,50 @@ fi
cd $DEV cd $DEV
# Get latest version of smartoffice Admin Server
#if [ ! -d "$DEV/$FRONT/.git" ]; then
# git clone $GIT_FRONTEND
#else
# cd $DEV/$FRONT
# git pull origin master
#fi
if [[ $UPDATE = "YES" ]]; then if [[ $UPDATE = "YES" ]]; then
fancy_echo "${PURPLE}Updating code...${RESET}" fancy_echo "${PURPLE}Updating code...${RESET}"
if [ ! -d "$DEV/$SERVER/.git" ]; then
# Get latest version of Front End
if [ ! -d "$DEV/$FRONT/.git" ]; then
git clone $GIT_FRONTEND
else
cd $DEV/$FRONT
git pull origin master
fi
# Get latest version of Back End
if [ ! -d "$DEV/$SERVER/.git" ]; then
git clone $GIT_SERVER git clone $GIT_SERVER
else else
cd $DEV/$SERVER cd $DEV/$SERVER
git pull origin master git pull origin master
fi
# Rebuild front end
cd $DEV/$FRONT
rsync -uav --exclude .git $DEV/$FRONT/ $STAGING/$FRONT
cd $STAGING/$FRONT
npm install . && npm-install-missing
bower install
gulp default
# Rebuild backend end
cd $DEV/$SERVER
rsync -uav --exclude .git $DEV/$FRONT/ $STAGING/$FRONT
cd $STAGING/$FRONT
npm install . && npm-install-missing
bower install
# Update live versions
fancy_echo "${YELLOW}Copying files to LIVE...${RESET}"
rsync -uav --exclude .git $STAGING/$SERVER/ $LIVE/$STAGING
rsync -uav --exclude .git --exclude app $STAGING/$FRONT/ $LIVE/$FRONT
fi fi
#cd $DEV/$FRONT
#npm install . && npm-install-missing
#bower install
cd $DEV/$SERVER
npm install . && npm-install-missing
bower install
gulp default
rsync -uav --exclude .git --exclude app $DEV/$SERVER/ $STAGING
fi
# fancy_echo "${YELLOW}Copying files to LIVE...${RESET}"
# rsync -uav --exclude .git $STAGING/ $LIVE
npm set progress=true npm set progress=true