metanorma-cli 1.3.5 → 1.3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6092865e37d131f42abe58d2fc076c71927c694e1f2d3cfecde7071411c4d763
4
- data.tar.gz: 774379371a7961d4d8538cf2d96c3d7067357f5ad7a09da29ea7cb06c6dc6925
3
+ metadata.gz: bca52457b37ec7af1d20e92dd3a1f60073b209ffd209105fdbca912d23bc9e9b
4
+ data.tar.gz: 3ec2294158670ff1cabb3a9cd16a1f60698ca081f302bafb8bd3d43fd0213123
5
5
  SHA512:
6
- metadata.gz: afcdd26a3afb650405cbf87aa4f1a1b1cc97f07fa4a5567aeb11b88df15b8c150cb9d2ba3af0b23f27bfe1671961e672844508dc8c6277ba02b20e4d0f764baa
7
- data.tar.gz: 88db9042c32795683eb56b03818acf6fc9d14336c6ed0e8811e53443c0a890f57790e8ffe1c8566572586034583e45d42f072e25d11032bfcd72a33b589ad6c5
6
+ metadata.gz: ba4426d62ae9df7ea5557a15b218f534d6fe783444a88ed102d4817beff29a67a4da454c112d25f8814c86909e2c3e3f65d2e749915ecd2bd44ea50f548a3120
7
+ data.tar.gz: e5e3cc9b0a10252036478a26e935f4f3495aa35c2649b41fc54f5935fe78ff42a7fea77e14bab1d51776a7d3a0de7de4b6c10c369a76293e9db975643b565129
@@ -49,6 +49,24 @@ module Metanorma
49
49
  end
50
50
  end
51
51
 
52
+ desc "collection FILENAME", "Render HTML pages from XML/YAML colection"
53
+ option :format, aliases: "-x", type: :string, desc: "Formats to generate"
54
+ option "output-folder", aliases: "-w", required: true, desc: "Directory to save compiled files"
55
+ option :coverpage, aliases: "-c", desc: "Liquid template"
56
+
57
+ def collection(filename = nil)
58
+ if filename
59
+ opts = options.dup
60
+ opts[:format] &&= opts[:format].split(",").map &:to_sym
61
+ opts[:output_folder] = opts.delete :"output-folder"
62
+ coll = Metanorma::Collection.parse filename
63
+ coll.render opts
64
+ else UI.say("Need to specify a file to process")
65
+ end
66
+ rescue ArgumentError => e
67
+ UI.say e.message
68
+ end
69
+
52
70
  desc "version", "Version of the code"
53
71
  option :type, aliases: "-t", required: false, desc: "Type of standard to generate"
54
72
  option :format, aliases: "-f", default: :asciidoc, desc: "Format of source file: eg. asciidoc"
@@ -86,8 +104,14 @@ module Metanorma
86
104
  font: font,
87
105
  term_agreement: options[:agree_to_terms],
88
106
  )
107
+ rescue Fontist::Errors::LicensingError
108
+ UI.error(
109
+ "[error]: License acceptance required to install a necessary font." \
110
+ "Accept required licenses with: `metanorma setup --agree-to-terms`."
111
+ )
112
+ return
89
113
  rescue Fontist::Errors::NonSupportedFontError
90
- UI.say("[info]: Font `#{font}` is not supported yet!")
114
+ UI.say("[info]: The font `#{font}` is not yet supported.")
91
115
  end
92
116
  end
93
117
  end
@@ -43,7 +43,7 @@ module Metanorma
43
43
  begin
44
44
  Fontist::Font.find(font_name)
45
45
  rescue Fontist::Errors::MissingFontError
46
- ask_user_and_download_font(font_name)
46
+ process_font_installation(font_name)
47
47
  end
48
48
  end
49
49
 
@@ -54,39 +54,18 @@ module Metanorma
54
54
  end
55
55
  end
56
56
 
57
- def ask_user_and_download_font(font_name)
58
- response = term_agreement ? "yes" : "no"
59
- formula = Fontist::Formula.find(font_name)
57
+ def process_font_installation(font_name)
58
+ accepted_agreement = term_agreement == true ? "yes" : "no"
60
59
 
61
- if !term_agreement
62
- response = UI.ask(message(formula.license).strip)
63
- end
64
-
65
- if response.downcase === "yes"
66
- Fontist::Font.install(font_name, confirmation: response)
67
- end
60
+ UI.say(missing_font_message) if !term_agreement
61
+ Fontist::Font.install(font_name, confirmation: accepted_agreement)
68
62
  end
69
63
 
70
- def message(license)
64
+ def missing_font_message
71
65
  <<~MSG
72
- FONT LICENSE ACCEPTANCE REQUIRED:
73
-
74
- Metanorma has detected that you do not have the necessary fonts installed
75
- for PDF generation. Without those fonts, the generated PDF will use
76
- generic fonts that may not resemble the desired styling.
77
-
78
- Metanorma can download these files for you if you accept the font
79
- licensing conditions for the font "#{font_name}".
80
-
81
- FONT LICENSE BEGIN ("#{font_name}")
82
- -----------------------------------------------------------------------
83
- #{license}
84
- -----------------------------------------------------------------------
85
- FONT LICENSE END ("#{font_name}")
86
-
87
- Do you accept all presented font licenses, and want Metanorma to
88
- download these fonts for you?
89
- => TYPE "Yes" or "No":
66
+ Your system does not have the necessary fonts installed for
67
+ PDF generation. Without these fonts, the generated PDF will use
68
+ generic fonts that may not resemble the desired styling.\n
90
69
  MSG
91
70
  end
92
71
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.3.5"
3
+ VERSION = "1.3.7.3"
4
4
  end
5
5
  end
@@ -59,5 +59,5 @@ Gem::Specification.new do |spec|
59
59
  #spec.add_runtime_dependency 'nokogiri', ">= 1"
60
60
  spec.add_runtime_dependency "git", "~> 1.5"
61
61
  spec.add_runtime_dependency "relaton-cli", ">= 0.8.2"
62
- spec.add_runtime_dependency "fontist", "~> 1.2"
62
+ spec.add_runtime_dependency "fontist", "~> 1.3.0"
63
63
  end
@@ -0,0 +1,74 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: docker
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/test.yml
11
+ - .github/workflows/macos.yml
12
+ - .github/workflows/ubuntu.yml
13
+ - .github/workflows/windows.yml
14
+ - Makefile.win
15
+ repository_dispatch:
16
+ types: [ metanorma/metanorma-docker ]
17
+
18
+ jobs:
19
+ test-docker:
20
+ runs-on: ubuntu-latest
21
+ container: docker://metanorma/mn
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v2
25
+ with:
26
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
27
+ submodules: true
28
+ - name: Setup fonts
29
+ run: |
30
+ metanorma setup --agree-to-terms
31
+ - uses: actions/setup-go@v2-beta
32
+ with:
33
+ go-version: '^1.13.1'
34
+ - name: Install yq
35
+ run: |
36
+ GO111MODULE=on go get github.com/mikefarah/yq/v3
37
+ ln -s $GOPATH/bin/yq /usr/local/bin/yq
38
+ - name: Instal gems from local Gemfile
39
+ run: |
40
+ curl -L --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/gemfile-to-bundle-add.sh | bash
41
+ - name: Build document in the Metanorma container
42
+ env:
43
+ LC_ALL: C.UTF-8
44
+ LANG: C.UTF-8
45
+ LANGUAGE: C.UTF-8
46
+ run: |
47
+ make clean all publish
48
+ - uses: actions/upload-artifact@master
49
+ with:
50
+ name: published
51
+ path: published
52
+
53
+ deploy-gh-pages:
54
+ if: github.ref == 'refs/heads/master'
55
+ runs-on: ubuntu-latest
56
+ needs: test-docker
57
+ steps:
58
+ - uses: actions/checkout@master
59
+ - uses: actions/download-artifact@v1
60
+ with:
61
+ name: published
62
+ - name: Deploy to GH Pages
63
+ uses: peaceiris/actions-gh-pages@v3
64
+ with:
65
+ deploy_key: ${{ secrets.GH_DEPLOY_KEY }}
66
+ publish_dir: ./published
67
+ force_orphan: true
68
+ user_name: ${{ github.actor }}
69
+ user_email: ${{ format('{0}@users.noreply.github.com', github.actor) }}
70
+ commit_message: "${{ format('Deploy to GitHub Pages: {0}', github.sha) }}"
71
+ - uses: kolpav/purge-artifacts-action@v1
72
+ with:
73
+ token: ${{ secrets.GITHUB_TOKEN }}
74
+ expire-in: 0
@@ -0,0 +1,50 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: macos
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/test.yml
11
+ - .github/workflows/docker.yml
12
+ - .github/workflows/ubuntu.yml
13
+ - .github/workflows/windows.yml
14
+ - Makefile.win
15
+
16
+ jobs:
17
+ test-macos:
18
+ name: Test on macOS
19
+ runs-on: macos-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v2
23
+ with:
24
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
25
+ submodules: true
26
+ - name: Cache xml2rfc
27
+ id: cache-xml2rfc
28
+ uses: actions/cache@v1
29
+ with:
30
+ path: ~/.cache/xml2rfc
31
+ key: xml2rfc
32
+ restore-key: xml2rfc
33
+ - name: Use Metanorma
34
+ run: |
35
+ brew update
36
+ brew install yq
37
+ brew install https://raw.githubusercontent.com/metanorma/homebrew-metanorma/master/Formula/metanorma.rb
38
+ metanorma version
39
+ - name: Setup Fonts
40
+ run: |
41
+ metanorma setup --agree-to-terms
42
+ - name: Install bundler
43
+ run: |
44
+ sudo gem install bundler
45
+ - name: Metanorma compile
46
+ env:
47
+ JAVA_OPTS: "java.awt.headless=true"
48
+ run: |
49
+ source $(brew --prefix metanorma)/libexec/venv/bin/activate
50
+ make clean all
@@ -0,0 +1,55 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: ubuntu
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/test.yml
11
+ - .github/workflows/macos.yml
12
+ - .github/workflows/docker.yml
13
+ - .github/workflows/windows.yml
14
+ - Makefile.win
15
+
16
+ jobs:
17
+ test-linux:
18
+ name: Test on Ubuntu
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v2
23
+ with:
24
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
25
+ submodules: true
26
+ - name: Cache xml2rfc
27
+ id: cache-xml2rfc
28
+ uses: actions/cache@v1
29
+ with:
30
+ path: ~/.cache/xml2rfc
31
+ key: xml2rfc
32
+ restore-key: xml2rfc
33
+ - name: Use Metanorma
34
+ run: |
35
+ sudo apt-get update
36
+ curl -L https://raw.githubusercontent.com/metanorma/metanorma-linux-setup/master/ubuntu.sh | sudo bash
37
+ sudo chown -R $USER:$(id -gn $USER) $HOME/.config
38
+ - name: Setup Fonts
39
+ run: |
40
+ sudo gem install rake metanorma-cli
41
+ sudo metanorma setup --agree-to-terms
42
+ - name: Install yq
43
+ run: |
44
+ sudo snap install yq
45
+ echo "::add-path::/snap/bin"
46
+ - name: Install bundler
47
+ run: |
48
+ sudo gem install bundler
49
+ - name: Metanorma compile
50
+ env:
51
+ JAVA_OPTS: "java.awt.headless=true"
52
+ run: |
53
+ source $HOME/.nvm/nvm.sh
54
+ nvm use mn-node
55
+ make clean all publish
@@ -0,0 +1,42 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: windows
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ paths-ignore:
10
+ - .github/workflows/test.yml
11
+ - .github/workflows/macos.yml
12
+ - .github/workflows/ubuntu.yml
13
+ - .github/workflows/docker.yml
14
+ - Makefile
15
+
16
+ jobs:
17
+ test-windows:
18
+ name: Test on Windows
19
+ runs-on: windows-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v2
23
+ with:
24
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || github.token }}
25
+ submodules: true
26
+ - name: Cache xml2rfc
27
+ id: cache-xml2rfc
28
+ uses: actions/cache@v1
29
+ with:
30
+ path: ~/.cache/xml2rfc
31
+ key: xml2rfc
32
+ restore-key: xml2rfc
33
+ - name: Install Metanorma & yq
34
+ shell: pwsh
35
+ run: |
36
+ cinst --no-progress -y metanorma yq
37
+ - name: Install bundler
38
+ run: |
39
+ gem install bundler
40
+ - name: Metanorma compile
41
+ run: |
42
+ make -f Makefile.win clean all SHELL=cmd
@@ -1,15 +1,45 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  image:
2
- name: ribose/metanorma
4
+ name: metanorma/mn
3
5
  entrypoint: [""]
4
6
 
5
7
  cache:
6
8
  paths:
7
9
 
10
+ stages:
11
+ - build
12
+ - deploy
13
+
14
+
8
15
  build:
9
16
  stage: build
10
17
  script:
11
- - bundle
12
- - make clean all publish
18
+ # We need to do this to install mscorefonts
19
+ - curl -Ls -o yq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
20
+ - chmod +x yq && mv yq /usr/bin
21
+ - yq
22
+ - apt-add-repository -y contrib && apt-get update
23
+ - echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
24
+ - apt-get install -y ttf-mscorefonts-installer
25
+ - curl -Ls https://raw.githubusercontent.com/metanorma/vista-fonts-installer/master/vista-fonts-installer.sh | bash
26
+ - curl -L --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/gemfile-to-bundle-add.sh | bash
27
+ - bundle install
28
+ - make clean all
29
+ - make published
30
+ - mv published public
31
+ artifacts:
32
+ paths:
33
+ - public
34
+
35
+ pages:
36
+ dependencies:
37
+ - build
38
+ stage: deploy
39
+ script:
40
+ - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=build"'
13
41
  artifacts:
14
42
  paths:
15
- - published
43
+ - public
44
+ only:
45
+ - master
@@ -1,65 +1,104 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  #!make
2
4
  SHELL := /bin/bash
3
5
  # Ensure the xml2rfc cache directory exists locally
4
6
  IGNORE := $(shell mkdir -p $(HOME)/.cache/xml2rfc)
5
7
 
6
- SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-999)
8
+ SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-)
9
+
10
+ ifeq ($(SRC),null)
11
+ SRC :=
12
+ endif
7
13
  ifeq ($(SRC),ll)
8
- SRC := $(filter-out README.adoc, $(wildcard *.adoc))
14
+ SRC :=
15
+ endif
16
+
17
+ ifeq ($(SRC),)
18
+ BUILT := $(shell yq r metanorma.yml metanorma.source.built_targets | cut -d ':' -f 1 | tr -s '\n' ' ')
19
+
20
+ ifeq ($(BUILT),null)
21
+ SRC :=
22
+ endif
23
+ ifeq ($(BUILT),ll)
24
+ SRC :=
25
+ endif
26
+
27
+ ifeq ($(BUILT),)
28
+ SRC := $(filter-out README.adoc, $(wildcard sources/*.adoc))
29
+ else
30
+ XML := $(patsubst sources/%,documents/%,$(BUILT))
31
+ endif
9
32
  endif
10
33
 
34
+ FORMATS := $(shell yq r metanorma.yml metanorma.formats | tr -d '[:space:]' | tr -s '-' ' ')
35
+ ifeq ($(FORMATS),)
11
36
  FORMAT_MARKER := mn-output-
12
- FORMATS := $(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d ' ' | tr ',' '\n' | sort | uniq | tr '\n' ' ')
13
-
14
- XML := $(patsubst %.adoc,%.xml,$(SRC))
15
- XMLRFC3 := $(patsubst %.adoc,%.v3.xml,$(SRC))
16
- HTML := $(patsubst %.adoc,%.html,$(SRC))
17
- DOC := $(patsubst %.adoc,%.doc,$(SRC))
18
- PDF := $(patsubst %.adoc,%.pdf,$(SRC))
19
- TXT := $(patsubst %.adoc,%.txt,$(SRC))
20
- NITS := $(patsubst %.adoc,%.nits,$(wildcard draft-*.adoc))
21
- WSD := $(wildcard models/*.wsd)
22
- XMI := $(patsubst models/%,xmi/%,$(patsubst %.wsd,%.xmi,$(WSD)))
23
- PNG := $(patsubst models/%,images/%,$(patsubst %.wsd,%.png,$(WSD)))
24
-
25
- COMPILE_CMD_LOCAL := bundle exec metanorma $$FILENAME
26
- COMPILE_CMD_DOCKER := docker run -v "$$(pwd)":/metanorma/ ribose/metanorma "metanorma $$FILENAME"
37
+ FORMATS := $(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d " " | tr "," "\\n" | sort | uniq | tr "\\n" " ")
38
+ endif
39
+
40
+ XML ?= $(patsubst sources/%,documents/%,$(patsubst %.adoc,%.xml,$(SRC)))
41
+ HTML := $(patsubst %.xml,%.html,$(XML))
27
42
 
28
43
  ifdef METANORMA_DOCKER
29
- COMPILE_CMD := echo "Compiling via docker..."; $(COMPILE_CMD_DOCKER)
44
+ PREFIX_CMD := echo "Running via docker..."; docker run -v "$$(pwd)":/metanorma/ $(METANORMA_DOCKER)
30
45
  else
31
- COMPILE_CMD := echo "Compiling locally..."; $(COMPILE_CMD_LOCAL)
46
+ ifdef SKIP_BUNDLE
47
+ PREFIX_CMD := echo "Running locally...";
48
+ else
49
+ PREFIX_CMD := echo "Running locally via bundle ..."; bundle exec
50
+ endif
32
51
  endif
33
52
 
34
53
  _OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
35
54
  OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
36
55
 
37
- all: images $(OUT_FILES)
38
-
39
- %.v3.xml %.xml %.html %.doc %.pdf %.txt: %.adoc | bundle
40
- FILENAME=$^; \
41
- ${COMPILE_CMD}
42
-
43
- draft-%.nits: draft-%.txt
44
- VERSIONED_NAME=`grep :name: draft-$*.adoc | cut -f 2 -d ' '`; \
45
- cp $^ $${VERSIONED_NAME}.txt && \
46
- idnits --verbose $${VERSIONED_NAME}.txt > $@ && \
47
- cp $@ $${VERSIONED_NAME}.nits && \
48
- cat $${VERSIONED_NAME}.nits
49
-
50
- %.nits:
51
-
52
- nits: $(NITS)
53
-
54
- images: $(PNG)
55
-
56
- images/%.png: models/%.wsd
57
- plantuml -tpng -o ../images/ $<
58
-
59
- xmi: $(XMI)
56
+ define print_vars
57
+ $(info "src $(SRC)")
58
+ $(info "xml $(XML)")
59
+ $(info "formats $(FORMATS)")
60
+ endef
60
61
 
61
- xmi/%.xmi: models/%.wsd
62
- plantuml -xmi:star -o ../xmi/ $<
62
+ all: documents.html
63
+ $(call print_vars)
64
+
65
+ documents:
66
+ mkdir -p $@
67
+
68
+ documents/%.html: documents/%.xml | documents
69
+ ${PREFIX_CMD} metanorma $<
70
+
71
+ documents/%.xml: sources/%.xml | documents
72
+ mkdir -p $(dir $@)
73
+ mv $< $@
74
+
75
+ # Build canonical XML output
76
+ # If XML file is provided, copy it over
77
+ # Otherwise, build the xml using adoc
78
+ sources/%.xml: | bundle
79
+ BUILT_TARGET="$(shell yq r metanorma.yml metanorma.source.built_targets[$@])"; \
80
+ if [ "$$BUILT_TARGET" = "" ] || [ "$$BUILT_TARGET" = "null" ]; then \
81
+ BUILT_TARGET=$@; \
82
+ $(PREFIX_CMD) metanorma -x xml "$${BUILT_TARGET//xml/adoc}"; \
83
+ else \
84
+ if [ -f "$$BUILT_TARGET" ] && [ "$${BUILT_TARGET##*.}" == "xml" ]; then \
85
+ cp "$$BUILT_TARGET" $@; \
86
+ else \
87
+ $(PREFIX_CMD) metanorma -x xml $$BUILT_TARGET; \
88
+ cp "$${BUILT_TARGET//adoc/xml}" $@; \
89
+ fi \
90
+ fi
91
+
92
+ documents.rxl: $(XML) $(HTML)
93
+ ${PREFIX_CMD} relaton concatenate \
94
+ -t "$(shell yq r metanorma.yml relaton.collection.name)" \
95
+ -g "$(shell yq r metanorma.yml relaton.collection.organization)" \
96
+ documents $@
97
+
98
+ documents.html: documents.rxl
99
+ $(PREFIX_CMD) relaton xml2html documents.rxl
100
+
101
+ %.adoc:
63
102
 
64
103
  define FORMAT_TASKS
65
104
  OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
@@ -81,10 +120,15 @@ $(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS)))
81
120
  open: open-html
82
121
 
83
122
  clean:
84
- rm -f $(OUT_FILES) && rm -rf published
123
+ rm -rf documents documents.{html,rxl} published *_images $(OUT_FILES)
85
124
 
86
125
  bundle:
87
- if [ "x" == "${METANORMA_DOCKER}x" ]; then bundle; fi
126
+ ifndef METANORMA_DOCKER
127
+ ifndef SKIP_BUNDLE
128
+ bundle install --jobs 4 --retry 3
129
+ endif
130
+ endif
131
+ $(call print_vars)
88
132
 
89
133
  .PHONY: bundle all open clean
90
134
 
@@ -102,20 +146,20 @@ $(NODE_PACKAGE_PATHS): package.json
102
146
  npm i
103
147
 
104
148
  watch: $(NODE_BIN_DIR)/onchange
105
- $(MAKE) all
106
- $< $(ALL_SRC) -- $(MAKE) all
149
+ make all
150
+ $< $(ALL_SRC) -- make all
107
151
 
108
152
  define WATCH_TASKS
109
153
  watch-$(FORMAT): $(NODE_BIN_DIR)/onchange
110
- $(MAKE) $(FORMAT)
111
- $$< $$(SRC_$(FORMAT)) -- $(MAKE) $(FORMAT)
154
+ make $(FORMAT)
155
+ $$< $$(SRC_$(FORMAT)) -- make $(FORMAT)
112
156
 
113
157
  .PHONY: watch-$(FORMAT)
114
158
  endef
115
159
 
116
160
  $(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS)))
117
161
 
118
- serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js images
162
+ serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js
119
163
  export PORT=$${PORT:-8123} ; \
120
164
  port=$${PORT} ; \
121
165
  for html in $(HTML); do \
@@ -130,15 +174,23 @@ watch-serve: $(NODE_BIN_DIR)/run-p
130
174
  # Deploy jobs
131
175
  #
132
176
 
133
- publish:
134
- $(MAKE) published
177
+ publish: published
135
178
 
136
- published:
179
+ published: documents.html
137
180
  mkdir -p $@ && \
138
- export GLOBIGNORE=$(SRC); \
139
- cp -a $(addsuffix .*,$(basename $(SRC))) $@/; \
140
- unset GLOBIGNORE; \
141
- cp $(firstword $(HTML)) $@/index.html
181
+ cp -a documents $@/ && \
182
+ cp $< $@/index.html;
183
+
184
+ #
185
+ # PDF
186
+ #
187
+
188
+ PDFTEXT := $(patsubst %.pdf,%.txt,$(subst /pdfs,/text,$(wildcard reference-docs/pdfs/*.pdf)))
189
+
190
+ pdf2text: $(PDFTEXT)
142
191
 
143
- .PHONY: publish
192
+ reference-docs/text:
193
+ mkdir -p $@
144
194
 
195
+ reference-docs/text/%.txt: reference-docs/pdfs/%.pdf | reference-docs/text
196
+ ps2ascii "$<" "$@"
@@ -1,53 +1,126 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  #!make
4
+ SHELL := cmd
5
+ # Ensure the xml2rfc cache directory exists locally
6
+ IGNORE := $(shell md $(USERPROFILE)\.cache\xml2rfc)
2
7
 
3
- FORMAT_MARKER := mn-output-
4
- FORMATS := $(shell grep "$(FORMAT_MARKER)" *.adoc | cut -f 2 -d ' ' | tr ',' '\n' | sort | uniq | tr '\n' ' ')
8
+ SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-)
9
+
10
+ ifeq ($(SRC),null)
11
+ SRC :=
12
+ endif
13
+ ifeq ($(SRC),ll)
14
+ SRC :=
15
+ endif
16
+
17
+ ifeq ($(SRC),)
18
+ BUILT := $(subst ${ },${\n},$(shell yq r metanorma.yml metanorma.source.built_targets | cut -d ":" -f 1))
19
+
20
+ ifeq ($(BUILT),null)
21
+ BUILT :=
22
+ SRC :=
23
+ endif
24
+ ifeq ($(BUILT),ll)
25
+ BUILT :=
26
+ SRC :=
27
+ endif
28
+ ifeq ($(BUILT),)
29
+ SRC :=
30
+ endif
31
+
32
+ ifeq ($(BUILT),)
33
+ SRC := $(filter-out README.adoc, $(wildcard sources/*.adoc))
34
+ else
35
+ XML := $(patsubst sources/%,documents/%,$(BUILT))
36
+ endif
37
+ endif
5
38
 
6
- SRC := $(filter-out README.adoc, $(wildcard *.adoc))
7
- XML := $(patsubst %.adoc,%.xml,$(SRC))
8
- HTML := $(patsubst %.adoc,%.html,$(SRC))
9
- DOC := $(patsubst %.adoc,%.doc,$(SRC))
10
- PDF := $(patsubst %.adoc,%.pdf,$(SRC))
11
- WSD := $(wildcard models/*.wsd)
12
- XMI := $(patsubst models/%,xmi/%,$(patsubst %.wsd,%.xmi,$(WSD)))
13
- PNG := $(patsubst models/%,images/%,$(patsubst %.wsd,%.png,$(WSD)))
39
+ FORMATS := $(subst -,${ },$(strip $(shell yq r metanorma.yml metanorma.formats)))
40
+ ifeq ($(FORMATS),null)
41
+ FORMATS :=
42
+ endif
43
+ ifeq ($(FORMATS),)
44
+ FORMAT_MARKER := mn-output-
45
+ FORMATS := $(subst ${\n},${ },$(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d " " | tr "," "\n" | sort | uniq))
46
+ endif
14
47
 
15
- HOST_SHARE_DIR=$(USERPROFILE)\$(shell for %%I in (.) do echo %%~nxI)
16
- COMPILE_CMD_LOCAL := bundle exec metanorma $(SRC)
17
- COMPILE_CMD_DOCKER := docker run --rm -it -v $(CURDIR):/metanorma/ ribose/metanorma "metanorma $(SRC)"
48
+ XML ?= $(patsubst sources/%,documents/%,$(patsubst %.adoc,%.xml,$(SRC)))
49
+ HTML := $(patsubst %.xml,%.html,$(XML))
18
50
 
19
51
  ifdef METANORMA_DOCKER
20
- COMPILE_CMD := echo "Compiling via docker..." & $(COMPILE_CMD_DOCKER)
52
+ PREFIX_CMD := echo "Running via docker..." & docker run -v "$$(pwd)":/metanorma/ $(METANORMA_DOCKER)
21
53
  else
22
- COMPILE_CMD := echo "Compiling locally..." & $(COMPILE_CMD_LOCAL)
54
+ ifdef SKIP_BUNDLE
55
+ PREFIX_CMD := echo "Running locally..." &
56
+ else
57
+ PREFIX_CMD := echo "Running locally via bundle ..." & bundle exec
58
+ endif
23
59
  endif
24
60
 
25
61
  _OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
26
62
  OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
27
63
 
28
- all: $(OUT_FILES)
29
-
30
- %.xml %.html %.doc %.pdf: %.adoc | bundle
31
- ${COMPILE_CMD}
64
+ define print_vars
65
+ $(info "src $(SRC)")
66
+ $(info "xml $(XML)")
67
+ $(info "formats $(FORMATS)")
68
+ endef
32
69
 
33
- images: $(PNG)
70
+ all: documents.html
71
+ $(call print_vars)
72
+
73
+ documents:
74
+ setlocal enableextensions & md $@ & endlocal
75
+
76
+ documents/%.html: documents/%.xml | documents
77
+ ${PREFIX_CMD} metanorma $<
78
+
79
+ documents/%.xml: sources/%.xml | documents
80
+ if not exist "$(subst /,\,$(dir $@))" md "$(subst /,\,$(dir $@))"
81
+ move "$(subst /,\,$<)" "$(subst /,\,$@)"
82
+
83
+ # Build canonical XML output
84
+ # If XML file is provided, copy it over
85
+ # Otherwise, build the xml using adoc
86
+ sources/%.xml: | bundle
87
+ $(eval BUILT_TARGET := $(subst /,\,$(shell yq r metanorma.yml metanorma.source.built_targets[$@])))
88
+ $(eval BUILT_TARGET_EMPTY := $(if $(filter $(or $(BUILT_TARGET),null),null ll),true,false))
89
+ if "$(BUILT_TARGET_EMPTY)" == "true" ( \
90
+ $(PREFIX_CMD) metanorma -x xml "$(subst xml,adoc,$@)" \
91
+ ) else ( \
92
+ if exist "$(BUILT_TARGET)" ( \
93
+ if "$(suffix $(BUILT_TARGET))" == ".xml" ( \
94
+ copy "$(BUILT_TARGET)" "$(subst /,\,$@)" \
95
+ ) else ( \
96
+ $(PREFIX_CMD) metanorma $(BUILT_TARGET) & \
97
+ copy "$(subst adoc,xml,$(BUILT_TARGET))" "$(subst /,\,$@)" \
98
+ ) \
99
+ ) else ( \
100
+ $(PREFIX_CMD) metanorma $(BUILT_TARGET) & \
101
+ copy "$(subst adoc,xml,$(BUILT_TARGET))" "$(subst /,\,$@)" \
102
+ ) \
103
+ )
34
104
 
35
- images/%.png: models/%.wsd
36
- plantuml -tpng -o ../images/ $<
105
+ documents.rxl: $(XML) $(HTML)
106
+ ${PREFIX_CMD} relaton concatenate \
107
+ -t "$(shell yq r metanorma.yml relaton.collection.name)" \
108
+ -g "$(shell yq r metanorma.yml relaton.collection.organization)" \
109
+ documents $@
37
110
 
38
- xmi: $(XMI)
111
+ documents.html: documents.rxl
112
+ $(PREFIX_CMD) relaton xml2html documents.rxl
39
113
 
40
- xmi/%.xmi: models/%.wsd
41
- plantuml -xmi:star -o ../xmi/ $<
114
+ %.adoc:
42
115
 
43
116
  define FORMAT_TASKS
44
117
  OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
45
118
 
46
119
  open-$(FORMAT):
47
- $$(OUT_FILES-$(FORMAT))
120
+ "$$(OUT_FILES-$(FORMAT))"
48
121
 
49
122
  clean-$(FORMAT):
50
- rm $$(OUT_FILES-$(FORMAT))
123
+ del /q $$(OUT_FILES-$(FORMAT))
51
124
 
52
125
  $(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT))
53
126
 
@@ -61,9 +134,17 @@ open: open-html
61
134
 
62
135
  clean:
63
136
  rm -rf $(OUT_FILES)
137
+ del /q documents published
138
+ del /q *_images
139
+ del /q documents.*
64
140
 
65
141
  bundle:
66
- IF "" == "${METANORMA_DOCKER}" bundle
142
+ ifndef METANORMA_DOCKER
143
+ ifndef SKIP_BUNDLE
144
+ bundle install --jobs 4 --retry 3
145
+ endif
146
+ endif
147
+ $(call print_vars)
67
148
 
68
149
  .PHONY: bundle all open clean
69
150
 
@@ -94,9 +175,12 @@ endef
94
175
 
95
176
  $(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS)))
96
177
 
97
- serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js images
98
- set PORT=$${PORT:-8123} & \
99
- set port=$${PORT} & \
178
+ ifndef PORT
179
+ override PORT = 8123
180
+ endif
181
+
182
+ serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js
183
+ set port=$(PORT) & \
100
184
  for /r %%html in $(HTML) do ( \
101
185
  $< --entry-file=%%html --port=%port% --ignore="*.html,*.xml,Makefile,Gemfile.*,package.*.json" --wait=1000 & \
102
186
  set /A port=%port%+1 \
@@ -109,8 +193,24 @@ watch-serve: $(NODE_BIN_DIR)/run-p
109
193
  # Deploy jobs
110
194
  #
111
195
 
112
- publish:
113
- mkdir -p published
114
- xcopy $(basename $(SRC)).* published
115
- copy $(firstword $(HTML)) published\index.html
116
- IF EXIST "images" xcopy /E images published
196
+ publish: published
197
+
198
+ published: documents.html
199
+ setlocal enableextensions & md $@ & endlocal
200
+ copy documents $@/
201
+ copy $< $@/index.html
202
+ if exist "source\images" xcopy /E source\images $@
203
+
204
+ #
205
+ # PDF
206
+ #
207
+
208
+ PDFTEXT := $(patsubst %.pdf,%.txt,$(subst /pdfs,/text,$(wildcard reference-docs/pdfs/*.pdf)))
209
+
210
+ pdf2text: $(PDFTEXT)
211
+
212
+ reference-docs/text:
213
+ md $@
214
+
215
+ reference-docs/text/%.txt: reference-docs/pdfs/%.pdf | reference-docs/text
216
+ ps2ascii "$<" "$@"
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  metanorma:
3
3
  deploy:
4
- email: "travis-ci@metanorma.org"
4
+ email: "ci@metanorma.org"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-06 00:00:00.000000000 Z
11
+ date: 2020-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -380,14 +380,14 @@ dependencies:
380
380
  requirements:
381
381
  - - "~>"
382
382
  - !ruby/object:Gem::Version
383
- version: '1.2'
383
+ version: 1.3.0
384
384
  type: :runtime
385
385
  prerelease: false
386
386
  version_requirements: !ruby/object:Gem::Requirement
387
387
  requirements:
388
388
  - - "~>"
389
389
  - !ruby/object:Gem::Version
390
- version: '1.2'
390
+ version: 1.3.0
391
391
  description: Executable to process any Metanorma standard.
392
392
  email:
393
393
  - open.source@ribose.com
@@ -434,19 +434,21 @@ files:
434
434
  - lib/metanorma/cli/ui.rb
435
435
  - lib/metanorma/cli/version.rb
436
436
  - metanorma-cli.gemspec
437
+ - templates/base/.github/workflows/docker.yml
438
+ - templates/base/.github/workflows/macos.yml
439
+ - templates/base/.github/workflows/ubuntu.yml
440
+ - templates/base/.github/workflows/windows.yml
437
441
  - templates/base/.gitignore
438
442
  - templates/base/.gitlab-ci.yml
439
- - templates/base/.travis.yml
440
443
  - templates/base/Gemfile
441
444
  - templates/base/Makefile
442
445
  - templates/base/Makefile.win
443
- - templates/base/appveyor.yml
444
446
  - templates/base/metanorma.yml
445
447
  homepage: https://www.metanorma.com
446
448
  licenses:
447
449
  - BSD-2-Clause
448
450
  metadata: {}
449
- post_install_message:
451
+ post_install_message:
450
452
  rdoc_options: []
451
453
  require_paths:
452
454
  - lib
@@ -462,7 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
462
464
  version: '0'
463
465
  requirements: []
464
466
  rubygems_version: 3.0.3
465
- signing_key:
467
+ signing_key:
466
468
  specification_version: 4
467
469
  summary: Metanorma is the standard of standards; the metanorma gem allows you to create
468
470
  any standard document type supported by Metanorma.
@@ -1,30 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- env:
4
- global:
5
- - COMMIT_AUTHOR_EMAIL="$(yq r metanorma.yml metanorma.deploy.email)"
6
- addons:
7
- apt:
8
- update: true
9
- snaps:
10
- - jq
11
- - yq
12
- - name: node
13
- confinement: classic # or devmode
14
- channel: 10/stable
15
- rvm:
16
- - 2.6
17
- cache: bundler
18
- before_install:
19
- - gem update --system
20
- - gem install bundler
21
- - npm install -g puppeteer
22
- - sudo bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-linux-setup/master/ubuntu.sh | bash"
23
- script:
24
- - make clean all publish
25
- deploy:
26
- skip_cleanup: true
27
- provider: script
28
- script: bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/deploy-to-gh-pages.sh | bash"
29
- on:
30
- branch: master
@@ -1,29 +0,0 @@
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