-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.sh
executable file
·36 lines (28 loc) · 1.02 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Exit on error
set -e
# Save climata version and REST config to AMD modules
cd db
CLIMATA_VERSION=`python3 -c "from climata.version import VERSION; print(VERSION)"`;
CONFIG=`./manage.py dump_config`;
cd ../
echo "define(function(){return '$CLIMATA_VERSION';});" > app/js/data/climata_version.js
echo "define($CONFIG);" > app/js/data/config.js
# Build javascript with wq.app
cd app;
wq build $1;
# Force important files through any unwanted server caching
cd ../;
sed -i "s/climata_viewer.js/climata_viewer.js?v="$1"/" htdocs-build/climata_viewer.appcache
sed -i "s/climata_viewer.css/climata_viewer.css?v="$1"/" htdocs-build/climata_viewer.appcache
# Don't appcache fallback PNGs
sed -i "s/css\/lib\/images\/icons-png\/.*//" htdocs-build/climata_viewer.appcache
# Preserve Django's static files (e.g. admin)
if [ -d htdocs/static ]; then
cp -a htdocs/static htdocs-build/static
fi;
# Replace existing htdocs with new version
rm -rf htdocs/;
mv -i htdocs-build/ htdocs;
# Restart Django
touch db/climata_viewer/wsgi.py