Source

silverlining / rebuild

Full commit
#!/bin/bash

if [ "$1" = "-f" ] ; then
    ssh flow.openplans.org 'ssh acura "~/bin/rsync-silverlining"'
    exit
fi

if [ -z "$BBDOCS_SCRATCH" ] ; then
    # Not the normal environment
    DEVEL=t
    BBDOCS_SCRATCH="scratch-build"
    if [ ! -e $BBDOCS_SCRATCH ] ; then
        mkdir -p $BBDOCS_SCRATCH
    fi
fi

ENV_PATH="$BBDOCS_SCRATCH/env"
if [ ! -e "$BBDOCS_SCRATCH/virtualenv.py" ] ; then
    wget http://svn.colorstudy.com/virtualenv/trunk/virtualenv.py -O $BBDOCS_SCRATCH/virtualenv.py
fi
VIRTUALENV="python $BBDOCS_SCRATCH/virtualenv.py"
export VIRTUALENV

if [ ! -e "$ENV_PATH/bin" ] ; then
    $VIRTUALENV $ENV_PATH
fi

mkdir -p docs/_static

$ENV_PATH/bin/pip install Sphinx
$ENV_PATH/bin/sphinx-build -E -b html docs/ docs/_build || exit 1

if [ -z "$DEVEL" ] ; then

    export BUILD_DIR="$BBDOCS_SCRATCH/zip-build"
    if [ ! -e $BUILD_DIR ] ; then
        mkdir -p $BUILD_DIR
    fi

    export ZIP_DIR="$(pwd)/docs/_build/zip"
    if [ ! -e $ZIP_DIR ] ; then
        mkdir -p $ZIP_DIR
    fi

    export VERSION="0.1-$(date +%Y-%m-%d)"

    source $ENV_PATH/bin/activate

    ./silverlining/create-zip.sh
    cp docs/_static/HEADER.html $ZIP_DIR
    sed -i "s/MOST_RECENT/$VERSION/g" $ZIP_DIR/HEADER.html
    echo "RewriteEngine On
RewriteRule silverlining-mostrecent.zip http://%{HTTP_HOST}/zip/silverlining-$VERSION.zip [R,L]
" > $ZIP_DIR/.htaccess

    rsync -r --delete docs/_build/ "$CONFIG_WRITABLE_ROOT/cloudsilverlining.org"
fi