diff --git a/.travis.yml b/.travis.yml index 398d806..78a7b7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,35 @@ -sudo: required language: ruby +dist: xenial +env: + global: + - COMMIT_AUTHOR_EMAIL="$(yq r metanorma.yml metanorma.deploy.email)"; rvm: - - 2.5.1 + - 2.5 cache: bundler +addons: + apt: + update: true + sources: + - deadsnakes # source required so it finds the package definition below + packages: + - python3.6 + snaps: + - jq + - yq + - name: node + confinement: classic # or devmode + channel: 10/stable before_install: - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install -y curl git make ruby-bundler ruby-dev libxml2-dev libxslt-dev npm - - travis_retry gem install bundler - - travis_retry gem install nokogiri -v '1.8.5' - - sudo bash -c "curl -L https://github.com/riboseinc/plantuml-install/raw/master/ubuntu.sh | bash" - - travis_retry npm install puppeteer -env: - global: - - JAVA_OPTS="java.awt.headless=true" - - PLANTUML_URL=http://sourceforge.net/projects/plantuml/files/plantuml.jar/download + - gem update --system + - gem install bundler + - npm install -g puppeteer + - sudo bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-linux-setup/master/ubuntu.sh | bash" script: - - plantuml -testdot - - make clean all publish deploy + - make clean all publish + # - make clean all nits publish +deploy: + skip_cleanup: true + provider: script + script: bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/deploy-to-gh-pages.sh | bash" + on: + branch: master diff --git a/Makefile b/Makefile index 484c7e8..6bd0c0c 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,27 @@ #!make SHELL := /bin/bash +# Ensure the xml2rfc cache directory exists locally +IGNORE := $(shell mkdir -p $(HOME)/.cache/xml2rfc) -include metanorma.env -export $(shell sed 's/=.*//' metanorma.env) +SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-999) +ifeq ($(SRC),ll) +SRC := $(filter-out README.adoc, $(wildcard sources/*.adoc)) +endif + +FORMAT_MARKER := mn-output- +FORMATS := $(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d ' ' | tr ',' '\n' | sort | uniq | tr '\n' ' ') -FORMATS := $(METANORMA_FORMATS) -comma := , -empty := -space := $(empty) $(empty) -FORMATS_LIST := $(subst $(space),$(comma),$(FORMATS)) +XML := $(patsubst sources/%,documents/%,$(patsubst %.adoc,%.xml,$(SRC))) -SRC := $(filter-out README.adoc, $(wildcard *.adoc)) -XML := $(patsubst %.adoc,%.xml,$(SRC)) -HTML := $(patsubst %.adoc,%.html,$(SRC)) -DOC := $(patsubst %.adoc,%.doc,$(SRC)) -PDF := $(patsubst %.adoc,%.pdf,$(SRC)) -WSD := $(wildcard models/*.wsd) -XMI := $(patsubst models/%,xmi/%,$(patsubst %.wsd,%.xmi,$(WSD))) -PNG := $(patsubst models/%,images/%,$(patsubst %.wsd,%.png,$(WSD))) +XMLRFC3 := $(patsubst %.xml,%.v3.xml,$(OUTPUT_XML)) +HTML := $(patsubst %.xml,%.html,$(OUTPUT_XML)) +DOC := $(patsubst %.xml,%.doc,$(OUTPUT_XML)) +PDF := $(patsubst %.xml,%.pdf,$(OUTPUT_XML)) +TXT := $(patsubst %.xml,%.txt,$(OUTPUT_XML)) +NITS := $(patsubst %.adoc,%.nits,$(wildcard sources/draft-*.adoc)) +WSD := $(wildcard sources/models/*.wsd) +XMI := $(patsubst sources/models/%,sources/xmi/%,$(patsubst %.wsd,%.xmi,$(WSD))) +PNG := $(patsubst sources/models/%,sources/images/%,$(patsubst %.wsd,%.png,$(WSD))) COMPILE_CMD_LOCAL := bundle exec metanorma $$FILENAME COMPILE_CMD_DOCKER := docker run -v "$$(pwd)":/metanorma/ ribose/metanorma "metanorma $$FILENAME" @@ -31,20 +35,54 @@ endif _OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]')) OUT_FILES := $(foreach F,$(_OUT_FILES),$($F)) -all: images $(OUT_FILES) +all: documents.html + +documents: + mkdir -p $@ -%.xml %.html %.doc %.pdf: %.adoc | bundle +documents/%.xml: documents sources/images sources/%.xml + export GLOBIGNORE=sources/$*.adoc; \ + cp sources/$(addsuffix .*,$*) documents; \ + unset GLOBIGNORE + +%.xml %.html: %.adoc | bundle FILENAME=$^; \ ${COMPILE_CMD} -images: $(PNG) +documents.rxl: $(XML) + bundle exec relaton concatenate \ + -t "$(shell yq r metanorma.yml relaton.collection.name)" \ + -g "$(shell yq r metanorma.yml relaton.collection.organization)" \ + documents $@ + +documents.html: documents.rxl + bundle exec relaton xml2html documents.rxl + +# %.v3.xml %.xml %.html %.doc %.pdf %.txt: sources/images %.adoc | bundle +# FILENAME=$^; \ +# ${COMPILE_CMD} +# +# documents/draft-%.nits: documents/draft-%.txt +# VERSIONED_NAME=`grep :name: draft-$*.adoc | cut -f 2 -d ' '`; \ +# cp $^ $${VERSIONED_NAME}.txt && \ +# idnits --verbose $${VERSIONED_NAME}.txt > $@ && \ +# cp $@ $${VERSIONED_NAME}.nits && \ +# cat $${VERSIONED_NAME}.nits + +%.nits: + +%.adoc: -images/%.png: models/%.wsd +nits: $(NITS) + +sources/images: $(PNG) + +sources/images/%.png: sources/models/%.wsd plantuml -tpng -o ../images/ $< -xmi: $(XMI) +sources/xmi: $(XMI) -xmi/%.xmi: models/%.wsd +sources/xmi/%.xmi: sources/models/%.wsd plantuml -xmi:star -o ../xmi/ $< define FORMAT_TASKS @@ -67,7 +105,7 @@ $(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS))) open: open-html clean: - rm -f $(OUT_FILES) + rm -rf documents documents.html documents.rxl published *_images $(OUT_FILES) bundle: if [ "x" == "${METANORMA_DOCKER}x" ]; then bundle; fi @@ -101,7 +139,7 @@ endef $(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS))) -serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js images +serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js sources/images export PORT=$${PORT:-8123} ; \ port=$${PORT} ; \ for html in $(HTML); do \ @@ -116,17 +154,10 @@ watch-serve: $(NODE_BIN_DIR)/run-p # Deploy jobs # -publish: - mkdir -p published && \ - cp -a $(basename $(SRC)).* published/ && \ - cp $(firstword $(HTML)) published/index.html; \ - if [ -d "images" ]; then cp -a images published; fi - -deploy_key: - openssl aes-256-cbc -K $(encrypted_$(ENCRYPTION_LABEL)_key) \ - -iv $(encrypted_$(ENCRYPTION_LABEL)_iv) -in $@.enc -out $@ -d && \ - chmod 600 $@ +publish: published -deploy: deploy_key - export COMMIT_AUTHOR_EMAIL=$(COMMIT_AUTHOR_EMAIL); \ - ./deploy.sh +published: documents.html + mkdir -p $@ && \ + cp -a documents $@/ && \ + cp $< $@/index.html; \ + if [ -d "sources/images" ]; then cp -a sources/images $@/; fi diff --git a/README.adoc b/README.adoc index bd5387e..8e11ec9 100644 --- a/README.adoc +++ b/README.adoc @@ -8,10 +8,7 @@ image:https://travis-ci.com/CalConnect/csd-icalendar-series.svg?branch=master["B This document is available in its rendered forms here: -* https://calconnect.github.io/csd-icalendar-series/[CalConnect Standard: Calendaring and scheduling -- Support for Series in iCalendar (HTML)] -* https://calconnect.github.io/csd-icalendar-series/csd-icalendar-series.pdf[PDF] -* https://calconnect.github.io/csd-icalendar-series/csd-icalendar-series.xml[Metanorma XML] -* https://calconnect.github.io/csd-icalendar-series/csd-icalendar-series.rxl[Relaton XML (Bibliographic item)] +* https://calconnect.github.io/csd-icalendar-series/[CalConnect Standard: Calendaring and scheduling -- Support for Series in iCalendar] == Fetching the document diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 8f74639..0000000 --- a/deploy.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# TODO: replace this script when https://github.com/travis-ci/dpl/issues/694 is fixed -# Taken from https://raw.githubusercontent.com/w3c/permissions/master/deploy.sh -set -e # Exit with nonzero exit code if anything fails - -errx() { - readonly __progname=$(basename ${BASH_SOURCE}) - echo -e "[${__progname}] $@" >&2 - exit 1 -} - -SOURCE_BRANCH="master" -TARGET_BRANCH="gh-pages" -KEY_NAME=$(pwd)/deploy_key - -main() { - - # Pull requests and commits to other branches shouldn't try to deploy, just build to verify - if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then - echo "Not a Travis PR or not matching branch ($SOURCE_BRANCH); skipping deploy." - exit 0 - fi - - [ -z "$COMMIT_AUTHOR_EMAIL" ] && \ - errx "No COMMIT_AUTHOR_EMAIL provided; it must be set." - - if [ ! -f ${KEY_NAME} ]; then - errx "No ${KEY_NAME} file detected; is ${KEY_NAME}.enc decrypted?" - fi - - # Save some useful information - REPO=`git config remote.origin.url` - SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} - SHA=`git rev-parse --verify HEAD` - DEST_DIR=out - - # Clone the existing $TARGET_BRANCH for this repo into $DEST_DIR/ - # Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deploy) - # git clone $REPO $DEST_DIR - git clone $REPO $DEST_DIR || errx "Unable to clone Git." - pushd $DEST_DIR - git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH || errx "Unable to checkout git." - popd - - # Clean out existing contents in $TARGET_BRANCH clone - rm -rf $DEST_DIR/* || exit 0 - - # Adding contents within published/ to $DEST_DIR. - cp -a published/* $DEST_DIR/ || exit 0 - - # Now let's go have some fun with the cloned repo - pushd $DEST_DIR - git config user.name "Travis CI" - git config user.email "$COMMIT_AUTHOR_EMAIL" - - # If there are no changes to the compiled out (e.g. this is a README update) then just bail. - if [[ -z $(git status -s) ]]; then - echo "No changes to the output on this push; exiting." - exit 0 - fi - - git status - - # Commit the "changes", i.e. the new version. - # The delta will show diffs between new and old versions. - git add . - git commit -m "Deploy to GitHub Pages: ${SHA}" - - eval `ssh-agent -s` - ssh-add ${KEY_NAME} - - # Now that we're all set up, we can push. - git push $SSH_REPO $TARGET_BRANCH || errx "Unable to push to git." -} - -main "$@" - -exit 0 diff --git a/metanorma.env b/metanorma.env deleted file mode 100644 index 3e647b9..0000000 --- a/metanorma.env +++ /dev/null @@ -1,3 +0,0 @@ -METANORMA_FORMATS=xml pdf html -ENCRYPTION_LABEL=3a478d395a48 -COMMIT_AUTHOR_EMAIL=travis-ci@calconnect.org diff --git a/metanorma.yml b/metanorma.yml new file mode 100644 index 0000000..a17a6e0 --- /dev/null +++ b/metanorma.yml @@ -0,0 +1,8 @@ +--- +metanorma: + deploy: + email: "travis-ci@metanorma.org" +relaton: + collection: + name: Calendaring and scheduling -- Calendar subscription upgrades + organization: CalConnect diff --git a/cc-51003.adoc b/sources/cc-51003.adoc similarity index 100% rename from cc-51003.adoc rename to sources/cc-51003.adoc diff --git a/draft-ietf-calext-icalendar-series.adoc b/sources/draft-ietf-calext-icalendar-series.adoc similarity index 100% rename from draft-ietf-calext-icalendar-series.adoc rename to sources/draft-ietf-calext-icalendar-series.adoc diff --git a/references/informative/reference.RFC.3552.xml b/sources/references/informative/reference.RFC.3552.xml similarity index 100% rename from references/informative/reference.RFC.3552.xml rename to sources/references/informative/reference.RFC.3552.xml diff --git a/references/informative/reference.RFC.4918.xml b/sources/references/informative/reference.RFC.4918.xml similarity index 100% rename from references/informative/reference.RFC.4918.xml rename to sources/references/informative/reference.RFC.4918.xml diff --git a/references/informative/reference.RFC.5378.xml b/sources/references/informative/reference.RFC.5378.xml similarity index 100% rename from references/informative/reference.RFC.5378.xml rename to sources/references/informative/reference.RFC.5378.xml diff --git a/references/normative/reference.RFC.2119.xml b/sources/references/normative/reference.RFC.2119.xml similarity index 100% rename from references/normative/reference.RFC.2119.xml rename to sources/references/normative/reference.RFC.2119.xml diff --git a/references/normative/reference.RFC.2518.xml b/sources/references/normative/reference.RFC.2518.xml similarity index 100% rename from references/normative/reference.RFC.2518.xml rename to sources/references/normative/reference.RFC.2518.xml diff --git a/references/normative/reference.RFC.3986.xml b/sources/references/normative/reference.RFC.3986.xml similarity index 100% rename from references/normative/reference.RFC.3986.xml rename to sources/references/normative/reference.RFC.3986.xml diff --git a/references/normative/reference.RFC.4791.xml b/sources/references/normative/reference.RFC.4791.xml similarity index 100% rename from references/normative/reference.RFC.4791.xml rename to sources/references/normative/reference.RFC.4791.xml diff --git a/references/normative/reference.RFC.5545.xml b/sources/references/normative/reference.RFC.5545.xml similarity index 100% rename from references/normative/reference.RFC.5545.xml rename to sources/references/normative/reference.RFC.5545.xml diff --git a/references/normative/reference.RFC.5546.xml b/sources/references/normative/reference.RFC.5546.xml similarity index 100% rename from references/normative/reference.RFC.5546.xml rename to sources/references/normative/reference.RFC.5546.xml diff --git a/references/normative/reference.RFC.6047.xml b/sources/references/normative/reference.RFC.6047.xml similarity index 100% rename from references/normative/reference.RFC.6047.xml rename to sources/references/normative/reference.RFC.6047.xml diff --git a/references/normative/reference.RFC.6638.xml b/sources/references/normative/reference.RFC.6638.xml similarity index 100% rename from references/normative/reference.RFC.6638.xml rename to sources/references/normative/reference.RFC.6638.xml diff --git a/references/normative/reference.RFC.7986.xml b/sources/references/normative/reference.RFC.7986.xml similarity index 100% rename from references/normative/reference.RFC.7986.xml rename to sources/references/normative/reference.RFC.7986.xml diff --git a/references/normative/reference.RFC.8174.xml b/sources/references/normative/reference.RFC.8174.xml similarity index 100% rename from references/normative/reference.RFC.8174.xml rename to sources/references/normative/reference.RFC.8174.xml diff --git a/sections-ietf/50-acknowledgements.adoc b/sources/sections-ietf/50-acknowledgements.adoc similarity index 100% rename from sections-ietf/50-acknowledgements.adoc rename to sources/sections-ietf/50-acknowledgements.adoc diff --git a/sections-ietf/98-references.adoc b/sources/sections-ietf/98-references.adoc similarity index 100% rename from sections-ietf/98-references.adoc rename to sources/sections-ietf/98-references.adoc diff --git a/sections/00-abstract.adoc b/sources/sections/00-abstract.adoc similarity index 100% rename from sections/00-abstract.adoc rename to sources/sections/00-abstract.adoc diff --git a/sections/00-foreword.adoc b/sources/sections/00-foreword.adoc similarity index 100% rename from sections/00-foreword.adoc rename to sources/sections/00-foreword.adoc diff --git a/sections/00-intro.adoc b/sources/sections/00-intro.adoc similarity index 100% rename from sections/00-intro.adoc rename to sources/sections/00-intro.adoc diff --git a/sections/01-scope.adoc b/sources/sections/01-scope.adoc similarity index 100% rename from sections/01-scope.adoc rename to sources/sections/01-scope.adoc diff --git a/sections/02-normrefs.adoc b/sources/sections/02-normrefs.adoc similarity index 100% rename from sections/02-normrefs.adoc rename to sources/sections/02-normrefs.adoc diff --git a/sections/03-terms.adoc b/sources/sections/03-terms.adoc similarity index 100% rename from sections/03-terms.adoc rename to sources/sections/03-terms.adoc diff --git a/sections/04-overrides.adoc b/sources/sections/04-overrides.adoc similarity index 100% rename from sections/04-overrides.adoc rename to sources/sections/04-overrides.adoc diff --git a/sections/05-series.adoc b/sources/sections/05-series.adoc similarity index 100% rename from sections/05-series.adoc rename to sources/sections/05-series.adoc diff --git a/sections/06-redefinedrelationtypevalue.adoc b/sources/sections/06-redefinedrelationtypevalue.adoc similarity index 100% rename from sections/06-redefinedrelationtypevalue.adoc rename to sources/sections/06-redefinedrelationtypevalue.adoc diff --git a/sections/07-newparams.adoc b/sources/sections/07-newparams.adoc similarity index 100% rename from sections/07-newparams.adoc rename to sources/sections/07-newparams.adoc diff --git a/sections/08-newproperties.adoc b/sources/sections/08-newproperties.adoc similarity index 100% rename from sections/08-newproperties.adoc rename to sources/sections/08-newproperties.adoc diff --git a/sections/09-redefinedrelatedto.adoc b/sources/sections/09-redefinedrelatedto.adoc similarity index 100% rename from sections/09-redefinedrelatedto.adoc rename to sources/sections/09-redefinedrelatedto.adoc diff --git a/sections/10-backwards.adoc b/sources/sections/10-backwards.adoc similarity index 100% rename from sections/10-backwards.adoc rename to sources/sections/10-backwards.adoc diff --git a/sections/11-caldav.adoc b/sources/sections/11-caldav.adoc similarity index 100% rename from sections/11-caldav.adoc rename to sources/sections/11-caldav.adoc diff --git a/sections/12-security.adoc b/sources/sections/12-security.adoc similarity index 100% rename from sections/12-security.adoc rename to sources/sections/12-security.adoc diff --git a/sections/13-iana.adoc b/sources/sections/13-iana.adoc similarity index 100% rename from sections/13-iana.adoc rename to sources/sections/13-iana.adoc diff --git a/sections/14-acknowledgements.adoc b/sources/sections/14-acknowledgements.adoc similarity index 100% rename from sections/14-acknowledgements.adoc rename to sources/sections/14-acknowledgements.adoc diff --git a/sections/99-bibliography.adoc b/sources/sections/99-bibliography.adoc similarity index 100% rename from sections/99-bibliography.adoc rename to sources/sections/99-bibliography.adoc diff --git a/sections/a1-open-issues.adoc b/sources/sections/a1-open-issues.adoc similarity index 100% rename from sections/a1-open-issues.adoc rename to sources/sections/a1-open-issues.adoc diff --git a/sections/a2-changelog.adoc b/sources/sections/a2-changelog.adoc similarity index 100% rename from sections/a2-changelog.adoc rename to sources/sections/a2-changelog.adoc