metanorma-cli 1.3.0 → 1.3.1
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 +4 -4
- data/Gemfile.lock +5 -4
- data/lib/metanorma/cli.rb +0 -13
- data/lib/metanorma/cli/command.rb +22 -5
- data/lib/metanorma/cli/setup.rb +15 -6
- data/lib/metanorma/cli/version.rb +1 -1
- data/metanorma-cli.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 370299374d6064f4be2b1bce3ffe74d816a3221a197e85189e2d076173f4d843
|
|
4
|
+
data.tar.gz: 2a1a633b009ec2e34c809405d7d07f747a598f7a6eaa5d9d7be772d7a53811c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 503038584c4e2e3e869c00225439da73b93427f95a8f3ec3fe93b22c58c703483a4a980be0ae4cd2d9c97aa954db335b5762bc28d82ab9534d8e214894e95f75
|
|
7
|
+
data.tar.gz: bf08778ca3688e38f8df865daf162a02b008530faf2dfb14294609c6d1f329631df721e22b6b220c636aed6084b400bcd6c668dab4616a9a092f5ee7abf9832b
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
metanorma-cli (1.3.
|
|
5
|
-
fontist (~> 0.
|
|
4
|
+
metanorma-cli (1.3.1)
|
|
5
|
+
fontist (~> 1.0.0)
|
|
6
6
|
git (~> 1.5)
|
|
7
7
|
isodoc (~> 1.1.0)
|
|
8
8
|
metanorma (~> 1.1.0)
|
|
@@ -51,9 +51,10 @@ GEM
|
|
|
51
51
|
ffi-compiler2 (2.0.0)
|
|
52
52
|
ffi (>= 1.0.0)
|
|
53
53
|
rake
|
|
54
|
-
fontist (0.
|
|
54
|
+
fontist (1.0.0)
|
|
55
55
|
down (~> 5.0)
|
|
56
56
|
libmspack (~> 0.1.0)
|
|
57
|
+
rubyzip (~> 2.3.0)
|
|
57
58
|
gb-agencies (0.0.6)
|
|
58
59
|
git (1.7.0)
|
|
59
60
|
rchardet (~> 1.8)
|
|
@@ -267,7 +268,7 @@ GEM
|
|
|
267
268
|
relaton-iso-bib (~> 1.2.0)
|
|
268
269
|
relaton-omg (1.2.0)
|
|
269
270
|
relaton-bib (~> 1.2.0)
|
|
270
|
-
relaton-un (1.2.
|
|
271
|
+
relaton-un (1.2.1)
|
|
271
272
|
faraday
|
|
272
273
|
http-cookie
|
|
273
274
|
relaton-bib (~> 1.2.0)
|
data/lib/metanorma/cli.rb
CHANGED
|
@@ -22,19 +22,6 @@ module Metanorma
|
|
|
22
22
|
"metanorma-itu",
|
|
23
23
|
]
|
|
24
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
|
-
|
|
38
25
|
PRIVATE_SUPPORTED_GEMS = ["metanorma-ribose", "metanorma-mpfa"]
|
|
39
26
|
|
|
40
27
|
def self.load_flavors(flavor_names = SUPPORTED_GEMS + PRIVATE_SUPPORTED_GEMS)
|
|
@@ -78,11 +78,15 @@ module Metanorma
|
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
def setup
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
list_required_fonts.each do |font|
|
|
82
|
+
begin
|
|
83
|
+
Metanorma::Cli::Setup.run(
|
|
84
|
+
font: font,
|
|
85
|
+
term_agreement: options[:agree_to_terms],
|
|
86
|
+
)
|
|
87
|
+
rescue Fontist::Errors::NonSupportedFontError
|
|
88
|
+
UI.say("[info]: Font `#{font}` is not supported yet!")
|
|
89
|
+
end
|
|
86
90
|
end
|
|
87
91
|
end
|
|
88
92
|
|
|
@@ -143,6 +147,19 @@ module Metanorma
|
|
|
143
147
|
overwrite: options[:overwrite],
|
|
144
148
|
)
|
|
145
149
|
end
|
|
150
|
+
|
|
151
|
+
def list_required_fonts
|
|
152
|
+
Metanorma::Cli.load_flavors
|
|
153
|
+
|
|
154
|
+
Metanorma::Registry.instance.processors.map do |_key, processor|
|
|
155
|
+
flavour = processor.class.to_s.gsub("::Processor", "")
|
|
156
|
+
flavour_module = Object.const_get(flavour)
|
|
157
|
+
|
|
158
|
+
if flavour_module.respond_to?(:fonts_used)
|
|
159
|
+
flavour_module.fonts_used.map { |_, value| value }.flatten
|
|
160
|
+
end
|
|
161
|
+
end.compact.flatten.uniq
|
|
162
|
+
end
|
|
146
163
|
end
|
|
147
164
|
end
|
|
148
165
|
end
|
data/lib/metanorma/cli/setup.rb
CHANGED
|
@@ -40,9 +40,11 @@ module Metanorma
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def download_font
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
begin
|
|
44
|
+
Fontist::Font.find(font_name)
|
|
45
|
+
rescue Fontist::Errors::MissingFontError
|
|
46
|
+
ask_user_and_download_font(font_name)
|
|
47
|
+
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
def copy_to_fonts(fonts_path)
|
|
@@ -54,23 +56,30 @@ module Metanorma
|
|
|
54
56
|
|
|
55
57
|
def ask_user_and_download_font(font_name)
|
|
56
58
|
response = term_agreement ? "yes" : "no"
|
|
59
|
+
formula = Fontist::Formula.find(font_name)
|
|
57
60
|
|
|
58
61
|
if !term_agreement
|
|
59
|
-
response = UI.ask(message.strip)
|
|
62
|
+
response = UI.ask(message(formula.license).strip)
|
|
60
63
|
end
|
|
61
64
|
|
|
62
65
|
if response.downcase === "yes"
|
|
63
|
-
Fontist::
|
|
66
|
+
Fontist::Font.install(font_name, confirmation: response)
|
|
64
67
|
end
|
|
65
68
|
end
|
|
66
69
|
|
|
67
|
-
def message
|
|
70
|
+
def message(license)
|
|
68
71
|
<<~MSG
|
|
69
72
|
Metanorma has detected that you do not have the necessary fonts installed
|
|
70
73
|
for PDF generation. The generated PDF will use generic fonts that may not
|
|
71
74
|
resemble the desired styling. Metanorma can download these files for you
|
|
72
75
|
if you accept the font licensing conditions for the font #{font_name}.
|
|
73
76
|
|
|
77
|
+
----------
|
|
78
|
+
|
|
79
|
+
#{license}
|
|
80
|
+
|
|
81
|
+
----------
|
|
82
|
+
|
|
74
83
|
If you want Metanorma to download these fonts for you and indicate your
|
|
75
84
|
acceptance of the font licenses, type "Yes" / "No":
|
|
76
85
|
MSG
|
data/metanorma-cli.gemspec
CHANGED
|
@@ -53,5 +53,5 @@ Gem::Specification.new do |spec|
|
|
|
53
53
|
#spec.add_runtime_dependency 'nokogiri', ">= 1"
|
|
54
54
|
spec.add_runtime_dependency "git", "~> 1.5"
|
|
55
55
|
spec.add_runtime_dependency "relaton-cli", ">= 0.8.2"
|
|
56
|
-
spec.add_runtime_dependency "fontist", "~> 0.
|
|
56
|
+
spec.add_runtime_dependency "fontist", "~> 1.0.0"
|
|
57
57
|
end
|
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.
|
|
4
|
+
version: 1.3.1
|
|
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-06-
|
|
11
|
+
date: 2020-06-28 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: 0.
|
|
383
|
+
version: 1.0.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: 0.
|
|
390
|
+
version: 1.0.0
|
|
391
391
|
description: Executable to process any Metanorma standard.
|
|
392
392
|
email:
|
|
393
393
|
- open.source@ribose.com
|