From 3807f6d75fc0e5029854bf40c0f3a1cc9a57d27e Mon Sep 17 00:00:00 2001 From: squidfunk <martin.donath@squidfunk.com> Date: Fri, 11 May 2018 10:39:44 +0200 Subject: [PATCH] Moved Ginseng integration to build process to avoid interference --- .travis.sh | 29 ++++++++++++++++++++++++++++- MANIFEST.in | 1 + mkdocs.yml | 4 ---- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.travis.sh b/.travis.sh index 16eaf0bb..d736add5 100755 --- a/.travis.sh +++ b/.travis.sh @@ -23,6 +23,25 @@ # Exit, if one command fails set -e +# Create directory for overrides, so we don't clutter up the base theme with +# our custom adjustments for our own hosted documentation +mkdir -p overrides +cat > overrides/main.html <<-EOM + {% extends "base.html" %} + {% block scripts %} + {{ super() }} + <script> + (function(i,s,o,g,r,a,m){ + i["GinsengAnalyticsObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q|| + []).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g; + m.parentNode.insertBefore(a,m) + })(window, document, + "script", "https://staging.ginseng.ai/analytics.js", "gx"); + </script> + {% endblock %} +EOM + # Deploy documentation to GitHub pages if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then REMOTE="https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material" @@ -31,7 +50,15 @@ if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git config --global user.name "${GH_NAME}" git config --global user.email "${GH_EMAIL}" git remote set-url origin $REMOTE - mkdocs gh-deploy --force + + # Install GitHub pages import helper and Material, so we can use it as a + # base template and add overrides + pip install ghp-import --user + python setup.py install + + # Build documentation with overrides and publish to GitHub pages + mkdocs build --theme material --theme-dir overrides + ghp-import --no-jekyll --force --push site fi # Terminate if we're not on a release branch diff --git a/MANIFEST.in b/MANIFEST.in index 83f1af4f..7da058db 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ recursive-include material *.js *.css *.html *.svg *.png *.yml recursive-exclude site * +recursive-exclude src * recursive-exclude * __pycache__ recursive-exclude * *.py[co] include LICENSE diff --git a/mkdocs.yml b/mkdocs.yml index 7a8a0077..14213a98 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -121,7 +121,3 @@ pages: google_analytics: - !!python/object/apply:os.getenv ["GOOGLE_ANALYTICS_KEY"] - auto - -# Temporary scripts for testing -extra_javascript: - - https://staging.ginseng.ai/analytics.js -- GitLab