#!/usr/bin/env bash
set -e
if [ -d ~/tmp/hdalab_V$1 ]; then
rm -fr ~/tmp/hdalab_V$1;
fi
hg archive -r V$1 ~/tmp/hdalab_V$1
#text2unix ~/tmp/hdalab_V$1
if [ -d ~/tmp/hdalab_V$1 ]; then
cat <<EOT | rsync -Cvrlz --delete --filter=". -" ~/tmp/hdalab_V$1/web/ iri@web.iri.centrepompidou.fr:/iridata/www/iri-research/hdalab/
+ core
P .htpasswd
P hdalab/config.py
P robots.txt
P env/***
P log/***
P index/***
P static/media/***
EOT
fi
if [ -d ~/tmp/hdalab_V$1 ]; then
echo "Deleting temp export"
rm -fr ~/tmp/hdalab_V$1;
fi
ssh iri@web.iri.centrepompidou.fr "export PYTHONPATH=/iridata/www/iri-research/hdalab && source /iridata/virtualenv/hdalab/bin/activate && cd /iridata/www/iri-research/hdalab/hdalab && django-admin.py collectstatic --noinput"
ssh iri@web.iri.centrepompidou.fr sudo apache2ctl restart