metanorma-cli 1.2.11 → 1.2.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdca08837843bf60a96818594dcdabf383f7dce70b408ddb020a433995fde94e
4
- data.tar.gz: df5e7a2ee6037a2dfa62d60a89075292983352d6c8f300fab75eee6576c8c1f3
3
+ metadata.gz: 5619f8c8d86684e00381dee890dc190b0ca7d9a8f7cbcd5b5bda9a9d2d6d0c36
4
+ data.tar.gz: 71ff5f56b57549cd38a6766879b7e64833c6c7a61af48665d512d5f3e004eb54
5
5
  SHA512:
6
- metadata.gz: 552168b7f9070abb130c789a5b3cc8550658f9d43ca30ddf8d777a3a6c86c0fde464025d75ec736e40899c9bd2de7ab8953437c1dc07a100d0c0e9509fd30e57
7
- data.tar.gz: adbdcf984e19ad5e4c680fe75f7f552b0fea2aa62e58f16faac9b604e69cc63a80f42497d24fa2584a3e7fd43c3c9edd53810e7de71f85ee4b24b409e4980bff
6
+ metadata.gz: 8dad3bfd10c2b26d832e97edd0699bb523d20775f0634391f75754a62ba2607ab09aec3f3ec1e25453791bca723e9e3f465561ce1fcac98f98493f7f7322d9ea
7
+ data.tar.gz: aa59ca45932ffe1bc520e9d4a6b2f7b9e8051116702f9e1a587cb7fa33b441b1c716261a9bf10def4a0129ee70bdc421f1aae2790b0f5dd98b4d5c5b2228dbdb
@@ -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
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.11"
3
+ VERSION = "1.2.13.1"
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
43
  spec.add_runtime_dependency 'metanorma-generic', "~> 1.4.0"
43
- spec.add_runtime_dependency 'metanorma-standoc', "~> 1.3.0", ">= 1.3.18"
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
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
4
+ version: 1.2.13.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-04-03 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
@@ -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,40 +374,41 @@ 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
358
394
  executables:
359
395
  - metanorma
360
396
  - metanorma-manifest
361
- - metanorma.old
362
397
  extensions: []
363
398
  extra_rdoc_files:
364
399
  - README.adoc
365
400
  - LICENSE
366
401
  files:
367
- - 05-020r26.rxl
368
- - 05-020r26.xml.zip
369
402
  - CODE_OF_CONDUCT.md
370
403
  - Gemfile
371
- - Gemfile.lock
372
404
  - LICENSE
373
405
  - README.adoc
374
406
  - Rakefile
375
- - a
376
- - a.rb
377
- - a.rxl
378
- - b
379
407
  - bin/console
380
408
  - bin/rspec
381
409
  - bin/setup
382
- - csd-tofix 2.zip
383
- - csd-tofix.zip
384
410
  - exe/metanorma
385
411
  - exe/metanorma-manifest
386
- - exe/metanorma.old
387
- - extract/sourcecode/sourcecode-0000.txt
388
- - files.zip
389
412
  - i18n.yaml
390
413
  - lib/metanorma-cli.rb
391
414
  - lib/metanorma/cli.rb
@@ -395,13 +418,11 @@ files:
395
418
  - lib/metanorma/cli/errors.rb
396
419
  - lib/metanorma/cli/generator.rb
397
420
  - lib/metanorma/cli/git_template.rb
421
+ - lib/metanorma/cli/setup.rb
398
422
  - lib/metanorma/cli/template_repo.rb
399
423
  - lib/metanorma/cli/ui.rb
400
424
  - lib/metanorma/cli/version.rb
401
425
  - metanorma-cli.gemspec
402
- - relaton/cache/version
403
- - rice.rxl
404
- - sourcecode/0
405
426
  - templates/base/.gitignore
406
427
  - templates/base/.gitlab-ci.yml
407
428
  - templates/base/.travis.yml
@@ -410,22 +431,6 @@ files:
410
431
  - templates/base/Makefile.win
411
432
  - templates/base/appveyor.yml
412
433
  - templates/base/metanorma.yml
413
- - test.rxl
414
- - tmp/my-custom-csd/Gemfile
415
- - tmp/my-custom-csd/Makefile
416
- - tmp/my-custom-csd/Makefile.win
417
- - tmp/my-custom-csd/appveyor.yml
418
- - tmp/my-custom-csd/metanorma.yml
419
- - tmp/my-document/Gemfile
420
- - tmp/my-document/Makefile
421
- - tmp/my-document/Makefile.win
422
- - tmp/my-document/appveyor.yml
423
- - tmp/my-document/metanorma.yml
424
- - tmp/my-local-document/Gemfile
425
- - tmp/my-local-document/Makefile
426
- - tmp/my-local-document/Makefile.win
427
- - tmp/my-local-document/appveyor.yml
428
- - tmp/my-local-document/metanorma.yml
429
434
  homepage: https://www.metanorma.com
430
435
  licenses:
431
436
  - BSD-2-Clause
