From c4c22417b9f5bf2f390001ba39eb9b1165fa8144 Mon Sep 17 00:00:00 2001 From: Matej Ferencevic <matej.ferencevic@memgraph.io> Date: Sat, 7 Oct 2017 22:32:34 +0200 Subject: [PATCH] Added user documentation community bundle script. Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D878 --- docs/.gitignore | 1 + docs/user_technical/README.md | 3 ++ docs/user_technical/bundle | 35 ----------------- docs/user_technical/bundle_community | 58 ++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 35 deletions(-) delete mode 100755 docs/user_technical/bundle create mode 100755 docs/user_technical/bundle_community diff --git a/docs/.gitignore b/docs/.gitignore index 7e3b9c278..be60d87a8 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,5 +1,6 @@ doxygen/html/ doxygen/latex/ +user_technical/.bundle_community/ user_technical/.couscous/ user_technical/couscous.phar user_technical/docs.tar.gz diff --git a/docs/user_technical/README.md b/docs/user_technical/README.md index adebcb4fe..a4917144f 100644 --- a/docs/user_technical/README.md +++ b/docs/user_technical/README.md @@ -6,6 +6,8 @@ Memgraph is an ACID compliant high performance transactional in-memory graph database management system featuring highly concurrent data structures, multi-version concurrency control and asynchronous IO. +[//]: # (When adding a new documentation file, please add it to the list) + ## Contents * [About Memgraph](#about-memgraph) @@ -15,3 +17,4 @@ data structures, multi-version concurrency control and asynchronous IO. * [openCypher Query Language](open-cypher.md) * [Upcoming Features](upcoming-features.md) +[//]: # (Nothing should go below the contents section) diff --git a/docs/user_technical/bundle b/docs/user_technical/bundle deleted file mode 100755 index dc37198b6..000000000 --- a/docs/user_technical/bundle +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# curl and php are required -if ! which php >/dev/null; then - echo "php is required!" - exit 1 -fi - -cd ${working_dir} -generator="couscous.phar" - -# download the generator if it's not already downloaded -if [ ! -f ${generator} ]; then - curl -OS http://couscous.io/${generator} -fi - -# generate the site -php ${generator} generate - -# fix paths in generated files -cd .couscous/generated -for i in *; do - if [ ! -f $i ]; then continue; fi - sed -i 's@/css/@/docs/css/@g' $i - sed -i 's@/fonts/@/docs/fonts/@g' $i - sed -r 's@(<small class="hidden-xs hidden-sm">)@<small class="hidden-xs hidden-sm">Alpha</small></a>\n<a class="navbar-brand" href="/docs/">\1@' -i $i -done - -# create archive -target=docs.tar.gz -tar -czf $working_dir/$target * - -echo "Created archive: $working_dir/$target" diff --git a/docs/user_technical/bundle_community b/docs/user_technical/bundle_community new file mode 100755 index 000000000..29ad364e2 --- /dev/null +++ b/docs/user_technical/bundle_community @@ -0,0 +1,58 @@ +#!/bin/bash + +working_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +build_dir=.bundle_community + +# curl and php are required +if ! which php >/dev/null; then + echo "php is required!" + exit 1 +fi + +cd ${working_dir} +generator="couscous.phar" + +# download the generator if it's not already downloaded +if [ ! -f ${generator} ]; then + curl -OS http://couscous.io/${generator} +fi + +# create build directory +if [ -d $build_dir ]; then + rm -rf $build_dir +fi +mkdir $build_dir + +# copy all files to build directory +cp couscous.yml *.md $generator $build_dir + +# go to build directory +cd $build_dir + +# modify config file +cat >> couscous.yml <<EOF +template: + directory: . +EOF + +# create template file +echo "{{ content|raw }}" > default.twig + +# generate the site +php ${generator} generate + +# create contents file +cd .couscous/generated +tail -n +$( grep -n "Contents" index.html | cut -d ':' -f 1 ) index.html | \ + grep href | grep .html | \ + sed -r 's/^[^"]+"//' | sed -r 's/.html">/ /' | sed -r 's/<.+//' > .contents +rm index.html + +# create archive +target=docs.tar.gz +if [ -f $target ]; then + rm $target +fi +tar -czf $working_dir/$target .contents * + +echo "Created archive: $working_dir/$target"