metanorma-cli 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +36 -33
- data/appveyor.yml +6 -1
- data/bin/rspec +29 -0
- data/exe/metanorma +15 -1
- data/lib/metanorma/cli.rb +35 -3
- data/lib/metanorma/cli/command.rb +75 -0
- data/lib/metanorma/cli/compiler.rb +56 -0
- data/lib/metanorma/cli/generator.rb +124 -0
- data/lib/metanorma/cli/git_template.rb +104 -0
- data/lib/metanorma/cli/ui.rb +20 -0
- data/lib/metanorma/cli/version.rb +1 -1
- data/metanorma-cli.gemspec +4 -3
- data/templates/base/Gemfile +4 -0
- data/templates/base/Makefile +126 -0
- data/templates/base/Makefile.win +63 -0
- data/templates/base/appveyor.yml +29 -0
- data/templates/base/deploy.sh +78 -0
- data/templates/csd/LICENSE +201 -0
- data/templates/csd/collection/Makefile +139 -0
- data/templates/csd/common/Gemfile +4 -0
- data/templates/csd/common/Makefile +126 -0
- data/templates/csd/common/Makefile.win +63 -0
- data/templates/csd/common/appveyor.yml +29 -0
- data/templates/csd/common/deploy.sh +78 -0
- data/tmp/my-custom-csd/Gemfile +4 -0
- data/tmp/my-custom-csd/Makefile +126 -0
- data/tmp/my-custom-csd/Makefile.win +63 -0
- data/tmp/my-custom-csd/appveyor.yml +29 -0
- data/tmp/my-custom-csd/deploy.sh +78 -0
- data/tmp/my-document/Gemfile +4 -0
- data/tmp/my-document/Makefile +126 -0
- data/tmp/my-document/Makefile.win +63 -0
- data/tmp/my-document/appveyor.yml +29 -0
- data/tmp/my-document/deploy.sh +78 -0
- metadata +58 -2
@@ -0,0 +1,126 @@
|
|
1
|
+
#!make
|
2
|
+
SHELL := /bin/bash
|
3
|
+
|
4
|
+
FORMAT_MARKER := mn-output-
|
5
|
+
FORMATS := $(shell grep "$(FORMAT_MARKER)" *.adoc | cut -f 2 -d ' ' | tr ',' '\n' | sort | uniq | tr '\n' ' ')
|
6
|
+
|
7
|
+
SRC := $(filter-out README.adoc, $(wildcard *.adoc))
|
8
|
+
XML := $(patsubst %.adoc,%.xml,$(SRC))
|
9
|
+
HTML := $(patsubst %.adoc,%.html,$(SRC))
|
10
|
+
DOC := $(patsubst %.adoc,%.doc,$(SRC))
|
11
|
+
PDF := $(patsubst %.adoc,%.pdf,$(SRC))
|
12
|
+
WSD := $(wildcard models/*.wsd)
|
13
|
+
XMI := $(patsubst models/%,xmi/%,$(patsubst %.wsd,%.xmi,$(WSD)))
|
14
|
+
PNG := $(patsubst models/%,images/%,$(patsubst %.wsd,%.png,$(WSD)))
|
15
|
+
|
16
|
+
COMPILE_CMD_LOCAL := bundle exec metanorma $$FILENAME
|
17
|
+
COMPILE_CMD_DOCKER := docker run -v "$$(pwd)":/metanorma/ ribose/metanorma "metanorma $$FILENAME"
|
18
|
+
|
19
|
+
ifdef METANORMA_DOCKER
|
20
|
+
COMPILE_CMD := echo "Compiling via docker..."; $(COMPILE_CMD_DOCKER)
|
21
|
+
else
|
22
|
+
COMPILE_CMD := echo "Compiling locally..."; $(COMPILE_CMD_LOCAL)
|
23
|
+
endif
|
24
|
+
|
25
|
+
_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
26
|
+
OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
|
27
|
+
|
28
|
+
all: images $(OUT_FILES)
|
29
|
+
|
30
|
+
%.xml %.html %.doc %.pdf: %.adoc | bundle
|
31
|
+
FILENAME=$^; \
|
32
|
+
${COMPILE_CMD}
|
33
|
+
|
34
|
+
images: $(PNG)
|
35
|
+
|
36
|
+
images/%.png: models/%.wsd
|
37
|
+
plantuml -tpng -o ../images/ $<
|
38
|
+
|
39
|
+
xmi: $(XMI)
|
40
|
+
|
41
|
+
xmi/%.xmi: models/%.wsd
|
42
|
+
plantuml -xmi:star -o ../xmi/ $<
|
43
|
+
|
44
|
+
define FORMAT_TASKS
|
45
|
+
OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
46
|
+
|
47
|
+
open-$(FORMAT):
|
48
|
+
open $$(OUT_FILES-$(FORMAT))
|
49
|
+
|
50
|
+
clean-$(FORMAT):
|
51
|
+
rm -f $$(OUT_FILES-$(FORMAT))
|
52
|
+
|
53
|
+
$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT))
|
54
|
+
|
55
|
+
.PHONY: clean-$(FORMAT)
|
56
|
+
|
57
|
+
endef
|
58
|
+
|
59
|
+
$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS)))
|
60
|
+
|
61
|
+
open: open-html
|
62
|
+
|
63
|
+
clean:
|
64
|
+
rm -f $(OUT_FILES)
|
65
|
+
|
66
|
+
bundle:
|
67
|
+
if [ "x" == "${METANORMA_DOCKER}x" ]; then bundle; fi
|
68
|
+
|
69
|
+
.PHONY: bundle all open clean
|
70
|
+
|
71
|
+
#
|
72
|
+
# Watch-related jobs
|
73
|
+
#
|
74
|
+
|
75
|
+
.PHONY: watch serve watch-serve
|
76
|
+
|
77
|
+
NODE_BINS := onchange live-serve run-p
|
78
|
+
NODE_BIN_DIR := node_modules/.bin
|
79
|
+
NODE_PACKAGE_PATHS := $(foreach PACKAGE_NAME,$(NODE_BINS),$(NODE_BIN_DIR)/$(PACKAGE_NAME))
|
80
|
+
|
81
|
+
$(NODE_PACKAGE_PATHS): package.json
|
82
|
+
npm i
|
83
|
+
|
84
|
+
watch: $(NODE_BIN_DIR)/onchange
|
85
|
+
make all
|
86
|
+
$< $(ALL_SRC) -- make all
|
87
|
+
|
88
|
+
define WATCH_TASKS
|
89
|
+
watch-$(FORMAT): $(NODE_BIN_DIR)/onchange
|
90
|
+
make $(FORMAT)
|
91
|
+
$$< $$(SRC_$(FORMAT)) -- make $(FORMAT)
|
92
|
+
|
93
|
+
.PHONY: watch-$(FORMAT)
|
94
|
+
endef
|
95
|
+
|
96
|
+
$(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS)))
|
97
|
+
|
98
|
+
serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js images
|
99
|
+
export PORT=$${PORT:-8123} ; \
|
100
|
+
port=$${PORT} ; \
|
101
|
+
for html in $(HTML); do \
|
102
|
+
$< --entry-file=$$html --port=$${port} --ignore="*.html,*.xml,Makefile,Gemfile.*,package.*.json" --wait=1000 & \
|
103
|
+
port=$$(( port++ )) ;\
|
104
|
+
done
|
105
|
+
|
106
|
+
watch-serve: $(NODE_BIN_DIR)/run-p
|
107
|
+
$< watch serve
|
108
|
+
|
109
|
+
#
|
110
|
+
# Deploy jobs
|
111
|
+
#
|
112
|
+
|
113
|
+
publish:
|
114
|
+
mkdir -p published && \
|
115
|
+
cp -a $(basename $(SRC)).* published/ && \
|
116
|
+
cp $(firstword $(HTML)) published/index.html; \
|
117
|
+
if [ -d "images" ]; then cp -a images published; fi
|
118
|
+
|
119
|
+
deploy_key:
|
120
|
+
openssl aes-256-cbc -K $(encrypted_$(ENCRYPTION_LABEL)_key) \
|
121
|
+
-iv $(encrypted_$(ENCRYPTION_LABEL)_iv) -in $@.enc -out $@ -d && \
|
122
|
+
chmod 600 $@
|
123
|
+
|
124
|
+
deploy: deploy_key
|
125
|
+
export COMMIT_AUTHOR_EMAIL=$(COMMIT_AUTHOR_EMAIL); \
|
126
|
+
./deploy.sh
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#!make
|
2
|
+
|
3
|
+
include metanorma.env
|
4
|
+
export $(shell sed 's/=.*//' metanorma.env)
|
5
|
+
|
6
|
+
FORMATS := $(METANORMA_FORMATS)
|
7
|
+
comma := ,
|
8
|
+
empty :=
|
9
|
+
space := $(empty) $(empty)
|
10
|
+
|
11
|
+
SRC := $(filter-out README.adoc, $(wildcard *.adoc))
|
12
|
+
XML := $(patsubst %.adoc,%.xml,$(SRC))
|
13
|
+
HTML := $(patsubst %.adoc,%.html,$(SRC))
|
14
|
+
DOC := $(patsubst %.adoc,%.doc,$(SRC))
|
15
|
+
PDF := $(patsubst %.adoc,%.pdf,$(SRC))
|
16
|
+
RXL := $(patsubst %.adoc,%.rxl,$(SRC))
|
17
|
+
|
18
|
+
HOST_SHARE_DIR=$(USERPROFILE)\$(shell for %%I in (.) do echo %%~nxI)
|
19
|
+
COMPILE_CMD_LOCAL := bundle exec metanorma -R $(RXL) $(SRC)
|
20
|
+
COMPILE_CMD_DOCKER := C:/ProgramData/chocolatey/bin/docker run --rm -it -v $(CURDIR):/metanorma/ ribose/metanorma "metanorma -R $(RXL) $(SRC)"
|
21
|
+
|
22
|
+
ifdef METANORMA_DOCKER
|
23
|
+
COMPILE_CMD := echo "Compiling via docker..." & $(COMPILE_CMD_DOCKER)
|
24
|
+
else
|
25
|
+
COMPILE_CMD := echo "Compiling locally..." & $(COMPILE_CMD_LOCAL)
|
26
|
+
endif
|
27
|
+
|
28
|
+
_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
29
|
+
OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
|
30
|
+
|
31
|
+
all: $(OUT_FILES)
|
32
|
+
|
33
|
+
%.xml %.html %.doc %.pdf: %.adoc | bundle
|
34
|
+
${COMPILE_CMD}
|
35
|
+
|
36
|
+
define FORMAT_TASKS
|
37
|
+
OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
38
|
+
|
39
|
+
open-$(FORMAT):
|
40
|
+
$$(OUT_FILES-$(FORMAT))
|
41
|
+
|
42
|
+
clean-$(FORMAT):
|
43
|
+
rm $$(OUT_FILES-$(FORMAT))
|
44
|
+
|
45
|
+
$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT))
|
46
|
+
|
47
|
+
.PHONY: clean-$(FORMAT)
|
48
|
+
|
49
|
+
endef
|
50
|
+
|
51
|
+
$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS)))
|
52
|
+
|
53
|
+
# open: $(foreach FORMAT,$(FORMATS),open-$(FORMAT))
|
54
|
+
|
55
|
+
open: open-html
|
56
|
+
|
57
|
+
clean:
|
58
|
+
rm -rf $(OUT_FILES)
|
59
|
+
|
60
|
+
bundle:
|
61
|
+
IF "" == "${METANORMA_DOCKER}" bundle
|
62
|
+
|
63
|
+
.PHONY: bundle all open clean
|
@@ -0,0 +1,29 @@
|
|
1
|
+
version: '{build}'
|
2
|
+
|
3
|
+
environment:
|
4
|
+
matrix:
|
5
|
+
- RUBY_VERSION: 25
|
6
|
+
- RUBY_VERSION: 24
|
7
|
+
- RUBY_VERSION: _trunk
|
8
|
+
|
9
|
+
matrix:
|
10
|
+
allow_failures:
|
11
|
+
- RUBY_VERSION: _trunk
|
12
|
+
|
13
|
+
install:
|
14
|
+
- ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
|
15
|
+
- refreshenv
|
16
|
+
|
17
|
+
build_script:
|
18
|
+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
19
|
+
- bundle update
|
20
|
+
- bundle install
|
21
|
+
|
22
|
+
before_test:
|
23
|
+
- ruby -v
|
24
|
+
- gem -v
|
25
|
+
- bundle -v
|
26
|
+
|
27
|
+
test_script:
|
28
|
+
- plantuml -testdot
|
29
|
+
- make -f Makefile.win clean all publish SHELL=cmd
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# TODO: replace this script when https://github.com/travis-ci/dpl/issues/694 is fixed
|
3
|
+
# Taken from https://raw.githubusercontent.com/w3c/permissions/master/deploy.sh
|
4
|
+
set -e # Exit with nonzero exit code if anything fails
|
5
|
+
|
6
|
+
errx() {
|
7
|
+
readonly __progname=$(basename ${BASH_SOURCE})
|
8
|
+
echo -e "[${__progname}] $@" >&2
|
9
|
+
exit 1
|
10
|
+
}
|
11
|
+
|
12
|
+
SOURCE_BRANCH="master"
|
13
|
+
TARGET_BRANCH="gh-pages"
|
14
|
+
KEY_NAME=$(pwd)/deploy_key
|
15
|
+
|
16
|
+
main() {
|
17
|
+
|
18
|
+
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
|
19
|
+
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
|
20
|
+
echo "Not a Travis PR or not matching branch ($SOURCE_BRANCH); skipping deploy."
|
21
|
+
exit 0
|
22
|
+
fi
|
23
|
+
|
24
|
+
[ -z "$COMMIT_AUTHOR_EMAIL" ] && \
|
25
|
+
errx "No COMMIT_AUTHOR_EMAIL provided; it must be set."
|
26
|
+
|
27
|
+
if [ ! -f ${KEY_NAME} ]; then
|
28
|
+
errx "No ${KEY_NAME} file detected; is ${KEY_NAME}.enc decrypted?"
|
29
|
+
fi
|
30
|
+
|
31
|
+
# Save some useful information
|
32
|
+
REPO=`git config remote.origin.url`
|
33
|
+
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
|
34
|
+
SHA=`git rev-parse --verify HEAD`
|
35
|
+
DEST_DIR=out
|
36
|
+
|
37
|
+
# Clone the existing $TARGET_BRANCH for this repo into $DEST_DIR/
|
38
|
+
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deploy)
|
39
|
+
# git clone $REPO $DEST_DIR
|
40
|
+
git clone $REPO $DEST_DIR || errx "Unable to clone Git."
|
41
|
+
pushd $DEST_DIR
|
42
|
+
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH || errx "Unable to checkout git."
|
43
|
+
popd
|
44
|
+
|
45
|
+
# Clean out existing contents in $TARGET_BRANCH clone
|
46
|
+
rm -rf $DEST_DIR/* || exit 0
|
47
|
+
|
48
|
+
# Adding contents within published/ to $DEST_DIR.
|
49
|
+
cp -a published/* $DEST_DIR/ || exit 0
|
50
|
+
|
51
|
+
# Now let's go have some fun with the cloned repo
|
52
|
+
pushd $DEST_DIR
|
53
|
+
git config user.name "Travis CI"
|
54
|
+
git config user.email "$COMMIT_AUTHOR_EMAIL"
|
55
|
+
|
56
|
+
# If there are no changes to the compiled out (e.g. this is a README update) then just bail.
|
57
|
+
if [[ -z $(git status -s) ]]; then
|
58
|
+
echo "No changes to the output on this push; exiting."
|
59
|
+
exit 0
|
60
|
+
fi
|
61
|
+
|
62
|
+
git status
|
63
|
+
|
64
|
+
# Commit the "changes", i.e. the new version.
|
65
|
+
# The delta will show diffs between new and old versions.
|
66
|
+
git add .
|
67
|
+
git commit -m "Deploy to GitHub Pages: ${SHA}"
|
68
|
+
|
69
|
+
eval `ssh-agent -s`
|
70
|
+
ssh-add ${KEY_NAME}
|
71
|
+
|
72
|
+
# Now that we're all set up, we can push.
|
73
|
+
git push $SSH_REPO $TARGET_BRANCH || errx "Unable to push to git."
|
74
|
+
}
|
75
|
+
|
76
|
+
main "$@"
|
77
|
+
|
78
|
+
exit 0
|
@@ -0,0 +1,126 @@
|
|
1
|
+
#!make
|
2
|
+
SHELL := /bin/bash
|
3
|
+
|
4
|
+
FORMAT_MARKER := mn-output-
|
5
|
+
FORMATS := $(shell grep "$(FORMAT_MARKER)" *.adoc | cut -f 2 -d ' ' | tr ',' '\n' | sort | uniq | tr '\n' ' ')
|
6
|
+
|
7
|
+
SRC := $(filter-out README.adoc, $(wildcard *.adoc))
|
8
|
+
XML := $(patsubst %.adoc,%.xml,$(SRC))
|
9
|
+
HTML := $(patsubst %.adoc,%.html,$(SRC))
|
10
|
+
DOC := $(patsubst %.adoc,%.doc,$(SRC))
|
11
|
+
PDF := $(patsubst %.adoc,%.pdf,$(SRC))
|
12
|
+
WSD := $(wildcard models/*.wsd)
|
13
|
+
XMI := $(patsubst models/%,xmi/%,$(patsubst %.wsd,%.xmi,$(WSD)))
|
14
|
+
PNG := $(patsubst models/%,images/%,$(patsubst %.wsd,%.png,$(WSD)))
|
15
|
+
|
16
|
+
COMPILE_CMD_LOCAL := bundle exec metanorma $$FILENAME
|
17
|
+
COMPILE_CMD_DOCKER := docker run -v "$$(pwd)":/metanorma/ ribose/metanorma "metanorma $$FILENAME"
|
18
|
+
|
19
|
+
ifdef METANORMA_DOCKER
|
20
|
+
COMPILE_CMD := echo "Compiling via docker..."; $(COMPILE_CMD_DOCKER)
|
21
|
+
else
|
22
|
+
COMPILE_CMD := echo "Compiling locally..."; $(COMPILE_CMD_LOCAL)
|
23
|
+
endif
|
24
|
+
|
25
|
+
_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
26
|
+
OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
|
27
|
+
|
28
|
+
all: images $(OUT_FILES)
|
29
|
+
|
30
|
+
%.xml %.html %.doc %.pdf: %.adoc | bundle
|
31
|
+
FILENAME=$^; \
|
32
|
+
${COMPILE_CMD}
|
33
|
+
|
34
|
+
images: $(PNG)
|
35
|
+
|
36
|
+
images/%.png: models/%.wsd
|
37
|
+
plantuml -tpng -o ../images/ $<
|
38
|
+
|
39
|
+
xmi: $(XMI)
|
40
|
+
|
41
|
+
xmi/%.xmi: models/%.wsd
|
42
|
+
plantuml -xmi:star -o ../xmi/ $<
|
43
|
+
|
44
|
+
define FORMAT_TASKS
|
45
|
+
OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
46
|
+
|
47
|
+
open-$(FORMAT):
|
48
|
+
open $$(OUT_FILES-$(FORMAT))
|
49
|
+
|
50
|
+
clean-$(FORMAT):
|
51
|
+
rm -f $$(OUT_FILES-$(FORMAT))
|
52
|
+
|
53
|
+
$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT))
|
54
|
+
|
55
|
+
.PHONY: clean-$(FORMAT)
|
56
|
+
|
57
|
+
endef
|
58
|
+
|
59
|
+
$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS)))
|
60
|
+
|
61
|
+
open: open-html
|
62
|
+
|
63
|
+
clean:
|
64
|
+
rm -f $(OUT_FILES)
|
65
|
+
|
66
|
+
bundle:
|
67
|
+
if [ "x" == "${METANORMA_DOCKER}x" ]; then bundle; fi
|
68
|
+
|
69
|
+
.PHONY: bundle all open clean
|
70
|
+
|
71
|
+
#
|
72
|
+
# Watch-related jobs
|
73
|
+
#
|
74
|
+
|
75
|
+
.PHONY: watch serve watch-serve
|
76
|
+
|
77
|
+
NODE_BINS := onchange live-serve run-p
|
78
|
+
NODE_BIN_DIR := node_modules/.bin
|
79
|
+
NODE_PACKAGE_PATHS := $(foreach PACKAGE_NAME,$(NODE_BINS),$(NODE_BIN_DIR)/$(PACKAGE_NAME))
|
80
|
+
|
81
|
+
$(NODE_PACKAGE_PATHS): package.json
|
82
|
+
npm i
|
83
|
+
|
84
|
+
watch: $(NODE_BIN_DIR)/onchange
|
85
|
+
make all
|
86
|
+
$< $(ALL_SRC) -- make all
|
87
|
+
|
88
|
+
define WATCH_TASKS
|
89
|
+
watch-$(FORMAT): $(NODE_BIN_DIR)/onchange
|
90
|
+
make $(FORMAT)
|
91
|
+
$$< $$(SRC_$(FORMAT)) -- make $(FORMAT)
|
92
|
+
|
93
|
+
.PHONY: watch-$(FORMAT)
|
94
|
+
endef
|
95
|
+
|
96
|
+
$(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS)))
|
97
|
+
|
98
|
+
serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js images
|
99
|
+
export PORT=$${PORT:-8123} ; \
|
100
|
+
port=$${PORT} ; \
|
101
|
+
for html in $(HTML); do \
|
102
|
+
$< --entry-file=$$html --port=$${port} --ignore="*.html,*.xml,Makefile,Gemfile.*,package.*.json" --wait=1000 & \
|
103
|
+
port=$$(( port++ )) ;\
|
104
|
+
done
|
105
|
+
|
106
|
+
watch-serve: $(NODE_BIN_DIR)/run-p
|
107
|
+
$< watch serve
|
108
|
+
|
109
|
+
#
|
110
|
+
# Deploy jobs
|
111
|
+
#
|
112
|
+
|
113
|
+
publish:
|
114
|
+
mkdir -p published && \
|
115
|
+
cp -a $(basename $(SRC)).* published/ && \
|
116
|
+
cp $(firstword $(HTML)) published/index.html; \
|
117
|
+
if [ -d "images" ]; then cp -a images published; fi
|
118
|
+
|
119
|
+
deploy_key:
|
120
|
+
openssl aes-256-cbc -K $(encrypted_$(ENCRYPTION_LABEL)_key) \
|
121
|
+
-iv $(encrypted_$(ENCRYPTION_LABEL)_iv) -in $@.enc -out $@ -d && \
|
122
|
+
chmod 600 $@
|
123
|
+
|
124
|
+
deploy: deploy_key
|
125
|
+
export COMMIT_AUTHOR_EMAIL=$(COMMIT_AUTHOR_EMAIL); \
|
126
|
+
./deploy.sh
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#!make
|
2
|
+
|
3
|
+
include metanorma.env
|
4
|
+
export $(shell sed 's/=.*//' metanorma.env)
|
5
|
+
|
6
|
+
FORMATS := $(METANORMA_FORMATS)
|
7
|
+
comma := ,
|
8
|
+
empty :=
|
9
|
+
space := $(empty) $(empty)
|
10
|
+
|
11
|
+
SRC := $(filter-out README.adoc, $(wildcard *.adoc))
|
12
|
+
XML := $(patsubst %.adoc,%.xml,$(SRC))
|
13
|
+
HTML := $(patsubst %.adoc,%.html,$(SRC))
|
14
|
+
DOC := $(patsubst %.adoc,%.doc,$(SRC))
|
15
|
+
PDF := $(patsubst %.adoc,%.pdf,$(SRC))
|
16
|
+
RXL := $(patsubst %.adoc,%.rxl,$(SRC))
|
17
|
+
|
18
|
+
HOST_SHARE_DIR=$(USERPROFILE)\$(shell for %%I in (.) do echo %%~nxI)
|
19
|
+
COMPILE_CMD_LOCAL := bundle exec metanorma -R $(RXL) $(SRC)
|
20
|
+
COMPILE_CMD_DOCKER := C:/ProgramData/chocolatey/bin/docker run --rm -it -v $(CURDIR):/metanorma/ ribose/metanorma "metanorma -R $(RXL) $(SRC)"
|
21
|
+
|
22
|
+
ifdef METANORMA_DOCKER
|
23
|
+
COMPILE_CMD := echo "Compiling via docker..." & $(COMPILE_CMD_DOCKER)
|
24
|
+
else
|
25
|
+
COMPILE_CMD := echo "Compiling locally..." & $(COMPILE_CMD_LOCAL)
|
26
|
+
endif
|
27
|
+
|
28
|
+
_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
29
|
+
OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
|
30
|
+
|
31
|
+
all: $(OUT_FILES)
|
32
|
+
|
33
|
+
%.xml %.html %.doc %.pdf: %.adoc | bundle
|
34
|
+
${COMPILE_CMD}
|
35
|
+
|
36
|
+
define FORMAT_TASKS
|
37
|
+
OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
38
|
+
|
39
|
+
open-$(FORMAT):
|
40
|
+
$$(OUT_FILES-$(FORMAT))
|
41
|
+
|
42
|
+
clean-$(FORMAT):
|
43
|
+
rm $$(OUT_FILES-$(FORMAT))
|
44
|
+
|
45
|
+
$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT))
|
46
|
+
|
47
|
+
.PHONY: clean-$(FORMAT)
|
48
|
+
|
49
|
+
endef
|
50
|
+
|
51
|
+
$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS)))
|
52
|
+
|
53
|
+
# open: $(foreach FORMAT,$(FORMATS),open-$(FORMAT))
|
54
|
+
|
55
|
+
open: open-html
|
56
|
+
|
57
|
+
clean:
|
58
|
+
rm -rf $(OUT_FILES)
|
59
|
+
|
60
|
+
bundle:
|
61
|
+
IF "" == "${METANORMA_DOCKER}" bundle
|
62
|
+
|
63
|
+
.PHONY: bundle all open clean
|