From 8a66b1a68bcaf55581b5cf0686321f722519d603 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 3 Aug 2017 00:18:07 +0100 Subject: [PATCH] Build the spec as part of the build --- jenkins.sh | 6 +++--- scripts/add_anchors.py | 15 ++++++++++----- scripts/generate-jekyll.sh | 20 -------------------- scripts/generate-site | 30 ++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 28 deletions(-) delete mode 100755 scripts/generate-jekyll.sh create mode 100755 scripts/generate-site diff --git a/jenkins.sh b/jenkins.sh index 3f2b0afd..44b9cb89 100755 --- a/jenkins.sh +++ b/jenkins.sh @@ -11,9 +11,9 @@ pip install \ jsonschema \ PyYAML +# do sanity checks on the examples and swagger (cd event-schemas/ && ./check_examples.py) (cd api && ./check_examples.py) -(cd scripts && ./gendoc.py -v) (cd api && npm install && node validator.js -s "client-server") : ${GOPATH:=${WORKSPACE}/.gopath} @@ -26,8 +26,8 @@ go get gopkg.in/fsnotify.v1 (cd scripts/continuserv && go build) (cd scripts/speculator && go build) -# update the jekyll site -./scripts/generate-jekyll.sh +# generate bits of the site +./scripts/generate-site # create a tarball of the generated site tar -czf site.tar.gz _site diff --git a/scripts/add_anchors.py b/scripts/add_anchors.py index f3238952..2aafe856 100755 --- a/scripts/add_anchors.py +++ b/scripts/add_anchors.py @@ -8,16 +8,21 @@ from sys import argv import re -script, filename = argv +filename = argv[1] -textfile = open(filename, "r") regex = r'()' regex2 = r'(
)' replacement = r'

\n\1' +with open(filename, "r") as f: + lines = list(f) + # check for tmp && mv tmp _site/guides/faq.html -./scripts/add_anchors.py _site/projects/try-matrix-now.html >tmp && mv tmp _site/projects/try-matrix-now.html - diff --git a/scripts/generate-site b/scripts/generate-site new file mode 100755 index 00000000..9e1090e5 --- /dev/null +++ b/scripts/generate-site @@ -0,0 +1,30 @@ +#!/bin/bash +# +# This script builds part of the matrix.org site, under '_site'. +# +# jekyll requires the `docutils` and `pygments` python packages, so install +# them or run from a virtualenv which includes them. + +set -ex + +# tell jekyll to parse things as utf-8 +export LANG="en_GB.UTF-8" + +cd `dirname $0`/.. + +mkdir -p _site + +# generate the jekyll bits +jekyll build -s jekyll + +# add some anchors to some generated jekyll bits +./scripts/add_anchors.py _site/guides/faq.html +./scripts/add_anchors.py _site/projects/try-matrix-now.html + +# generate the latest spec +./scripts/gendoc.py -d _site/spec + +# apply the matrix.org styling to the spec +find _site/spec -name '*.html' | + xargs ./scripts/add-matrix-org-stylings.pl jekyll/_includes +