summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSergey Karayev <sergeykarayev@gmail.com>2014-02-25 11:34:23 -0800
committerSergey Karayev <sergeykarayev@gmail.com>2014-02-25 11:34:23 -0800
commit27a83156847530ec20ef5dcff92773eee53258b7 (patch)
tree894c968de5510f16c98eda9b57cf7360f3fb1fdd /scripts
parentaea53c78d4819d975cca632b2401d932660a653a (diff)
downloadcaffeonacl-27a83156847530ec20ef5dcff92773eee53258b7.tar.gz
caffeonacl-27a83156847530ec20ef5dcff92773eee53258b7.tar.bz2
caffeonacl-27a83156847530ec20ef5dcff92773eee53258b7.zip
Updated README with doc info
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_and_deploy_docs.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/build_and_deploy_docs.sh b/scripts/build_and_deploy_docs.sh
new file mode 100755
index 00000000..83b79b26
--- /dev/null
+++ b/scripts/build_and_deploy_docs.sh
@@ -0,0 +1,39 @@
+echo "The remote from which you will submit the PR to BVLC:gh-pages must be called 'origin'"
+echo "To build and view docs when not on master, simply do 'jekyll serve -s docs'."
+echo
+
+ORIGIN=`git config --get remote.origin.url`
+BRANCH=`git rev-parse --abbrev-ref HEAD`
+MSG=`git log --oneline -1`
+
+if [ $BRANCH = 'master' ]; then
+ # Make sure that docs/_site tracks remote:gh-pages.
+ # If not, then we make a new repo and check out just that branch.
+ mkdir docs/_site
+ cd docs/_site
+ SITE_ORIGIN=`git config --get remote.origin.url`
+ SITE_BRANCH=`git rev-parse --abbrev-ref HEAD`
+
+ echo $SITE_ORIGIN
+ echo $SITE_BRANCH
+ echo `pwd`
+
+ if [[ ( $SITE_ORIGIN == $ORIGIN ) && ( $SITE_BRANCH = 'gh-pages' ) ]]; then
+ echo "Confirmed that docs/_site has same origin as main repo, and is on gh-pages."
+ else
+ echo "Checking out origin:gh-pages into docs/_site (will take a little time)."
+ git init .
+ git remote add -t gh-pages -f origin $ORIGIN
+ git co gh-pages
+ fi
+
+ echo "Building the site into docs/_site, and committing the changes."
+ jekyll build -s .. -d .
+ git add --all .
+ git commit -m "$MSG"
+ git push origin gh-pages
+
+ echo "All done!"
+ cd ../..
+else echo "You must run this deployment script from the 'master' branch."
+fi