metanorma-cli 1.2.11.2 → 1.2.12

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: 3fc0f93f8be72d41f653a11f0aba1c3ef046bb18bb347f778234177bcc83d2f8
4
- data.tar.gz: cdd10afa9f767bbc2fda987e07145a10fc4d1c5cf9e095b9079ddbb42c9f65e1
3
+ metadata.gz: d1509db5c1126e1ca24e22b22128df8e27f99eac3a3e72084d167d169cf2ce08
4
+ data.tar.gz: 34f03e9cf1dd0b3a30431ad892a3341a58d433ebb3760c7ec13976266ce16401
5
5
  SHA512:
6
- metadata.gz: 0b7e981b6af6a005c046da6f45da2b4053d64f20fc708655486bde6bb8b64152ea6e10fccda07de0e73442a2f06e626b58ad78376e360d5969d217aae9a82e0f
7
- data.tar.gz: d4019e7c415d9bdcaea8281911457571d29e449eaae25e0e0685477935c58e783b897ddf94bafec3a155e3e68b51e6fe29c34c770c0e3b9530e116edbf3f76bb
6
+ metadata.gz: 8c068a0d288f8648264126dec89bc49f797eb8fc13a5e8ad94386cc6e4ca145cf289517fba41b1742b6887298433ca9a7fe08ffee2e5f95afd5c1f8bf3124760
7
+ data.tar.gz: 63c5b9715078c9783773cb069aa7b110854a8be81f73f29ace39de2acce93df471e9144f7b13f8579054daa223c3bf0249eddd8643dfaf8f41100cad0cf9ed9e
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metanorma-cli (1.2.11.2)
4
+ metanorma-cli (1.2.12)
5
+ fontist (~> 0.2.0)
5
6
  git (~> 1.5)
6
7
  isodoc (~> 1.0.0)
7
8
  metanorma (~> 1.0.0)
@@ -11,6 +12,7 @@ PATH
11
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)
@@ -34,15 +36,24 @@ GEM
34
36
  camertron-eprun (1.1.1)
35
37
  cldr-plurals-runtime-rb (1.0.1)
36
38
  cnccs (0.1.5)
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
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
58
  git (1.7.0)
48
59
  rchardet (~> 1.8)
@@ -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.25)
76
+ isodoc (1.0.26)
66
77
  asciimath
67
78
  html2doc (~> 1.0.0)
68
79
  htmlentities (~> 4.3.4)
@@ -76,15 +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
94
  mathml2asciimath (0.0.10)
81
95
  htmlentities (~> 4.3.4)
82
96
  nokogiri (>= 1.10.4)
83
- metanorma (1.0.4)
97
+ metanorma (1.0.5)
84
98
  asciidoctor
85
99
  htmlentities
100
+ mn2pdf (~> 1.13)
86
101
  nokogiri
87
- metanorma-csa (1.4.9)
102
+ metanorma-csa (1.4.10)
88
103
  htmlentities (~> 4.3.4)
89
104
  image_size
90
105
  isodoc (~> 1.0.0)
@@ -93,38 +108,43 @@ GEM
93
108
  ruby-jing
94
109
  thread_safe
95
110
  uuidtools
96
- metanorma-csd (1.3.20)
111
+ metanorma-csd (1.3.21)
97
112
  isodoc (~> 1.0.0)
98
113
  metanorma-standoc (~> 1.3.0)
99
- metanorma-gb (1.3.22)
114
+ metanorma-gb (1.3.23)
100
115
  gb-agencies (~> 0.0.4)
101
116
  htmlentities (~> 4.3.4)
102
117
  isodoc (~> 1.0.0)
103
118
  metanorma-iso (~> 1.3.0)
104
119
  twitter_cldr (~> 4.4.4)
105
- metanorma-generic (1.4.7)
120
+ metanorma-generic (1.4.8)
106
121
  htmlentities (~> 4.3.4)
107
122
  isodoc (~> 1.0.0)
108
123
  metanorma-standoc (~> 1.3.0)
