diff options
author | Mark Longair <mhl@pobox.com> | 2013-04-02 19:02:41 +0100 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-04-02 19:02:41 +0100 |
commit | 40f0272a3a15ea8b75bbd39c2cc2abd3074f8766 (patch) | |
tree | 3e28a0ae5be89ca73b3bcc0ef046ed6fa857793a | |
parent | a844d68ee68653cbf51c9a3f4f97a65a5f0fc5f3 (diff) |
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.
-rwxr-xr-x | script/rails-post-deploy | 9 |
1 files changed, 7 insertions, 2 deletions
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" ] |