6a144db165
Summary: Don't store unnecessary files in documentation archive. Apollo generate script cleanup. Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D887
59 lines
1.2 KiB
Bash
Executable File
59 lines
1.2 KiB
Bash
Executable File
#!/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 *.html
|
|
|
|
echo "Created archive: $working_dir/$target"
|