109
124
  ruby-jing
110
- metanorma-iec (1.0.5)
125
+ metanorma-iec (1.0.6)
111
126
  isodoc (~> 1.0.0)
112
127
  metanorma-iso (~> 1.3.0)
113
128
  ruby-jing
114
- metanorma-ietf (2.0.9)
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.23)
133
+ metanorma-iho (0.0.1)
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.24)
119
139
  isodoc (~> 1.0.0)
120
140
  metanorma-standoc (~> 1.3.0)
121
141
  ruby-jing
122
- metanorma-itu (1.0.14)
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.18)
147
+ metanorma-m3d (1.3.19)
128
148
  asciimath
129
149
  htmlentities (~> 4.3.4)
130
150
  image_size
@@ -134,20 +154,20 @@ GEM
134
154
  ruby-jing
135
155
  thread_safe
136
156
  uuidtools
137
- metanorma-nist (1.0.6)
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.5)
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.26)
170
+ metanorma-standoc (1.3.28)
151
171
  asciidoctor (~> 2.0.0)
152
172
  concurrent-ruby
153
173
  iev (~> 0.2.1)
@@ -159,7 +179,7 @@ GEM
159
179
  ruby-jing
160
180
  sterile (~> 1.0.14)
161
181
  unicode2latex (~> 0.0.1)
162
- metanorma-un (0.3.7)
182
+ metanorma-un (0.3.8)
163
183
  htmlentities (~> 4.3.4)
164
184
  iso-639
165
185
  isodoc (~> 1.0.0)
@@ -167,20 +187,25 @@ 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.2020.0425)
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.4)
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 (1.0.0)
208
+ relaton (1.0.1)
184
209
  relaton-calconnect (~> 1.0.0)
185
210
  relaton-gb (~> 1.0.0)
186
211
  relaton-iec (~> 1.0.0)
@@ -192,7 +217,7 @@ GEM
192
217
  relaton-omg (~> 1.0.0)
193
218
  relaton-un (~> 1.0.0)
194
219
  relaton-w3c (~> 1.0.0)
195
- relaton-bib (1.0.0)
220
+ relaton-bib (1.0.2)
196
221
  addressable
197
222
  bibtex-ruby
198
223
  iso639
@@ -221,7 +246,7 @@ GEM
221
246
  relaton-iso-bib (1.0.0)
222
247
  isoics (~> 0.1.6)
223
248
  relaton-bib (~> 1.0.0)
224
- relaton-itu (1.0.0)
249
+ relaton-itu (1.0.2)
225
250
  relaton-iso-bib (~> 1.0.0)
226
251
  relaton-nist (1.0.0)
227
252
  relaton-bib (~> 1.0.0)
@@ -247,9 +272,9 @@ GEM
247
272
  mixlib-shellout (~> 2.0)
248
273
  rspec (~> 3.2)
249
274
  rspec-its (~> 1.2)
250
- rspec-core (3.9.1)
251
- rspec-support (~> 3.9.1)
252
- rspec-expectations (3.9.1)
275
+ rspec-core (3.9.2)
276
+ rspec-support (~> 3.9.3)
277
+ rspec-expectations (3.9.2)
253
278
  diff-lcs (>= 1.2.0, < 2.0)
254
279
  rspec-support (~> 3.9.0)
255
280
  rspec-its (1.3.0)
@@ -258,7 +283,7 @@ GEM
258
283
  rspec-mocks (3.9.1)
259
284
  diff-lcs (>= 1.2.0, < 2.0)
260
285
  rspec-support (~> 3.9.0)
261
- rspec-support (3.9.2)
286
+ rspec-support (3.9.3)
262
287
  ruby-jing (0.0.1)
263
288
  optout (>= 0.0.2)
264
289
  rubyzip (2.3.0)
@@ -289,6 +314,7 @@ DEPENDENCIES
289
314
  byebug (~> 10.0)
290
315
  equivalent-xml (~> 0.6)
291
316
  metanorma-cli!
317
+ pry
292
318
  rake (~> 12.0)
