aboutsummaryrefslogtreecommitdiffstats
path: root/script/rails-post-deploy
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-06-03 10:50:17 +0100
committerLouise Crow <louise.crow@gmail.com>2013-06-03 10:50:17 +0100
commit050b25bd70909913b7e42d53cb69c31b1396cc46 (patch)
treeac2f2b587ffa3504c5cf5164b36f5f436c0582f4 /script/rails-post-deploy
parent4db18138584b6394286bbe374f22e6609ab79136 (diff)
parente30a8623a1706d3bad4476198085547d8f47cc88 (diff)
Merge branch 'release/0.11' into wdtk
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