diff --git a/.travis.sh b/.travis.sh index 16eaf0bb9ff4fc5f0e69a35c6836752f4adb4785..d736add5d1f6dcb3fc798dca2b689ee23c0f3869 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 83f1af4f6e3b8f38520fa821eb58425570a68287..7da058db100c7dcd23989f906f3574fb51895b11 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 7a8a0077aa6a6732490f9dc760cf38377be21cfd..14213a982e99e8c69e43c74151f304cf153c5bf4 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