293
319
  rspec (~> 3.0)
294
320
  rspec-command (~> 1.0.3)
@@ -12,6 +12,7 @@ module Metanorma
12
12
  "metanorma-gb",
13
13
  "metanorma-csd",
14
14
  "metanorma-csa",
15
+ "metanorma-iho",
15
16
  "metanorma-m3d",
16
17
  "metanorma-generic",
17
18
  "metanorma-standoc",
@@ -21,6 +22,19 @@ module Metanorma
21
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.11.2"
3
+ VERSION = "1.2.12"
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"
@@ -46,9 +47,11 @@ Gem::Specification.new do |spec|
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
@@ -3,7 +3,10 @@
3
3
 
4
4
 
5
5
 
6
-
6
+ <docidentifier type="iso">ISO 123</docidentifier>
7
+ <docidentifier type="iso-with-lang">ISO 123(E)</docidentifier>
8
+ <docidentifier type="iso-reference">ISO 123(E)</docidentifier>
9
+ <docnumber>123</docnumber>
7
10
  <contributor>
8
11
  <role type="author"/>
9
12
  <organization>
@@ -20,7 +23,7 @@
20
23
  </contributor>
21
24
 
22
25
  <language>en</language>
23
- <script>Latn</script>
26
+ <script>script.html</script>
24
27
  <status>
25
28
  <stage abbreviation="IS">60</stage>
26
29
  <substage>60</substage>
@@ -41,6 +44,9 @@
41
44
  <subcommittee/>
42
45
  <workgroup/>
43
46
  </editorialgroup>
47
+ <structuredidentifier>
48
+ <project-number>ISO 123</project-number>
49
+ </structuredidentifier>
44
50
  <stagename>International standard</stagename>
45
51
  </ext>
46
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.11.2
4
+ version: 1.2.12
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-05-01 00:00:00.000000000 Z
11
+ date: 2020-05-13 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
@@ -296,6 +310,20 @@ dependencies:
296
310
  - - "~>"
297
311
  - !ruby/object:Gem::Version
298
312
  version: 1.0.0
313
+ - !ruby/object:Gem::Dependency
314
+ name: metanorma-iho
315
+ requirement: !ruby/object:Gem::Requirement
316
+ requirements:
317
+ - - "~>"
318
+ - !ruby/object:Gem::Version
319
+ version: 0.0.1
320
+ type: :runtime
321
+ prerelease: false
322
+ version_requirements: !ruby/object:Gem::Requirement
323
+ requirements:
324
+ - - "~>"
325
+ - !ruby/object:Gem::Version
326
+ version: 0.0.1
299
327
  - !ruby/object:Gem::Dependency
300
328
  name: isodoc
301
329
  requirement: !ruby/object:Gem::Requirement
@@ -352,6 +380,20 @@ dependencies:
352
380
  - - ">="
353
381
  - !ruby/object:Gem::Version
354
382
  version: 0.8.2
383
+ - !ruby/object:Gem::Dependency
384
+ name: fontist
385
+ requirement: !ruby/object:Gem::Requirement
386
+ requirements:
387
+ - - "~>"
388
+ - !ruby/object:Gem::Version
389
+ version: 0.2.0
390
+ type: :runtime
391
+ prerelease: false
392
+ version_requirements: !ruby/object:Gem::Requirement
393
+ requirements:
394
+ - - "~>"
395
+ - !ruby/object:Gem::Version
396
+ version: 0.2.0
355
397
  description: Executable to process any Metanorma standard.
356
398
  email:
357
399
  - open.source@ribose.com
@@ -395,6 +437,7 @@ files:
395
437
  - lib/metanorma/cli/errors.rb
396
438
  - lib/metanorma/cli/generator.rb
397
439
  - lib/metanorma/cli/git_template.rb
440
+ - lib/metanorma/cli/setup.rb
398
441
  - lib/metanorma/cli/template_repo.rb
399
442
  - lib/metanorma/cli/ui.rb
400
443
  - lib/metanorma/cli/version.rb