Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 81 lines (65 sloc) 2.17 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
#!/bin/sh
usage()
{
cat << EOF
usage: $0 options

This script generates the casbah documentation

OPTIONS:
-h Show this message
-g Auto update the gh-pages branch
EOF
}

GHPAGES=false
while getopts "h:g" OPTION
do
case $OPTION in
         h)
             usage
             exit 1
             ;;
         g)
             GHPAGES=$OPTARG
             ;;
         ?)
             usage
             exit
             ;;
     esac
done

SCALA=2.9.2
WEBSITE_ROOT=api.mongodb.org/scala/casbah/current/
SPHINX_DIR=./src/sphinx
SITE_DIR=./target/site/

./sbt ++2.9.2 "update" "clean" "compile" "make-site" "unidoc"

mkdir -p $SITE_DIR/api.sxr/casbah-commons
mkdir -p $SITE_DIR/api.sxr/casbah-core
mkdir -p $SITE_DIR/api.sxr/casbah-gridfs
mkdir -p $SITE_DIR/api.sxr/casbah-query

cp ./casbah-commons/target/scala-$SCALA/classes.sxr/* $SITE_DIR/api.sxr/casbah-commons
cp ./casbah-core/target/scala-$SCALA/classes.sxr/* $SITE_DIR/api.sxr/casbah-core
cp ./casbah-gridfs/target/scala-$SCALA/classes.sxr/* $SITE_DIR/api.sxr/casbah-gridfs
cp ./casbah-query/target/scala-$SCALA/classes.sxr/* $SITE_DIR/api.sxr/casbah-query

touch $SITE_DIR/.nojekyll

# Remove double slashes
find $SITE_DIR/api/ -name \*html -exec sed -i 's#.sxr//#.sxr/#g' {} \;
# Update the sxr in url
find $SITE_DIR/api/ -name \*html -exec sed -i 's#/src\(.*\)/\(.*scala.html\)#/\2#' {} \;
# Update WEBSITE ROUTE
find $SITE_DIR/api/ -name \*html -exec sed -i "s#/{{WEBSITE_ROOT}}#/$WEBSITE_ROOT#g" {} \;

# Make pdf / epub
make -C $SPHINX_DIR clean epub latexpdf

cp $SPHINX_DIR/_build/epub/CasbahMongoDBScalaToolkitDocumentation.epub $SITE_DIR/CasbahDocumentation.epub
cp $SPHINX_DIR/_build/latex/CasbahDocumentation.pdf $SITE_DIR/CasbahDocumentation.pdf

if $GHPAGES && git diff-index --quiet HEAD --; then
echo " ========================== "
    echo " Updating `gh-pages` branch"
    echo " ========================== "

    git co gh-pages
    mv target .target
    rm * -rf
    cp -R .target/site/* .
    mv .target target

    echo " Please check the new docs and checkin ..."
elif $GHPAGES; then
echo "You have changes not checked-in - cannot automatically update gh-pages"
fi

Something went wrong with that request. Please try again.