PageRenderTime 83ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 37ms app.codeStats 0ms

/rebuild

https://bitbucket.org/ianb/silverlining/
#! | 57 lines | 44 code | 13 blank | 0 comment | 0 complexity | 6874086b7ab391e50ee8a9c423a3508c MD5 | raw file
 1#!/bin/bash
 2
 3if [ "$1" = "-f" ] ; then
 4    ssh flow.openplans.org 'ssh acura "~/bin/rsync-silverlining"'
 5    exit
 6fi
 7
 8if [ -z "$BBDOCS_SCRATCH" ] ; then
 9    # Not the normal environment
10    DEVEL=t
11    BBDOCS_SCRATCH="scratch-build"
12    if [ ! -e $BBDOCS_SCRATCH ] ; then
13        mkdir -p $BBDOCS_SCRATCH
14    fi
15fi
16
17ENV_PATH="$BBDOCS_SCRATCH/env"
18if [ ! -e "$BBDOCS_SCRATCH/virtualenv.py" ] ; then
19    wget http://svn.colorstudy.com/virtualenv/trunk/virtualenv.py -O $BBDOCS_SCRATCH/virtualenv.py
20fi
21VIRTUALENV="python $BBDOCS_SCRATCH/virtualenv.py"
22export VIRTUALENV
23
24if [ ! -e "$ENV_PATH/bin" ] ; then
25    $VIRTUALENV $ENV_PATH
26fi
27
28mkdir -p docs/_static
29
30$ENV_PATH/bin/pip install Sphinx
31$ENV_PATH/bin/sphinx-build -E -b html docs/ docs/_build || exit 1
32
33if [ -z "$DEVEL" ] ; then
34
35    export BUILD_DIR="$BBDOCS_SCRATCH/zip-build"
36    if [ ! -e $BUILD_DIR ] ; then
37        mkdir -p $BUILD_DIR
38    fi
39
40    export ZIP_DIR="$(pwd)/docs/_build/zip"
41    if [ ! -e $ZIP_DIR ] ; then
42        mkdir -p $ZIP_DIR
43    fi
44
45    export VERSION="0.1-$(date +%Y-%m-%d)"
46
47    source $ENV_PATH/bin/activate
48
49    ./silverlining/create-zip.sh
50    cp docs/_static/HEADER.html $ZIP_DIR
51    sed -i "s/MOST_RECENT/$VERSION/g" $ZIP_DIR/HEADER.html
52    echo "RewriteEngine On
53RewriteRule silverlining-mostrecent.zip http://%{HTTP_HOST}/zip/silverlining-$VERSION.zip [R,L]
54" > $ZIP_DIR/.htaccess
55
56    rsync -r --delete docs/_build/ "$CONFIG_WRITABLE_ROOT/cloudsilverlining.org"
57fi