#!/bin/sh BRANCH=$1 BUILD_ANGULAR_ARG=$2 BUILD_ANGULAR=true if [ "$BUILD_ANGULAR_ARG" = -ng ]; then BUILD_ANGULAR=true fi echo "Build Angular = $BUILD_ANGULAR" echo "Branch Name = $BRANCH" if [ "$BRANCH" = test ]; then cd /home/ofbbutte/webapps/ofb_angular_test/ fi if [ "$BRANCH" = master ]; then cd /home/ofbbutte/webapps/ofb_angular/ fi echo "Node Version" bin/node --version echo "NPM Version" bin/node bin/npm --version --scripts-prepend-node-path if [ "$BUILD_ANGULAR" = true ]; then cd tempcheckout/Client echo "Pruning Client Node Modules" ../../bin/node ../../bin/npm prune --silent --scripts-prepend-node-path echo "Installing Client Node Modules" ../../bin/node ../../bin/npm install --silent --scripts-prepend-node-path echo "Building Angular Application" ../../bin/node node_modules/@angular/cli/bin/ng build --prod cd ../../ rm -r -f www/ mv tempcheckout/Server/www/ www/ else echo "Skipping Building Angular Application" fi echo "Angular CLI Version" bin/node tempcheckout/Client/node_modules/@angular/cli/bin/ng --version cd tempcheckout/Server/src echo "Pruning Server Node Modules" ../../../bin/node ../../../bin/npm prune --silent --scripts-prepend-node-path echo "Installing Server Node Modules" ../../../bin/node ../../../bin/npm install --silent --scripts-prepend-node-path cd ../../../ rm -r -f src/ mv tempcheckout/Server/src/ src/ echo "Remove start and stop script files" rm -f bin/start rm -f bin/stop echo "Copying start and stop script files" if [ "$BRANCH" = master ]; then mv tempcheckout/Server/bin/start bin/start mv tempcheckout/Server/bin/stop bin/stop fi if [ "$BRANCH" = test ]; then mv tempcheckout/Server/bin/start_test bin/start mv tempcheckout/Server/bin/stop_test bin/stop fi ls echo "Modifying permissions on start and stop script files to be executable" chmod +x bin/start chmod +x bin/stop echo "Running stop script file" bin/stop echo "Running start script file" bin/start