diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..79e04751 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +all: serve + +build: + mkdocs build + +serve: + mkdocs serve + +release: + ./bin/release.sh + diff --git a/README.md b/README.md index 70e78162..9c87d554 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,12 @@ This hosts the documentation source and examples for [Bullet](https://github.com The built documentation can be accessed [here](https://bullet-db.github.io). -## Building the documentation +## Installing mkdocs You will need Python installed. +You can install the required tool "mkdocs" like this (a "mkdocs" directory will be created wherever you execute these commands): + ```bash sudo pip install virtualenv virtualenv mkdocs @@ -15,15 +17,22 @@ source mkdocs/bin/activate pip install mkdocs==0.16.3 pip install mkdocs-cinder pip install git+git://github.com/twardoch/clinker-mktheme.git@master --upgrade -git clone git@github.com:bullet-db/bullet-db.github.io.git -cd bullet-db.github.io -mkdocs serve ``` The above commands will install [mkdocs](http://www.mkdocs.org/#installation) along with the mkdocs theme : [Cinder](http://sourcefoundry.org/cinder/). Since Cinder has not been upgraded in a while, it uses the changes in this [PR](https://github.com/chrissimpkins/cinder/pull/26) of Cinder found here: [twardoch/clinker-mktheme](https://github.com/twardoch/clinker-mktheme/tree/master). +## Building the Documentation + +Once mkdocs is available: + +`make build` will build the documentation. + +`make serve` will serve the documentation so it can be viewed from a local browser. + +`make release` will build a release and commit it to your local "master" branch. This command assumes you have a clean git environment ("git diff" prints nothing). It will build the documentation and commit it to your local master branch. **YOU must push the changes** in your master branch to the remote repo if you want to publish the changes after the command completes successfully. + ## Building the examples You will need [Maven 3](https://maven.apache.org/install.html) and [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) installed to build the examples. diff --git a/bin/release.sh b/bin/release.sh new file mode 100755 index 00000000..c8634438 --- /dev/null +++ b/bin/release.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# This script will build the documentation from the current "src" branch and push it to the "master" branch. +# "mkdocs" must be available, and you must be in a clean git environment ("git diff" should print nothing). + +git checkout src +git pull +COMMIT=`git rev-parse HEAD | cut -c 1-7` +echo Building docs... +mkdocs build +if [ $? -ne 0 ]; then + echo ------------------ ERROR ------------------ + echo mkdocs must be installed + echo see README.md for more info + echo ------------------------------------------- + exit 1; +fi +set -e +rm -rf /tmp/tmp-folder-for-bullet-docs/ +mkdir -p /tmp/tmp-folder-for-bullet-docs/ +mv site/ /tmp/tmp-folder-for-bullet-docs/ +echo Checking out master... +git checkout master +git pull +# Carefully delete everything in this folder +rm -rf ./* +cp -r /tmp/tmp-folder-for-bullet-docs/site/ ./ +rm -rf /tmp/tmp-folder-for-bullet-docs/ +git add -A +git commit -m "Build at ${COMMIT}" +echo ---------------- SUCCESS -------------------- +echo The documentation has been built locally +echo You are on the **master** branch +echo DO "git push" TO PUSH CHANGES TO REMOTE REPO +echo ---------------------------------------------