Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to use Relaton structure #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
103 changes: 67 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 [email protected] -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
5 changes: 1 addition & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
78 changes: 0 additions & 78 deletions deploy.sh

This file was deleted.

3 changes: 0 additions & 3 deletions metanorma.env

This file was deleted.

8 changes: 8 additions & 0 deletions metanorma.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
metanorma:
deploy:
email: "[email protected]"
relaton:
collection:
name: Calendaring and scheduling -- Calendar subscription upgrades
organization: CalConnect
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.