From cd02624ed910704c1887a465ac700b937b662a31 Mon Sep 17 00:00:00 2001 From: Nathan Speidel Date: Thu, 26 Jul 2018 18:10:55 -0700 Subject: [PATCH 1/4] Added Makefile and release script --- Makefile | 11 +++++++++++ README.md | 21 +++++++++++++++------ bin/release.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 Makefile create mode 100755 bin/release.sh 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..59207e46 100644 --- a/README.md +++ b/README.md @@ -4,26 +4,35 @@ 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: + ```bash sudo pip install virtualenv -virtualenv mkdocs -source mkdocs/bin/activate +virtualenv ../mkdocs +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 release the documentation. This command assumes you are in the "src" branch with a clean git environment. It will build the documentation, check it into the master branch, and push it to the remote repo. + ## 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..63af3936 --- /dev/null +++ b/bin/release.sh @@ -0,0 +1,31 @@ +#!/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 +mkdir -p tmp-folder-for-site +mv site/ ./tmp-folder-for-site/ +echo Checking out master... +git checkout master +git pull +# Delete everything except "tmp-folder-for-site", "." and files/folders beginning with "." +find . | grep -v "tmp-folder-for-site" | grep -v "^\./\." | grep -v "^\.$" | xargs rm -rf +cp -r ./tmp-folder-for-site/site/ ./ +rm -rf ./tmp-folder-for-site/ +git add -A +git commit -m "Build at ${COMMIT}" +git push +git checkout src From 353dde4c494400ccff80e77a91c63f49cc1d24d7 Mon Sep 17 00:00:00 2001 From: Nathan Speidel Date: Thu, 26 Jul 2018 18:31:13 -0700 Subject: [PATCH 2/4] Moving site to /tmp instead --- README.md | 6 +++--- bin/release.sh | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 59207e46..b6f7516c 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,12 @@ The built documentation can be accessed [here](https://bullet-db.github.io). You will need Python installed. -You can install the required tool "mkdocs" like this: +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 -source ../mkdocs/bin/activate +virtualenv mkdocs +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 diff --git a/bin/release.sh b/bin/release.sh index 63af3936..f1f38f32 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -16,16 +16,18 @@ if [ $? -ne 0 ]; then exit 1; fi set -e -mkdir -p tmp-folder-for-site -mv site/ ./tmp-folder-for-site/ +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 -# Delete everything except "tmp-folder-for-site", "." and files/folders beginning with "." -find . | grep -v "tmp-folder-for-site" | grep -v "^\./\." | grep -v "^\.$" | xargs rm -rf -cp -r ./tmp-folder-for-site/site/ ./ -rm -rf ./tmp-folder-for-site/ +# Carefully delete everything in this folder +rm -rf ../bullet-db.github.io/* +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}" git push git checkout src + From 9d4a57aac0859552ae43e6d2aaa50a8157250891 Mon Sep 17 00:00:00 2001 From: Nathan Speidel Date: Thu, 26 Jul 2018 18:56:19 -0700 Subject: [PATCH 3/4] Changed script to not push to master --- README.md | 2 +- bin/release.sh | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b6f7516c..9c87d554 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Once mkdocs is available: `make serve` will serve the documentation so it can be viewed from a local browser. -`make release` will release the documentation. This command assumes you are in the "src" branch with a clean git environment. It will build the documentation, check it into the master branch, and push it to the remote repo. +`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 diff --git a/bin/release.sh b/bin/release.sh index f1f38f32..0c1078e9 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -28,6 +28,8 @@ 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}" -git push -git checkout src - +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 --------------------------------------------- From 2fb9d78b2bdd611a752c84d43e0d57b979c1055b Mon Sep 17 00:00:00 2001 From: Nathan Speidel Date: Fri, 27 Jul 2018 12:16:15 -0700 Subject: [PATCH 4/4] PR comment --- bin/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release.sh b/bin/release.sh index 0c1078e9..c8634438 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -23,7 +23,7 @@ echo Checking out master... git checkout master git pull # Carefully delete everything in this folder -rm -rf ../bullet-db.github.io/* +rm -rf ./* cp -r /tmp/tmp-folder-for-bullet-docs/site/ ./ rm -rf /tmp/tmp-folder-for-bullet-docs/ git add -A