Skip to content

Instantly share code, notes, and snippets.

@Hypercubed
Last active December 12, 2021 02:23
Show Gist options
  • Select an option

  • Save Hypercubed/5804999 to your computer and use it in GitHub Desktop.

Select an option

Save Hypercubed/5804999 to your computer and use it in GitHub Desktop.

Revisions

  1. Hypercubed revised this gist Jun 18, 2013. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions deploy.sh
    100644 → 100755
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    #!/bin/bash

    set -o nounset
    set -o errexit

    NFLAG=""

    while getopts ":n" opt; do
    case $opt in
    n)
    @@ -13,10 +17,10 @@ done

    # Set the environment by loading from the file "environment" in the same directory
    DIR="$( cd "$( dirname $( dirname "$0" ) )" && pwd)"
    source $DIR/.env
    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}
    rsync $NFLAG -rvzp --size-only --delete --exclude-from="$DIR/.deployignore" "${DIR}/${DEPLOY_SOURCE_DIR}" "${DEPLOY_ACCOUNT}@${DEPLOY_SERVER}:${DEPLOY_DEST_DIR}"
  2. Hypercubed created this gist Jun 18, 2013.
    22 changes: 22 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # 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:

    ```bash
    #!/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:

    ```bash
    **.svn
    .git
    .gitignore
    ```

    - Test with `./bin/deploy.sh -n` deploy with`./bin/deploy.sh`
    22 changes: 22 additions & 0 deletions deploy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/bin/bash

    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}