From 40f0272a3a15ea8b75bbd39c2cc2abd3074f8766 Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Tue, 2 Apr 2013 19:02:41 +0100 Subject: Enable rails-post-deploy to be run from any directory The BASH_SOURCE variable reliably gives the path of the script, so we can make the script work regardless of what the current working directory is on running the script. --- script/rails-post-deploy | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'script/rails-post-deploy') diff --git a/script/rails-post-deploy b/script/rails-post-deploy index bd99b0ce2..a9e239423 100755 --- a/script/rails-post-deploy +++ b/script/rails-post-deploy @@ -11,10 +11,15 @@ set -e #set -x # debug -APP_DIR=`pwd` +APP_DIR="$(readlink -f $(dirname "$BASH_SOURCE")/..)" +cd "$APP_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" ] -- cgit v1.2.3