2015-02-11 03:00:26 +03:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
git checkout gh-pages
|
|
|
|
|
|
|
|
git rm --ignore-unmatch -rf *
|
|
|
|
|
2015-02-17 21:22:20 +03:00
|
|
|
git checkout master replace_doc_link.py
|
2015-02-11 03:00:26 +03:00
|
|
|
git checkout master doc
|
|
|
|
git checkout master README.md
|
2015-03-05 05:54:34 +03:00
|
|
|
git checkout master index.md
|
2015-02-11 03:00:26 +03:00
|
|
|
git checkout master vitess.io
|
|
|
|
|
2015-02-17 21:22:20 +03:00
|
|
|
mkdir vitess.io/_includes/doc
|
|
|
|
mkdir -p vitess.io/_posts/doc
|
|
|
|
|
|
|
|
# create ref files for each doc
|
|
|
|
for d in doc/*.md
|
|
|
|
do
|
|
|
|
name=${d:4}
|
|
|
|
title=${name%%.*}
|
|
|
|
docpath="vitess.io/_posts/doc/2015-01-01-${name}"
|
|
|
|
touch $docpath
|
|
|
|
echo "---" >> $docpath
|
|
|
|
echo "layout: doc" >> $docpath
|
|
|
|
echo "title: \"$title\"" >> $docpath
|
|
|
|
echo "categories: doc" >> $docpath
|
|
|
|
echo "toc: true" >> $docpath
|
|
|
|
echo "---" >> $docpath
|
|
|
|
echo "{% include $d %}" >> $docpath
|
|
|
|
done
|
|
|
|
|
|
|
|
# preserve links between docs
|
2015-03-05 02:59:41 +03:00
|
|
|
for d in `ls doc/*.md` README.md index.md
|
2015-02-17 21:22:20 +03:00
|
|
|
do
|
|
|
|
python replace_doc_link.py doc $d > vitess.io/_includes/$d
|
|
|
|
done
|
|
|
|
|
|
|
|
# compile to html pages
|
2015-02-11 03:00:26 +03:00
|
|
|
cd vitess.io
|
|
|
|
bundle install
|
|
|
|
bundle exec jekyll build
|
|
|
|
cd ..
|
|
|
|
|
2015-02-17 21:22:20 +03:00
|
|
|
# clean up
|
|
|
|
rm -rf doc
|
|
|
|
rm -rf README.md
|
|
|
|
rm replace_doc_link.py
|
|
|
|
|
2015-02-11 03:00:26 +03:00
|
|
|
git add vitess.io/_site/*
|
|
|
|
git mv vitess.io/_site/* .
|
|
|
|
git add vitess.io/LICENSE
|
|
|
|
git mv vitess.io/LICENSE .
|
|
|
|
|
|
|
|
rm -rf vitess.io
|
2015-02-17 21:22:20 +03:00
|
|
|
|
2015-05-12 00:45:41 +03:00
|
|
|
# pre-commit checks
|
|
|
|
set +e
|
2015-10-22 22:53:12 +03:00
|
|
|
list=$(find . -name '*.html' ! -path '*/vendor/*' | xargs grep -lE '^\s*([\-\*]|\d\.) ')
|
2015-05-12 00:45:41 +03:00
|
|
|
if [ -n "$list" ]; then
|
|
|
|
echo
|
|
|
|
echo "ERROR: The following pages appear to contain bulleted lists that weren't properly converted."
|
|
|
|
echo "Make sure all bulleted lists have a blank line before them."
|
|
|
|
echo
|
|
|
|
echo "$list"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
2015-02-11 03:00:26 +03:00
|
|
|
git add -u
|
|
|
|
|
|
|
|
git commit -m "publish site `date`"
|
2015-04-08 00:45:42 +03:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Please sanity-check the output: git diff HEAD~"
|
|
|
|
echo
|
|
|
|
echo "When you're ready to publish: git push origin gh-pages"
|