diff -r c69dcc3b0524 -r d8a8c57f36c4 build/build.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/build.sh Tue Oct 18 14:42:01 2016 +0530 @@ -0,0 +1,130 @@ +#!/usr/bin/env bash + +set -e +## option --prod/--dev + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +VAGRANT_STARTED=false + +green="\x1B[0;32m" # '\e[1;32m' is too bright for white bg. +blue="\x1B[1;34m" +endColor="\x1B[0m" + +function echoblue() { + echo -e "${blue}$1${endColor}" +} + +function install() { + pushd "$DIR" + + echoblue "---> preparing bo client" + pushd ../server/bo_client + npm install + ./node_modules/.bin/bower install + popd + echoblue "---> preparing bo client done" + + echoblue "---> preparing back" + pushd ../server/src + php composer.phar install + npm install + ./node_modules/.bin/bower install + popd + echoblue "---> preparing back done" + + echoblue "---> preparing app-client" + pushd ../cms/app-client + npm install + ./node_modules/.bin/bower install + popd + echoblue "---> preparing app-client done" + + echoblue "---> preparing module" + pushd ../cms + npm install + + + echoblue "---> checking vagrant" + if vagrant status | grep -q "running"; then + echoblue "---> starting vagrant" + vagrant up + VAGRANT_STARTED=true + fi + + echoblue "---> done" + + popd + +} + +function usage() { + cat <&2; exit 1; } || environment='production' ;; + d) [[ -n "$environment" ]] && { usage >&2; exit 1; } || environment='development' ;; + \?) usage >&2; exit 1 ;; + esac +done +shift $((OPTIND-1)) + +[[ -z "$environment" ]] && environment='production' + +case $environment in + development) build_option='--dev' ;; + *) build_option='--prod' ;; +esac + +echo "environment: $environment" +echo "do_install: $do_install" +[[ "$do_install" == true ]] && echoblue "DO INSTALL" && install; + +pushd "$DIR" + +echoblue "---> cleaning build folder" +rm -fr root + +echoblue "---> creating build folder" +mkdir -p root/var/www/corpusdelaparole/corpus-back +mkdir -p root/var/www/corpusdelaparole/drupal/sites/all/modules + +echoblue "---> buiding back" +pushd ../server/src +version=$(sed -n "s/[[:space:]]*\'version\'[[:space:]]*=>[[:space:]]*\'\([\.0-9]*\)\'/\1/p" config/version.php) +version=${version:-0.0.0} +./node_modules/.bin/gulp copy-build ${build_option} +popd +echoblue "---> buiding back done" + +echoblue "---> building app-client" +pushd ../cms/app-client +./node_modules/.bin/ember build ${build_option} +popd +echoblue "---> building app-client done" + +echoblue "---> building module" +pushd ../cms +./node_modules/.bin/gulp copy-build ${build_option} --version="$version" +popd + +echoblue "---> building package" +vagrant ssh -c "/vagrant/build_rpm.sh" + +echoblue "---> done" + +popd