@@ -445,8 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
450
  - !ruby/object:Gem::Version
446
451
  version: '0'
447
452
  requirements: []
448
- rubyforge_project:
449
- rubygems_version: 2.7.6
453
+ rubygems_version: 3.0.3
450
454
  signing_key:
451
455
  specification_version: 4
452
456
  summary: Metanorma is the standard of standards; the metanorma gem allows you to create
@@ -1,75 +0,0 @@
1
- <bibdata type="standard">
2
- <title language="en" format="text/plain">Technical Committee Policies and Procedures</title>
3
- <uri>http://docs.opengeospatial.org/pol/05-020r26/05-020r26.html</uri>
4
- <uri type="xml">https://riboseinc.github.io/ogc-tcpnp/ogc-tcpnp.xml</uri>
5
- <uri type="pdf">https://riboseinc.github.io/ogc-tcpnp/ogc-tcpnp.pdf</uri>
6
- <uri type="doc">https://riboseinc.github.io/ogc-tcpnp/ogc-tcpnp.doc</uri>
7
- <docidentifier type="ogc-external">http://www.opengis.net/doc/pol/tcpnp/26.0</docidentifier>
8
- <docidentifier type="ogc-internal">05-020r26</docidentifier>
9
- <docnumber>05-020r26</docnumber>
10
- <date type="published">
11
- <on>2018-07-24</on>
12
- </date>
13
- <date type="issued">
14
- <on>2018-06-05</on>
15
- </date>
16
- <date type="received">
17
- <on>2018-02-14</on>
18
- </date>
19
- <contributor>
20
- <role type="editor"/>
21
- <person>
22
- <name>
23
- <completename>Scott Simmons</completename>
24
- </name>
25
- </person>
26
- </contributor>
27
- <contributor>
28
- <role type="publisher"/>
29
- <organization>
30
- <name>OGC</name>
31
- </organization>
32
- </contributor>
33
- <edition>26.0</edition>
34
-
35
- <language>en</language>
36
- <script>Latn</script><abstract><p>The <eref type="inline" bibitemid="OGC" citeas="OGC 11-145"/> provides a collaborative, consensus process for developing and approving open, international standards for the geospatial domain. "International standards" (as defined in <eref type="inline" bibitemid="ISODIR2" citeas="ISO/IEC Guide 2:2004"/>) are those adopted by an international standardizing/standards organization and made available to the public. Specifically, an OGC standard is:</p>
37
- <p>A document, established by consensus and approved by the OGC Membership, that provides, for common and repeated use, rules, guidelines or characteristics for activities or their results, aimed at the achievement of the optimum degree of order in a given context.</p>
38
- <p>To guide an open standards development and approval process, a member approved Policies and Procedures is required.</p>
39
- <p>This document describes the OGC Technical Committee (TC) policies and procedures (P&amp;P). The TC has been granted authority to operate by the OGC Bylaws. The TC is composed of individuals representing organizations that are duly recognized members in good standing of the OGC. The Technical Committee Chair (TCC - see <xref target="role-of-the-technical-committee-chair-tcc"/>) facilitates the TC process.</p>
40
- <p>The TC P&amp;P:</p>
41
- <ul>
42
- <li>
43
- <p>Documents all TC voting processes and procedures;</p>
44
- </li>
45
- <li>
46
- <p>Documents the formation, scope and processes required for TC subgroup and committee activities;</p>
47
- </li>
48
- <li>
49
- <p>Documents the processes and procedures for submitting, reviewing, and approving a new standard using the Request for Comment procedures; and</p>
50
- </li>
51
- <li>
52
- <p>Documents the process for revisions to adopted OGC® standards.</p>
53
- </li>
54
- </ul>
55
- <p>As the needs and purpose of the TC change, these policies and procedures changes are approved by an electronic vote of the Voting Members of OGC TC or by recommendation of the OGC Planning Committee (PC). These policies and procedures may be augmented or clarified by Policy Directives issued and approved by the TC or the PC. Such directives are databased and hyperlinked to/from the appropriate portion of this document.</p>
56
- <p>The OGC Technical Committee provides an open, collaborative forum for professional discussion related to the consensus development and/or evaluation, approval, and revision of OGC international standards. The primary use of approved OGC standards is to provide the ability to build and deploy interoperable geospatial solutions in the larger Information Technology (IT) domain.</p>
57
- <p>The OGC Principles of Conduct (<eref type="inline" bibitemid="OGCPOC" citeas="OGC Principles of Conduct"/>) govern personal and public interactions in any TC activity.</p></abstract>
58
- <status>
59
- <stage>published</stage>
60
- </status>
61
- <copyright>
62
- <from>2018</from>
63
- <owner>
64
- <organization>
65
- <name>OGC</name>
66
- </organization>
67
- </owner>
68
- </copyright>
69
- <ext>
70
- <doctype>policy</doctype>
71
- <editorialgroup>
72
- <committee>Technical Committee</committee>
73
- </editorialgroup>
74
- </ext>
75
- </bibdata>