diff options
Diffstat (limited to 'script/rails-post-deploy')
-rwxr-xr-x | script/rails-post-deploy | 21 |
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 |