Added user documentation community bundle script.

Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D878
This commit is contained in:
Matej Ferencevic 2017-10-07 22:32:34 +02:00
parent 7a14e09dfc
commit c4c22417b9
4 changed files with 62 additions and 35 deletions

1
docs/.gitignore vendored
View File

@ -1,5 +1,6 @@
doxygen/html/
doxygen/latex/
user_technical/.bundle_community/
user_technical/.couscous/
user_technical/couscous.phar
user_technical/docs.tar.gz

View File

@ -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)

View File

@ -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"

View File

@ -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"