Skip to content

Instantly share code, notes, and snippets.

@bhurlow
Forked from Hypercubed/README.md
Created June 20, 2013 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhurlow/5826328 to your computer and use it in GitHub Desktop.
Save bhurlow/5826328 to your computer and use it in GitHub Desktop.

DocPad: rsync Deploy Script

  • Place deploy.sh in {docpad folder}/bin/
  • Create (or edit) a .env file in your docpad folder with the following values:
#!/bin/bash
DEPLOY_SOURCE_DIR="out/"
DEPLOY_DEST_DIR="~/public_html/"
DEPLOY_SERVER=deploy-server-name
DEPLOY_ACCOUNT=deploy-login-name
  • Create a .deployignore file in docpad folder with the following values:
**.svn
.git
.gitignore
  • Test with ./bin/deploy.sh -n deploy with./bin/deploy.sh
#!/bin/bash
set -o nounset
set -o errexit
NFLAG=""
while getopts ":n" opt; do
case $opt in
n)
NFLAG="-n"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
# Set the environment by loading from the file "environment" in the same directory
DIR="$( cd "$( dirname $( dirname "$0" ) )" && pwd)"
source "$DIR/.env"
echo "Deploying ${DIR}/${DEPLOY_SOURCE_DIR} to ${DEPLOY_ACCOUNT}@${DEPLOY_SERVER}:${DEPLOY_DEST_DIR}"
docpad generate --env static
chmod -R og+Xr out
rsync $NFLAG -rvzp --size-only --delete --exclude-from="$DIR/.deployignore" "${DIR}/${DEPLOY_SOURCE_DIR}" "${DEPLOY_ACCOUNT}@${DEPLOY_SERVER}:${DEPLOY_DEST_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment