metanorma-cli 1.2.10.2 → 1.2.13

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: b123acb94793bddc3667bdf7c5f280289fbb4bff4128818c12ea8b262d59badb
4
- data.tar.gz: 294040b9a1d2ef32b01a76a51858301c485c2b5b5a6962e1a1f7c72dfe66cbe5
3
+ metadata.gz: ca50669f47bdf759ee358453d7b684c2be5e1deb7e40f1780ba7d3246da9b4d8
4
+ data.tar.gz: 477cd203ffce066e574983916fef24d88f29e085a698d66f9edea047f291779e
5
5
  SHA512:
6
- metadata.gz: 676fd438ff610dcab7ce3d3fae85e30852dfcdae99a625ea31c21acddfc43c9329ec91b7356e5969fc7226ad3eb611b41c56904916ae147548acf6394524153f
7
- data.tar.gz: 7ceb20aa7c758bc6d420311949fb9a3ecd1894eba4ccb93531f8fdecf60a13274f476c95ebba180664bbb31ff003c482d50a3074679af9e1c683425553448486
6
+ metadata.gz: ae52f5087152a200e1f7ea003b8596b02a6d50bd4b5841e05441cba10bb94350f7d7da7d05fc69ae2ab0b0b998ac48524bf3048b22d4e681996d19333855244e
7
+ data.tar.gz: ca6b3e74d854bfabd4a6089fbc82e435631f2718fb03d63822e9f41d398dd150a7431726c9188a31edcca42387251a0a7eeaf6b1781122a5106a1ba7694fa088
@@ -1,16 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metanorma-cli (1.2.10.2)
4
+ metanorma-cli (1.2.12.1)
5
+ fontist (~> 0.2.0)
5
6
  git (~> 1.5)
6
7
  isodoc (~> 1.0.0)
7
8
  metanorma (~> 1.0.0)
8
- metanorma-acme (~> 1.4.0)
9
9
  metanorma-csa (~> 1.4.0)
10
10
  metanorma-csd (~> 1.3.0)
11
11
  metanorma-gb (~> 1.3.0)
12
+ metanorma-generic (~> 1.4.0)
12
13
  metanorma-iec (~> 1.0.0)
13
14
  metanorma-ietf (~> 2.0.0)
15
+ metanorma-iho (~> 0.0.1)
14
16
  metanorma-iso (~> 1.3.0)
15
17
  metanorma-itu (~> 1.0.0)
16
18
  metanorma-m3d (~> 1.3.0)
@@ -28,25 +30,34 @@ GEM
28
30
  public_suffix (>= 2.0.2, < 5.0)
29
31
  asciidoctor (2.0.10)
30
32
  asciimath (1.0.9)
31
- bibtex-ruby (5.1.2)
33
+ bibtex-ruby (5.1.4)
32
34
  latex-decode (~> 0.0)
33
35
  byebug (10.0.2)
34
36
  camertron-eprun (1.1.1)
35
37
  cldr-plurals-runtime-rb (1.0.1)
36
- cnccs (0.1.5)
38
+ cnccs (0.1.6)
39
+ coderay (1.1.2)
37
40
  concurrent-ruby (1.1.6)
38
41
  diff-lcs (1.3)
39
42
  domain_name (0.5.20190701)
40
43
  unf (>= 0.0.5, < 1.0.0)
44
+ down (5.1.1)
45
+ addressable (~> 2.5)
41
46
  equivalent-xml (0.6.0)
42
47
  nokogiri (>= 1.4.3)
43
- faraday (1.0.0)
48
+ faraday (1.0.1)
44
49
  multipart-post (>= 1.2, < 3)
45
50
  ffi (1.12.2)
51
+ ffi-compiler2 (2.0.0)
52
+ ffi (>= 1.0.0)
53
+ rake
54
+ fontist (0.2.0)
55
+ down (~> 5.0)
56
+ libmspack (~> 0.1.0)
46
57
  gb-agencies (0.0.6)
47
- git (1.6.0)
58
+ git (1.7.0)
48
59
  rchardet (~> 1.8)
49
- html2doc (1.0.0)
60
+ html2doc (1.0.1)
50
61
  asciimath (~> 1.0.9)
51
62
  htmlentities (~> 4.3.4)
52
63
  image_size
@@ -62,7 +73,7 @@ GEM
62
73
  image_size (2.0.2)
63
74
  iso-639 (0.3.5)
64
75
  iso639 (1.3.2)
65
- isodoc (1.0.22)
76
+ isodoc (1.0.27)
66
77
  asciimath
67
78
  html2doc (~> 1.0.0)
68
79
  htmlentities (~> 4.3.4)
@@ -76,20 +87,19 @@ GEM
76
87
  uuidtools
77
88
  isoics (0.1.8)
78
89
  latex-decode (0.3.1)
90
+ libmspack (0.1.0)
91
+ ffi
92
+ ffi-compiler2 (>= 2.0.0)
79
93
  liquid (4.0.3)
80
- mathml2asciimath (0.0.8)
94
+ mathml2asciimath (0.0.10)
81
95
  htmlentities (~> 4.3.4)
82
96
  nokogiri (>= 1.10.4)
83
- metanorma (1.0.0)
97
+ metanorma (1.0.5)
84
98
  asciidoctor
85
99
  htmlentities
100
+ mn2pdf (~> 1.13)
86
101
  nokogiri
87
- metanorma-acme (1.4.4)
88
- htmlentities (~> 4.3.4)
89
- isodoc (~> 1.0.0)
90
- metanorma-standoc (~> 1.3.0)
91
- ruby-jing
92
- metanorma-csa (1.4.7)
102
+ metanorma-csa (1.4.11)
93
103
  htmlentities (~> 4.3.4)
94
104
  image_size
95
105
  isodoc (~> 1.0.0)
@@ -98,33 +108,43 @@ GEM
98
108
  ruby-jing
99
109
  thread_safe
100
110
  uuidtools
101
- metanorma-csd (1.3.16)
111
+ metanorma-csd (1.3.21)
102
112
  isodoc (~> 1.0.0)
103
113
  metanorma-standoc (~> 1.3.0)
104
- metanorma-gb (1.3.19)
114
+ metanorma-gb (1.3.24)
105
115
  gb-agencies (~> 0.0.4)
106
116
  htmlentities (~> 4.3.4)
107
117
  isodoc (~> 1.0.0)
108
118
  metanorma-iso (~> 1.3.0)
109
119
  twitter_cldr (~> 4.4.4)
110
- metanorma-iec (1.0.2)
120
+ metanorma-generic (1.4.9)
121
+ htmlentities (~> 4.3.4)
122
+ isodoc (~> 1.0.0)
123
+ metanorma-standoc (~> 1.3.0)
124
+ ruby-jing
125
+ metanorma-iec (1.0.7)
111
126
  isodoc (~> 1.0.0)
112
127
  metanorma-iso (~> 1.3.0)
113
128
  ruby-jing
114
- metanorma-ietf (2.0.6)
129
+ metanorma-ietf (2.0.10)
115
130
  isodoc (~> 1.0.0)
116
131
  mathml2asciimath
117
132
  metanorma-standoc (~> 1.3.0)
118
- metanorma-iso (1.3.20)
133
+ metanorma-iho (0.0.2)
134
+ htmlentities (~> 4.3.4)
135
+ isodoc (~> 1.0.0)
136
+ metanorma-generic (~> 1.4.0)
137
+ metanorma-standoc (~> 1.3.0)
138
+ metanorma-iso (1.3.25)
119
139
  isodoc (~> 1.0.0)
120
140
  metanorma-standoc (~> 1.3.0)
121
141
  ruby-jing
122
- metanorma-itu (1.0.11)
142
+ metanorma-itu (1.0.15)
123
143
  htmlentities (~> 4.3.4)
124
144
  isodoc (~> 1.0.0)
125
145
  metanorma-standoc (~> 1.3.0)
126
146
  ruby-jing
127
- metanorma-m3d (1.3.15)
147
+ metanorma-m3d (1.3.19)
128
148
  asciimath
129
149
  htmlentities (~> 4.3.4)
130
150
  image_size
@@ -134,32 +154,32 @@ GEM
134
154
  ruby-jing
135
155
  thread_safe
136
156
  uuidtools
137
- metanorma-nist (1.0.3)
157
+ metanorma-nist (1.0.7)
138
158
  htmlentities (~> 4.3.4)
139
159
  isodoc (~> 1.0.0)
140
160
  metanorma-standoc (~> 1.3.0)
141
161
  ruby-jing
142
162
  twitter_cldr
143
163
  tzinfo-data
144
- metanorma-ogc (1.0.3)
164
+ metanorma-ogc (1.0.6)
145
165
  htmlentities (~> 4.3.4)
146
166
  iso-639
147
167
  isodoc (~> 1.0.20)
148
168
  metanorma-standoc (~> 1.3.20)
149
169
  ruby-jing
150
- metanorma-standoc (1.3.21)
170
+ metanorma-standoc (1.3.29)
151
171
  asciidoctor (~> 2.0.0)
152
172
  concurrent-ruby
153
173
  iev (~> 0.2.1)
154
174
  isodoc (~> 1.0.20)
155
175
  mathml2asciimath
156
176
  mimemagic
157
- relaton (~> 0.10.0)
158
- relaton-iev (~> 0.1.0)
177
+ relaton (~> 1.0.0)
178
+ relaton-iev (~> 1.0.0)
159
179
  ruby-jing
160
180
  sterile (~> 1.0.14)
161
181
  unicode2latex (~> 0.0.1)
162
- metanorma-un (0.3.4)
182
+ metanorma-un (0.3.8)
163
183
  htmlentities (~> 4.3.4)
164
184
  iso-639
165
185
  isodoc (~> 1.0.0)
@@ -167,73 +187,82 @@ GEM
167
187
  roman-numerals
168
188
  ruby-jing
169
189
  twitter_cldr
190
+ method_source (1.0.0)
170
191
  mime-types (3.3.1)
171
192
  mime-types-data (~> 3.2015)
172
- mime-types-data (3.2019.1009)
173
- mimemagic (0.3.4)
193
+ mime-types-data (3.2020.0512)
194
+ mimemagic (0.3.5)
174
195
  mini_portile2 (2.4.0)
175
196
  mixlib-shellout (2.4.4)
197
+ mn2pdf (1.14)
176
198
  multipart-post (2.1.1)
177
199
  nokogiri (1.10.9)
178
200
  mini_portile2 (~> 2.4.0)
179
201
  optout (0.0.2)
180
- public_suffix (4.0.3)
202
+ pry (0.13.1)
203
+ coderay (~> 1.1)
204
+ method_source (~> 1.0)
205
+ public_suffix (4.0.5)
181
206
  rake (12.3.3)
182
207
  rchardet (1.8.0)
183
- relaton (0.10.1)
184
- relaton-calconnect (~> 0.6.0)
185
- relaton-gb (~> 0.11.0)
186
- relaton-iec (~> 0.9.0)
187
- relaton-ietf (~> 0.11.0)
188
- relaton-iso (~> 0.11.0)
189
- relaton-itu (~> 0.8.0)
190
- relaton-nist (~> 0.8.0)
191
- relaton-ogc (~> 0.6.0)
192
- relaton-omg (~> 0.2.0)
193
- relaton-un (~> 0.1.0)
194
- relaton-bib (0.8.1)
208
+ relaton (1.0.3)
209
+ relaton-calconnect (>= 1.0.1)
210
+ relaton-gb (~> 1.0.1)
211
+ relaton-iec (>= 1.0.1)
212
+ relaton-ietf (>= 1.0.2)
213
+ relaton-iso (>= 1.0.3)
214
+ relaton-itu (>= 1.0.4)
215
+ relaton-nist (>= 1.0.1)
216
+ relaton-ogc (>= 1.0.1)
217
+ relaton-omg (>= 1.0.1)
218
+ relaton-un (>= 1.0.1)
219
+ relaton-w3c (>= 1.0.1)
220
+ relaton-bib (1.0.3)
195
221
  addressable
196
222
  bibtex-ruby
197
223
  iso639
198
224
  nokogiri
199
- relaton-calconnect (0.6.1)
225
+ relaton-calconnect (1.0.1)
200
226
  faraday
201
- relaton-iso-bib (~> 0.8.0)
202
- relaton-cli (0.8.5)
227
+ relaton-iso-bib (>= 1.0.1)
228
+ relaton-cli (1.0.3)
203
229
  liquid
204
- relaton (~> 0.10.0)
230
+ relaton (>= 1.0.3)
205
231
  thor
206
- relaton-gb (0.11.1)
232
+ relaton-gb (1.0.1)
207
233
  cnccs (~> 0.1.1)
208
234
  gb-agencies (~> 0.0.1)
209
- relaton-iso-bib (~> 0.8.0)
210
- relaton-iec (0.9.0)
235
+ relaton-iso-bib (>= 1.0.1)
236
+ relaton-iec (1.0.1)
211
237
  addressable
212
- relaton-iso-bib (~> 0.8.0)
213
- relaton-ietf (0.11.1)
214
- relaton-bib (~> 0.8.0)
215
- relaton-iev (0.1.3)
216
- relaton (~> 0.7)
217
- relaton-iso (0.11.0)
218
- relaton-iec (~> 0.9.0)
219
- relaton-iso-bib (~> 0.8.0)
220
- relaton-iso-bib (0.8.1)
238
+ relaton-iso-bib (>= 1.0.1)
239
+ relaton-ietf (1.0.3)
240
+ relaton-bib (>= 1.0.3)
241
+ relaton-iev (1.0.0)
242
+ relaton (~> 1)
243
+ relaton-iso (1.0.4)
244
+ relaton-iec (>= 1.0.1)
245
+ relaton-iso-bib (>= 1.0.1)
246
+ relaton-iso-bib (1.0.1)
221
247
  isoics (~> 0.1.6)
222
- relaton-bib (~> 0.8.0)
223
- relaton-itu (0.8.1)
224
- relaton-iso-bib (~> 0.8.0)
225
- relaton-nist (0.8.1)
226
- relaton-bib (~> 0.8.0)
248
+ relaton-bib (>= 1.0.3)
249
+ relaton-itu (1.0.4)
250
+ relaton-iso-bib (>= 1.0.1)
251
+ relaton-nist (1.0.1)
252
+ relaton-bib (>= 1.0.3)
227
253
  rubyzip
228
- relaton-ogc (0.6.1)
254
+ relaton-ogc (1.0.1)
229
255
  faraday (~> 1.0.0)
230
- relaton-iso-bib (~> 0.8.0)
231
- relaton-omg (0.2.1)
232
- relaton-bib (~> 0.8.0)
233
- relaton-un (0.1.0)
256
+ relaton-iso-bib (>= 1.0.1)
257
+ relaton-omg (1.0.1)
258
+ relaton-bib (>= 1.0.3)
259
+ relaton-un (1.0.1)
234
260
  faraday
235
261
  http-cookie
236
- relaton-bib (~> 0.8.0)
262
+ relaton-iso-bib (>= 1.0.1)
263
+ unf_ext (>= 0.0.7.7)
264
+ relaton-w3c (1.0.1)
265
+ relaton-bib (>= 1.0.3)
237
266
  roman-numerals (0.3.0)
238
267
  rspec (3.9.0)
239
268
  rspec-core (~> 3.9.0)
@@ -243,9 +272,9 @@ GEM
243
272
  mixlib-shellout (~> 2.0)
244
273
  rspec (~> 3.2)
245
274
  rspec-its (~> 1.2)
246
- rspec-core (3.9.1)
247
- rspec-support (~> 3.9.1)
248
- rspec-expectations (3.9.1)
275
+ rspec-core (3.9.2)
276
+ rspec-support (~> 3.9.3)
277
+ rspec-expectations (3.9.2)
249
278
  diff-lcs (>= 1.2.0, < 2.0)
250
279
  rspec-support (~> 3.9.0)
251
280
  rspec-its (1.3.0)
@@ -254,27 +283,27 @@ GEM
254
283
  rspec-mocks (3.9.1)
255
284
  diff-lcs (>= 1.2.0, < 2.0)
256
285
  rspec-support (~> 3.9.0)
257
- rspec-support (3.9.2)
286
+ rspec-support (3.9.3)
258
287
  ruby-jing (0.0.1)
259
288
  optout (>= 0.0.2)
260
289
  rubyzip (2.3.0)
261
290
  sassc (2.2.1)
262
291
  ffi (~> 1.9)
263
- sterile (1.0.14)
264
- nokogiri
292
+ sterile (1.0.16)
293
+ nokogiri (>= 1.10.8)
265
294
  thor (0.20.3)
266
295
  thread_safe (0.3.6)
267
296
  twitter_cldr (4.4.5)
268
297
  camertron-eprun
269
298
  cldr-plurals-runtime-rb (~> 1.0)
270
299
  tzinfo
271
- tzinfo (2.0.1)
300
+ tzinfo (2.0.2)
272
301
  concurrent-ruby (~> 1.0)
273
- tzinfo-data (1.2019.3)
302
+ tzinfo-data (1.2020.1)
274
303
  tzinfo (>= 1.0.0)
275
304
  unf (0.1.4)
276
305
  unf_ext
277
- unf_ext (0.0.7.6)
306
+ unf_ext (0.0.7.7)
278
307
  unicode2latex (0.0.3)
279
308
  uuidtools (2.1.5)
280
309
 
@@ -285,6 +314,7 @@ DEPENDENCIES
285
314
  byebug (~> 10.0)
286
315
  equivalent-xml (~> 0.6)
287
316
  metanorma-cli!
317
+ pry
288
318
  rake (~> 12.0)
289
319
  rspec (~> 3.0)
290
320
  rspec-command (~> 1.0.3)
@@ -1,8 +1,9 @@
1
1
  = Metanorma command-line interface (CLI)
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-cli.svg["Gem Version", link="https://rubygems.org/gems/metanorma-cli"]
4
- image:https://travis-ci.com/metanorma/metanorma-cli.svg["Build Status", link="https://travis-ci.com/metanorma/metanorma-cli"]
5
- image:https://ci.appveyor.com/api/projects/status/rclitaq7ofv7a4w2?svg=true["Build Status", link="https://ci.appveyor.com/project/metanorma/metanorma-cli"]
4
+ image:https://github.com/metanorma/metanorma-cli/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-cli/actions?workflow=macos"]
5
+ image:https://github.com/metanorma/metanorma-cli/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-cli/actions?workflow=ubuntu"]
6
+ image:https://github.com/metanorma/metanorma-cli/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-cli/actions?workflow=windows"]
6
7
  image:https://codeclimate.com/github/metanorma/metanorma-cli/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-cli"]
7
8
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-cli.svg["Pull Requests", link="https://github.com/metanorma/metanorma-cli/pulls"]
8
9
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-cli/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-cli/releases"]
data/a CHANGED
@@ -1,2 +1,3 @@
1
- git add Gemfile lib/metanorma/cli/version.rb metanorma-cli.gemspec
1
+ git add lib/metanorma/cli/version.rb metanorma-cli.gemspec
2
+
2
3
 
data/a.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "id": "<GUID>",
3
+ "actor": {
4
+ "name": "<Student Name>",
5
+ "mbox": "<Student Email Address>",
6
+ "objectType": "Person"
7
+ },
8
+ "verb": {
9
+ "id": "http://adlnet.gov/expapi/verbs/completed",
10
+ "display": {
11
+ "en-US": "completed"
12
+ }
13
+ },
14
+ "object": {
15
+ "id": "<Activity URL>",
16
+ "definition": {
17
+ "name": {
18
+ "en-US": "<Activity name>"
19
+ },
20
+ "description": {
21
+ "en-US": "<Activity description>"
22
+ },
23
+ "type": "http://id.tincanapi.com/activitytype/resource"
24
+ },
25
+ "objectType": "Activity"
26
+ },
27
+ "result": {
28
+ "completion": "<Boolean>",
29
+ "duration": "<Cumulative ISO 8601 Duration>"
30
+ },
31
+ "timestamp": "<Start, ISO 8601 DATE>"
32
+ }
33
+
@@ -12,15 +12,29 @@ module Metanorma
12
12
  "metanorma-gb",
13
13
  "metanorma-csd",
14
14
  "metanorma-csa",
15
+ "metanorma-iho",
15
16
  "metanorma-m3d",
16
- "metanorma-acme",
17
+ "metanorma-generic",
17
18
  "metanorma-standoc",
18
19
  "metanorma-un",
19
20
  "metanorma-nist",
20
21
  "metanorma-ogc",
21
- "metanorma-itu"
22
+ "metanorma-itu",
22
23
  ]
23
24
 
25
+ # @TODO: Note
26
+ #
27
+ # This is temporary, we are going to extend this to
28
+ # each of the metanorma gem, so they can specifcy their
29
+ # own font requirements.
30
+ #
31
+ # Please add the whole set here.
32
+ #
33
+ REQUIRED_FONTS = [
34
+ "CALIBRI.TTF",
35
+ "CAMBRIA.TTC",
36
+ ].freeze
37
+
24
38
  PRIVATE_SUPPORTED_GEMS = ["metanorma-rsd", "metanorma-mpfd"]
25
39
 
26
40
  def self.load_flavors(flavor_names = SUPPORTED_GEMS + PRIVATE_SUPPORTED_GEMS)
@@ -80,6 +94,14 @@ module Metanorma
80
94
  Pathname.new(Dir.home).join(".metanorma")
81
95
  end
82
96
 
97
+ def self.fonts_directory
98
+ Metanorma::Cli.home_directory.join("fonts")
99
+ end
100
+
101
+ def self.fonts
102
+ Dir.glob(Metanorma::Cli.fonts_directory.join("**"))
103
+ end
104
+
83
105
  def self.writable_templates_path?
84
106
  parent_directory = templates_path.join("..", "..")
85
107
 
@@ -1,4 +1,5 @@
1
1
  require "thor"
2
+ require "metanorma/cli/setup"
2
3
  require "metanorma/cli/compiler"
3
4
  require "metanorma/cli/generator"
4
5
  require "metanorma/cli/git_template"
@@ -65,14 +66,32 @@ module Metanorma
65
66
  desc "template-repo", "Manage metanorma templates repository"
66
67
  subcommand :template_repo, Metanorma::Cli::Commands::TemplateRepo
67
68
 
69
+ desc "setup", "Initial necessary setup"
70
+ option(
71
+ :agree_to_terms,
72
+ type: :boolean,
73
+ required: false,
74
+ default: false,
75
+ desc: "Agree / Disagree with all third-party licensing terms presented (WARNING: do know what you are agreeing with!)",
76
+ )
77
+
78
+ def setup
79
+ Metanorma::Cli::REQUIRED_FONTS.each do |font|
80
+ Metanorma::Cli::Setup.run(
81
+ font: font,
82
+ term_agreement: options[:agree_to_terms],
83
+ )
84
+ end
85
+ end
86
+
68
87
  private
69
88
 
70
89
  def single_type_extensions(type)
71
- if type
72
- format_keys = find_backend(type).output_formats.keys
73
- UI.say("Supported extensions: #{join_keys(format_keys)}.")
74
- return true
75
- end
90
+ return false unless type
91
+
92
+ format_keys = find_backend(type).output_formats.keys
93
+ UI.say("Supported extensions: #{join_keys(format_keys)}.")
94
+ true
76
95
  end
77
96
 
78
97
  def all_type_extensions
