2013-01-30 23:11:34 +01:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
# Update static files in production.
|
|
|
|
|
|
|
|
cd "$(dirname "$0")"/..
|
|
|
|
|
|
|
|
# Redirect output to a log file (most recent run only)
|
|
|
|
exec >update-prod-static.log
|
|
|
|
|
|
|
|
# Collect both original and minified files
|
|
|
|
rm -rf prod-static/collected
|
|
|
|
./manage.py collectstatic --noinput
|
|
|
|
|
|
|
|
# Copy the files we want to expose
|
|
|
|
rm -rf prod-static/serve-new
|
|
|
|
mkdir -p prod-static/serve-new/{js,styles}
|
2013-02-05 17:49:37 +01:00
|
|
|
cp -r prod-static/collected/{favicon.ico,robots.txt,html,images,third,min} prod-static/serve-new/
|
2013-01-30 23:11:34 +01:00
|
|
|
cp prod-static/collected/js/{common,debug,signup}.js prod-static/serve-new/js/
|
2013-02-04 23:09:56 +01:00
|
|
|
cp prod-static/collected/styles/{activity,portico,pygments}.css prod-static/serve-new/styles/
|
2013-01-30 23:11:34 +01:00
|
|
|
|
|
|
|
# Sync the new directory to the one nginx actually serves.
|
|
|
|
# Hopefully this doesn't race too badly for clients loading
|
|
|
|
# right as a deploy happens.
|
|
|
|
mkdir -p prod-static/serve
|
|
|
|
rsync -ar --delete prod-static/serve-new/* prod-static/serve/
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
rm -rf prod-static/{collected,serve-new}
|