aboutsummaryrefslogtreecommitdiffstats
path: root/script/rails-post-deploy
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-06-04 15:03:02 +0100
committerLouise Crow <louise.crow@gmail.com>2013-06-04 15:03:02 +0100
commita885764b65916020d9182073b38f6951a20d4b8c (patch)
tree0988651c144b65a8e46b28b376b2e72a5947d934 /script/rails-post-deploy
parenteb1c465162420ad62c16dccb983cb28aa89a4639 (diff)
parenta919141992a40599f99b32bd4a8312a0009f3f7a (diff)
Merge branch 'release/0.11'0.11.0.3
Diffstat (limited to 'script/rails-post-deploy')
-rwxr-xr-xscript/rails-post-deploy21
1 files changed, 13 insertions, 8 deletions
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index a1c613312..4048c852f 100755
--- a/script/rails-post-deploy
+++ b/script/rails-post-deploy
@@ -6,15 +6,20 @@
# recent version.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
set -e
#set -x # debug
-APP_DIR=`pwd`
+TOP_DIR="$(dirname "$BASH_SOURCE")/.."
+cd "$TOP_DIR"
# make sure that there is an app directory, so are in a rails app tree
-cd app/..
+if ! [ -d app ]
+then
+ echo "Error: the 'app' directory didn't exist"
+ exit 1
+fi
# read config file in for later (STAGING_SITE)
if [ -e "config/general" ] || [ -e "config/general.yml" ]
@@ -27,11 +32,11 @@ else
fi
# create initial log files
-if [ -e $APP_DIR/../logs ]
+if [ -e $TOP_DIR/../logs ]
then
# mySociety servers have logs dir in level above
rm -f log
- ln -s $APP_DIR/../logs log
+ ln -s $TOP_DIR/../logs log
else
# otherwise just make the directory
if [ -h log ]
@@ -42,10 +47,10 @@ else
mkdir -p log
fi
# link the "downloads" directory in the cache to somewhere it can be served
-if [ ! -e "$APP_DIR/public/download" ]
+if [ ! -e "$TOP_DIR/public/download" ]
then
- mkdir -p "$APP_DIR/cache/zips/download"
- ln -s "$APP_DIR/cache/zips/download" "$APP_DIR/public/"
+ mkdir -p "$TOP_DIR/cache/zips/download"
+ ln -s "$TOP_DIR/cache/zips/download" "$TOP_DIR/public/"
fi
cd log