-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.sh
executable file
·31 lines (27 loc) · 992 Bytes
/
create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
set -ex
if [ -z $NO_DEFAULT ]; then
OUTPUT="www"
LIB_COPY="filelist.txt"
NO_WEB=1
PUBLISH=
fi
if [ -z $NO_WEB ]; then
git submodule update --init --recursive
pip install --upgrade pip
pip install --upgrade python-dateutil ghp-import pytz
fi
mkdir -p "${OUTPUT}"
find . -not -path '*.git/*' -not -path '*'"${OUTPUT}/"'*' -type f -not -name '*.md' -not -name '*.py' -not -name '*.tmpl' -not -name '*.sh' -not -name "${LIB_COPY}" -not -name '.*' > "${LIB_COPY}"
rsync -av . "${OUTPUT}" --files-from "${LIB_COPY}"
./create_page.py --documents content.json --template index.tmpl --out "${OUTPUT}/index.html"
PREV_DIR=`pwd`
pushd "${OUTPUT}" && find . -not -path '*lib/*' -not -path '*lib' | "${PREV_DIR}/create_sitemap.py" "sitemap.xml" && popd
if [ -z $PUBLISH ]; then
python -m SimpleHTTPServer || true
rm -rf "${OUTPUT}"
rm "${LIB_COPY}"
else
ghp-import -n "${OUTPUT}" &&
git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages
fi