@@ -0,0 +1,80 @@
1
+ require "fontist"
2
+ require "fileutils"
3
+
4
+ module Metanorma
5
+ module Cli
6
+ class Setup
7
+ def initialize(options)
8
+ @options = options
9
+ @font_name = options.fetch(:font)
10
+ @term_agreement = options.fetch(:term_agreement, false)
11
+
12
+ create_metanorma_fonts_directory
13
+ end
14
+
15
+ def self.run(options = {})
16
+ new(options).run
17
+ end
18
+
19
+ def run
20
+ font = Metanorma::Cli.fonts.grep(/#{font_name}/i)
21
+
22
+ if font.empty?
23
+ font_paths = download_font
24
+ copy_to_fonts(font_paths)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :font_name, :options, :term_agreement
31
+
32
+ def create_metanorma_fonts_directory
33
+ unless Metanorma::Cli.fonts_directory.exist?
34
+ FileUtils.mkdir_p(Metanorma::Cli.fonts_directory)
35
+ end
36
+ end
37
+
38
+ def metanorma_fonts_path
39
+ @metanorma_fonts_path ||= Metanorma::Cli.fonts_directory
40
+ end
41
+
42
+ def download_font
43
+ Fontist::Finder.find(font_name)
44
+ rescue Fontist::Errors::MissingFontError
45
+ ask_user_and_download_font(font_name)
46
+ end
47
+
48
+ def copy_to_fonts(fonts_path)
49
+ fonts_path.each do |font_path|
50
+ font_name = File.basename(font_path)
51
+ FileUtils.copy_file(font_path, metanorma_fonts_path.join(font_name))
52
+ end
53
+ end
54
+
55
+ def ask_user_and_download_font(font_name)
56
+ response = term_agreement ? "yes" : "no"
57
+
58
+ if !term_agreement
59
+ response = UI.ask(message.strip)
60
+ end
61
+
62
+ if response.downcase === "yes"
63
+ Fontist::Installer.download(font_name, confirmation: response)
64
+ end
65
+ end
66
+
67
+ def message
68
+ <<~MSG
69
+ Metanorma has detected that you do not have the necessary fonts installed
70
+ for PDF generation. The generated PDF will use generic fonts that may not
71
+ resemble the desired styling. Metanorma can download these files for you
72
+ if you accept the font licensing conditions for the font #{font_name}.
73
+
74
+ If you want Metanorma to download these fonts for you and indicate your
75
+ acceptance of the font licenses, type "Yes" / "No":
76
+ MSG
77
+ end
78
+ end
79
+ end
80
+ end
@@ -3,8 +3,8 @@ require "thor"
3
3
  module Metanorma
4
4
  module Cli
5
5
  class UI < Thor
6
- def self.ask(message)
7
- new.ask(message)
6
+ def self.ask(message, options = {})
7
+ new.ask(message, options)
8
8
  end
9
9
 
10
10
  def self.say(message)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.2.10.2"
3
+ VERSION = "1.2.13"
4
4
  end
5
5
  end
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
  spec.required_ruby_version = '>= 2.4.0'
25
25
 
26
+ spec.add_development_dependency "pry"
26
27
  spec.add_development_dependency "rake", "~> 12.0"
27
28
  spec.add_development_dependency "rspec", "~> 3.0"
28
29
  spec.add_development_dependency "byebug", "~> 10.0"
@@ -37,18 +38,20 @@ Gem::Specification.new do |spec|
37
38
  spec.add_runtime_dependency 'metanorma-iec', "~> 1.0.0"
38
39
  spec.add_runtime_dependency 'metanorma-csd', "~> 1.3.0"
39
40
  spec.add_runtime_dependency 'metanorma-csa', "~> 1.4.0"
40
- #spec.add_runtime_dependency 'metanorma-rsd', "~> 1.1.0"
41
+ #spec.add_runtime_dependency 'metanorma-rsd', "~> 1.4.0"
41
42
  spec.add_runtime_dependency 'metanorma-m3d', "~> 1.3.0"
42
- spec.add_runtime_dependency 'metanorma-acme', "~> 1.4.0"
43
- spec.add_runtime_dependency 'metanorma-standoc', "~> 1.3.0", ">= 1.3.18"
43
+ spec.add_runtime_dependency 'metanorma-generic', "~> 1.4.0"
44
+ spec.add_runtime_dependency 'metanorma-standoc', "~> 1.4.0"
44
45
  #spec.add_runtime_dependency 'metanorma-mpfd', "~> 0.1.0"
45
46
  spec.add_runtime_dependency 'metanorma-un', "~> 0.3.1"
46
47
  spec.add_runtime_dependency 'metanorma-ogc', "~> 1.0.0"
47
48
  spec.add_runtime_dependency 'metanorma-nist', "~> 1.0.0"
48
49
  spec.add_runtime_dependency 'metanorma-itu', "~> 1.0.0"
50
+ spec.add_runtime_dependency 'metanorma-iho', "~> 0.0.1"
49
51
  spec.add_runtime_dependency 'isodoc', "~> 1.0.0"
50
52
  spec.add_runtime_dependency 'metanorma', "~> 1.0.0"
51
53
  #spec.add_runtime_dependency 'nokogiri', ">= 1"
52
54
  spec.add_runtime_dependency "git", "~> 1.5"
53
55
  spec.add_runtime_dependency "relaton-cli", ">= 0.8.2"
56
+ spec.add_runtime_dependency "fontist", "~> 0.2.0"
54
57
  end
data/test.rxl CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
 
6
6
  <docidentifier type="iso">ISO 123</docidentifier>
7
- <docidentifier type="iso-with-lang">ISO 123 (E)</docidentifier>
7
+ <docidentifier type="iso-with-lang">ISO 123(E)</docidentifier>
8
+ <docidentifier type="iso-reference">ISO 123(E)</docidentifier>
8
9
  <docnumber>123</docnumber>
9
10
  <contributor>
10
11
  <role type="author"/>
@@ -24,7 +25,7 @@
24
25
  <language>en</language>
25
26
  <script>script.html</script>
26
27
  <status>
27
- <stage>60</stage>
28
+ <stage abbreviation="IS">60</stage>
28
29
  <substage>60</substage>
29
30
  </status>
30
31
  <copyright>
@@ -46,5 +47,6 @@
46
47
  <structuredidentifier>
47
48
  <project-number>ISO 123</project-number>
48
49
  </structuredidentifier>
50
+ <stagename>International standard</stagename>
49
51
  </ext>
50
52
  </bibdata>
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10.2
4
+ version: 1.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -207,7 +221,7 @@ dependencies:
207
221
  - !ruby/object:Gem::Version
208
222
  version: 1.3.0
209
223
  - !ruby/object:Gem::Dependency
210
- name: metanorma-acme
224
+ name: metanorma-generic
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
227
  - - "~>"
@@ -226,20 +240,14 @@ dependencies:
226
240
  requirements:
227
241
  - - "~>"
228
242
  - !ruby/object:Gem::Version
229
- version: 1.3.0
230
- - - ">="
231
- - !ruby/object:Gem::Version
232
- version: 1.3.18
243
+ version: 1.4.0
233
244
  type: :runtime
234
245
  prerelease: false
235
246
  version_requirements: !ruby/object:Gem::Requirement
236
247
  requirements:
237
248
  - - "~>"
238
249
  - !ruby/object:Gem::Version
239
- version: 1.3.0
240
- - - ">="
241
- - !ruby/object:Gem::Version
242
- version: 1.3.18
250
+ version: 1.4.0
243
251
  - !ruby/object:Gem::Dependency
244
252
  name: metanorma-un
245
253
  requirement: !ruby/object:Gem::Requirement
@@ -296,6 +304,20 @@ dependencies:
296
304
  - - "~>"
297
305
  - !ruby/object:Gem::Version
298
306
  version: 1.0.0
307
+ - !ruby/object:Gem::Dependency
308
+ name: metanorma-iho
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - "~>"
312
+ - !ruby/object:Gem::Version
313
+ version: 0.0.1
314
+ type: :runtime
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - "~>"
319
+ - !ruby/object:Gem::Version
320
+ version: 0.0.1
299
321
  - !ruby/object:Gem::Dependency
300
322
  name: isodoc
301
323
  requirement: !ruby/object:Gem::Requirement
@@ -352,6 +374,20 @@ dependencies:
352
374
  - - ">="
353
375
  - !ruby/object:Gem::Version
354
376
  version: 0.8.2
377
+ - !ruby/object:Gem::Dependency
378
+ name: fontist
379
+ requirement: !ruby/object:Gem::Requirement
380
+ requirements:
381
+ - - "~>"
382
+ - !ruby/object:Gem::Version
383
+ version: 0.2.0
384
+ type: :runtime
385
+ prerelease: false
386
+ version_requirements: !ruby/object:Gem::Requirement
387
+ requirements:
388
+ - - "~>"
389
+ - !ruby/object:Gem::Version
390
+ version: 0.2.0
355
391
  description: Executable to process any Metanorma standard.
356
392
  email:
357
393
  - open.source@ribose.com
@@ -373,6 +409,7 @@ files:
373
409
  - README.adoc
374
410
  - Rakefile
375
411
  - a
412
+ - a.json
376
413
  - a.rb
377
414
  - a.rxl
378
415
  - b
@@ -395,6 +432,7 @@ files:
395
432
  - lib/metanorma/cli/errors.rb
396
433
  - lib/metanorma/cli/generator.rb
397
434
  - lib/metanorma/cli/git_template.rb
435
+ - lib/metanorma/cli/setup.rb
398
436
  - lib/metanorma/cli/template_repo.rb
399
437
  - lib/metanorma/cli/ui.rb
400
438
  - lib/metanorma/cli/version.rb