This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit 4a9f1b697d73e81b49a2ad810b35ef7b6cafdd74 Author: Benjamin POUSSIN <poussin@codelutin.com> Date: Thu Jul 9 18:56:06 2015 +0200 - add auto installation of bower and javascript lib if necessary --- scripts/mum-env.sh | 3 +++ scripts/mum-in-venv.sh | 4 ++-- scripts/mum-install-venv.sh | 30 ++++++++++++++++++++++++++++++ scripts/mum.sh | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/scripts/mum-env.sh b/scripts/mum-env.sh index 7bf6e40..7caf2c2 100755 --- a/scripts/mum-env.sh +++ b/scripts/mum-env.sh @@ -58,6 +58,9 @@ mkdir -p $(dirname $VENV_DIR) export CONF export MUM_DIR +export APP_PYTHON_DIR=$MUM_DIR/app +export APP_VIEWS_DIR=$MUM_DIR/views +export APP_STATIC_DIR=$MUM_DIR/static export VENV_DIR export LOG_DIR export MUM_PY diff --git a/scripts/mum-in-venv.sh b/scripts/mum-in-venv.sh index 386329d..ba86ad2 100755 --- a/scripts/mum-in-venv.sh +++ b/scripts/mum-in-venv.sh @@ -1,9 +1,8 @@ #!/bin/bash SCRIPT_DIR=$(dirname $(readlink -m $0)) -cd $SCRIPT_DIR -. mum-env.sh +. $SCRIPT_DIR/mum-env.sh cmd="$1" shift @@ -11,4 +10,5 @@ shift . $VENV_DIR/bin/activate export PYTHONPATH=$PWD/lib:$PYTHONPATH +cd $VENV_DIR exec "$cmd" "$@" diff --git a/scripts/mum-install-venv.sh b/scripts/mum-install-venv.sh index d9cd510..30ad3b8 100755 --- a/scripts/mum-install-venv.sh +++ b/scripts/mum-install-venv.sh @@ -4,6 +4,12 @@ SCRIPT_DIR=$(dirname $(readlink -m $0)) . $SCRIPT_DIR/mum-env.sh +# +# Create python env +# + +echo "Mum - Installing python environment ..." + $VENV_DIR/bin/python --version >/dev/null 2>&1 || $VENV_EXEC --python=$PYTHON_EXEC $VENV_DIR $SCRIPT_DIR/mum-in-venv.sh pip install -r $MUM_DIR/requirements.txt @@ -13,4 +19,28 @@ sed -i 's/}}/]]/g' $VENV_DIR/bin/bottle.py sed -i 's/{{/[[/g' $VENV_DIR/lib/python*/site-packages/bottle.py sed -i 's/}}/]]/g' $VENV_DIR/lib/python*/site-packages/bottle.py +# +# creatre bower env if necessary or create simple link +# + +echo "Mum - Installing javascript library ..." + +if [ -d $MUM_DIR/bower_components ]; then + ln -s $MUM_DIR/bower_components $VENV_DIR +else + cd $VENV_DIR + npm install bower + node_modules/bower/bin/bower install $MUM_DIR/bower.json +fi + +# +# create all other necessary link +# + +echo "Mum - Create application symlink ..." + +ln -s $APP_PYTHON_DIR $VENV_DIR +ln -s $APP_VIEWS_DIR $VENV_DIR +ln -s $APP_STATIC_DIR $VENV_DIR + exit 0 diff --git a/scripts/mum.sh b/scripts/mum.sh index d281aec..3195cd0 100755 --- a/scripts/mum.sh +++ b/scripts/mum.sh @@ -7,6 +7,6 @@ SCRIPT_DIR=$(dirname $(readlink -m $0)) if [ ! -d "$VENV_DIR" ]; then echo "Preparing the virtual environment for the first launch (this may take several minutes)" echo "Log files will be saved on $LOG_DIR" - $SCRIPT_DIR/mum-install-venv.sh > $LOG_DIR/mum.install.log 2> $LOG_DIR/mum.install.err + $SCRIPT_DIR/mum-install-venv.sh 2> $LOG_DIR/mum.install.err | tee $LOG_DIR/mum.install.log | grep "Mum - " fi exec $SCRIPT_DIR/mum-in-venv.sh python $MUM_DIR/$MUM_PY $* -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.