diff --git a/common/Makefile b/common/Makefile deleted file mode 100644 index 43cb74c..0000000 --- a/common/Makefile +++ /dev/null @@ -1,196 +0,0 @@ -# Auto-generated by Cimas: Do not edit it manually! -# See https://github.com/metanorma/cimas -#!make -SHELL := /bin/bash -# Ensure the xml2rfc cache directory exists locally -IGNORE := $(shell mkdir -p $(HOME)/.cache/xml2rfc) - -SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-) - -ifeq ($(SRC),null) -SRC := -endif -ifeq ($(SRC),ll) -SRC := -endif - -ifeq ($(SRC),) -BUILT := $(shell yq r metanorma.yml metanorma.source.built_targets | cut -d ':' -f 1 | tr -s '\n' ' ') - -ifeq ($(BUILT),null) -SRC := -endif -ifeq ($(BUILT),ll) -SRC := -endif - -ifeq ($(BUILT),) -SRC := $(filter-out README.adoc, $(wildcard sources/*.adoc)) -else -XML := $(patsubst sources/%,documents/%,$(BUILT)) -endif -endif - -FORMATS := $(shell yq r metanorma.yml metanorma.formats | tr -d '[:space:]' | tr -s '-' ' ') -ifeq ($(FORMATS),) -FORMAT_MARKER := mn-output- -FORMATS := $(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d " " | tr "," "\\n" | sort | uniq | tr "\\n" " ") -endif - -XML ?= $(patsubst sources/%,documents/%,$(patsubst %.adoc,%.xml,$(SRC))) -HTML := $(patsubst %.xml,%.html,$(XML)) - -ifdef METANORMA_DOCKER - PREFIX_CMD := echo "Running via docker..."; docker run -v "$$(pwd)":/metanorma/ $(METANORMA_DOCKER) -else - ifdef SKIP_BUNDLE - PREFIX_CMD := echo "Running locally..."; - else - PREFIX_CMD := echo "Running locally via bundle ..."; bundle exec - endif -endif - -_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]')) -OUT_FILES := $(foreach F,$(_OUT_FILES),$($F)) - -define print_vars - $(info "src $(SRC)") - $(info "xml $(XML)") - $(info "formats $(FORMATS)") -endef - -all: documents.html - $(call print_vars) - -documents: - mkdir -p $@ - -documents/%.html: documents/%.xml | documents - ${PREFIX_CMD} metanorma $< - -documents/%.xml: sources/%.xml | documents - mkdir -p $(dir $@) - mv $< $@ - -# Build canonical XML output -# If XML file is provided, copy it over -# Otherwise, build the xml using adoc -sources/%.xml: | bundle - BUILT_TARGET="$(shell yq r metanorma.yml metanorma.source.built_targets[$@])"; \ - if [ "$$BUILT_TARGET" = "" ] || [ "$$BUILT_TARGET" = "null" ]; then \ - BUILT_TARGET=$@; \ - $(PREFIX_CMD) metanorma -x xml "$${BUILT_TARGET//xml/adoc}"; \ - else \ - if [ -f "$$BUILT_TARGET" ] && [ "$${BUILT_TARGET##*.}" == "xml" ]; then \ - cp "$$BUILT_TARGET" $@; \ - else \ - $(PREFIX_CMD) metanorma -x xml $$BUILT_TARGET; \ - cp "$${BUILT_TARGET//adoc/xml}" $@; \ - fi \ - fi - -documents.rxl: $(XML) $(HTML) - ${PREFIX_CMD} 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 - $(PREFIX_CMD) relaton xml2html documents.rxl - -%.adoc: - -define FORMAT_TASKS -OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]')) - -open-$(FORMAT): - open $$(OUT_FILES-$(FORMAT)) - -clean-$(FORMAT): - rm -f $$(OUT_FILES-$(FORMAT)) - -$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT)) - -.PHONY: clean-$(FORMAT) - -endef - -$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS))) - -open: open-html - -clean: - rm -rf documents documents.{html,rxl} published *_images $(OUT_FILES) - -bundle: -ifndef METANORMA_DOCKER -ifndef SKIP_BUNDLE - bundle install --jobs 4 --retry 3 -endif -endif - $(call print_vars) - -.PHONY: bundle all open clean - -# -# Watch-related jobs -# - -.PHONY: watch serve watch-serve - -NODE_BINS := onchange live-serve run-p -NODE_BIN_DIR := node_modules/.bin -NODE_PACKAGE_PATHS := $(foreach PACKAGE_NAME,$(NODE_BINS),$(NODE_BIN_DIR)/$(PACKAGE_NAME)) - -$(NODE_PACKAGE_PATHS): package.json - npm i - -watch: $(NODE_BIN_DIR)/onchange - make all - $< $(ALL_SRC) -- make all - -define WATCH_TASKS -watch-$(FORMAT): $(NODE_BIN_DIR)/onchange - make $(FORMAT) - $$< $$(SRC_$(FORMAT)) -- make $(FORMAT) - -.PHONY: watch-$(FORMAT) -endef - -$(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS))) - -serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js - export PORT=$${PORT:-8123} ; \ - port=$${PORT} ; \ - for html in $(HTML); do \ - $< --entry-file=$$html --port=$${port} --ignore="*.html,*.xml,Makefile,Gemfile.*,package.*.json" --wait=1000 & \ - port=$$(( port++ )) ;\ - done - -watch-serve: $(NODE_BIN_DIR)/run-p - $< watch serve - -# -# Deploy jobs -# - -publish: published - -published: documents.html - mkdir -p $@ && \ - cp -a documents $@/ && \ - cp $< $@/index.html; - -# -# PDF -# - -PDFTEXT := $(patsubst %.pdf,%.txt,$(subst /pdfs,/text,$(wildcard reference-docs/pdfs/*.pdf))) - -pdf2text: $(PDFTEXT) - -reference-docs/text: - mkdir -p $@ - -reference-docs/text/%.txt: reference-docs/pdfs/%.pdf | reference-docs/text - ps2ascii "$<" "$@" diff --git a/common/Makefile.win b/common/Makefile.win deleted file mode 100644 index 625d581..0000000 --- a/common/Makefile.win +++ /dev/null @@ -1,216 +0,0 @@ -# Auto-generated by Cimas: Do not edit it manually! -# See https://github.com/metanorma/cimas -#!make -SHELL := cmd -# Ensure the xml2rfc cache directory exists locally -IGNORE := $(shell md $(USERPROFILE)\.cache\xml2rfc) - -SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-) - -ifeq ($(SRC),null) -SRC := -endif -ifeq ($(SRC),ll) -SRC := -endif - -ifeq ($(SRC),) -BUILT := $(subst ${ },${\n},$(shell yq r metanorma.yml metanorma.source.built_targets | cut -d ":" -f 1)) - -ifeq ($(BUILT),null) -BUILT := -SRC := -endif -ifeq ($(BUILT),ll) -BUILT := -SRC := -endif -ifeq ($(BUILT),) -SRC := -endif - -ifeq ($(BUILT),) -SRC := $(filter-out README.adoc, $(wildcard sources/*.adoc)) -else -XML := $(patsubst sources/%,documents/%,$(BUILT)) -endif -endif - -FORMATS := $(subst -,${ },$(strip $(shell yq r metanorma.yml metanorma.formats))) -ifeq ($(FORMATS),null) -FORMATS := -endif -ifeq ($(FORMATS),) -FORMAT_MARKER := mn-output- -FORMATS := $(subst ${\n},${ },$(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d " " | tr "," "\n" | sort | uniq)) -endif - -XML ?= $(patsubst sources/%,documents/%,$(patsubst %.adoc,%.xml,$(SRC))) -HTML := $(patsubst %.xml,%.html,$(XML)) - -ifdef METANORMA_DOCKER - PREFIX_CMD := echo "Running via docker..." & docker run -v "$$(pwd)":/metanorma/ $(METANORMA_DOCKER) -else - ifdef SKIP_BUNDLE - PREFIX_CMD := echo "Running locally..." & - else - PREFIX_CMD := echo "Running locally via bundle ..." & bundle exec - endif -endif - -_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]')) -OUT_FILES := $(foreach F,$(_OUT_FILES),$($F)) - -define print_vars - $(info "src $(SRC)") - $(info "xml $(XML)") - $(info "formats $(FORMATS)") -endef - -all: documents.html - $(call print_vars) - -documents: - setlocal enableextensions & md $@ & endlocal - -documents/%.html: documents/%.xml | documents - ${PREFIX_CMD} metanorma $< - -documents/%.xml: sources/%.xml | documents - if not exist "$(subst /,\,$(dir $@))" md "$(subst /,\,$(dir $@))" - move "$(subst /,\,$<)" "$(subst /,\,$@)" - -# Build canonical XML output -# If XML file is provided, copy it over -# Otherwise, build the xml using adoc -sources/%.xml: | bundle - $(eval BUILT_TARGET := $(subst /,\,$(shell yq r metanorma.yml metanorma.source.built_targets[$@]))) - $(eval BUILT_TARGET_EMPTY := $(if $(filter $(or $(BUILT_TARGET),null),null ll),true,false)) - if "$(BUILT_TARGET_EMPTY)" == "true" ( \ - $(PREFIX_CMD) metanorma -x xml "$(subst xml,adoc,$@)" \ - ) else ( \ - if exist "$(BUILT_TARGET)" ( \ - if "$(suffix $(BUILT_TARGET))" == ".xml" ( \ - copy "$(BUILT_TARGET)" "$(subst /,\,$@)" \ - ) else ( \ - $(PREFIX_CMD) metanorma $(BUILT_TARGET) & \ - copy "$(subst adoc,xml,$(BUILT_TARGET))" "$(subst /,\,$@)" \ - ) \ - ) else ( \ - $(PREFIX_CMD) metanorma $(BUILT_TARGET) & \ - copy "$(subst adoc,xml,$(BUILT_TARGET))" "$(subst /,\,$@)" \ - ) \ - ) - -documents.rxl: $(XML) $(HTML) - ${PREFIX_CMD} 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 - $(PREFIX_CMD) relaton xml2html documents.rxl - -%.adoc: - -define FORMAT_TASKS -OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]')) - -open-$(FORMAT): - "$$(OUT_FILES-$(FORMAT))" - -clean-$(FORMAT): - del /q $$(OUT_FILES-$(FORMAT)) - -$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT)) - -.PHONY: clean-$(FORMAT) - -endef - -$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS))) - -open: open-html - -clean: - rm -rf $(OUT_FILES) - del /q documents published - del /q *_images - del /q documents.* - -bundle: -ifndef METANORMA_DOCKER -ifndef SKIP_BUNDLE - bundle install --jobs 4 --retry 3 -endif -endif - $(call print_vars) - -.PHONY: bundle all open clean - -# -# Watch-related jobs -# - -.PHONY: watch serve watch-serve - -NODE_BINS := onchange live-serve run-p -NODE_BIN_DIR := node_modules/.bin -NODE_PACKAGE_PATHS := $(foreach PACKAGE_NAME,$(NODE_BINS),$(NODE_BIN_DIR)/$(PACKAGE_NAME)) - -$(NODE_PACKAGE_PATHS): package.json - npm i - -watch: $(NODE_BIN_DIR)/onchange - make all - $< $(ALL_SRC) -- make all - -define WATCH_TASKS -watch-$(FORMAT): $(NODE_BIN_DIR)/onchange - make $(FORMAT) - $$< $$(SRC_$(FORMAT)) -- make $(FORMAT) - -.PHONY: watch-$(FORMAT) -endef - -$(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS))) - -ifndef PORT -override PORT = 8123 -endif - -serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js - set port=$(PORT) & \ - for /r %%html in $(HTML) do ( \ - $< --entry-file=%%html --port=%port% --ignore="*.html,*.xml,Makefile,Gemfile.*,package.*.json" --wait=1000 & \ - set /A port=%port%+1 \ - ) - -watch-serve: $(NODE_BIN_DIR)/run-p - $< watch serve - -# -# Deploy jobs -# - -publish: published - -published: documents.html - setlocal enableextensions & md $@ & endlocal - copy documents $@/ - copy $< $@/index.html - if exist "source\images" xcopy /E source\images $@ - -# -# PDF -# - -PDFTEXT := $(patsubst %.pdf,%.txt,$(subst /pdfs,/text,$(wildcard reference-docs/pdfs/*.pdf))) - -pdf2text: $(PDFTEXT) - -reference-docs/text: - md $@ - -reference-docs/text/%.txt: reference-docs/pdfs/%.pdf | reference-docs/text - ps2ascii "$<" "$@" diff --git a/common/appveyor.yml b/common/appveyor.yml deleted file mode 100644 index 04653ec..0000000 --- a/common/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '{build}' - -environment: - matrix: - - RUBY_VERSION: 25 - - RUBY_VERSION: 24 - - RUBY_VERSION: _trunk - -matrix: - allow_failures: - - RUBY_VERSION: _trunk - -install: - - ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex - - refreshenv - -build_script: - - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% - - bundle update - - bundle install - -before_test: - - ruby -v - - gem -v - - bundle -v - -test_script: - - plantuml -testdot - - make -f Makefile.win clean all publish SHELL=cmd diff --git a/common/deploy.sh b/common/deploy.sh deleted file mode 100755 index 8f74639..0000000 --- a/common/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