metanorma-cli 1.15.3 → 1.15.5

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: fe8f54dc10e8f8acc7cc23f56ca289103ee441b81952fd61e724eeed5da7b722
4
- data.tar.gz: cb3086b488114b02339a15c630e8d275456f4a95829e14ecb80fb96144f3dc15
3
+ metadata.gz: 629f9930c5707c6784dd64a5e518114320d813cbde1690d56469833632ed872d
4
+ data.tar.gz: 59251c03a7c437a62e3b8fa131e66f6232b440fc03f3da0e06807ce06c535510
5
5
  SHA512:
6
- metadata.gz: c5ab355cde8c7fc147f5f16a4b6c84b3a394c097e4a64a9a632545e6b5c00f9c546ec1c32fe391205a9fbb6f597bef4dec0632d243e29fb7a6a70aa771cb3ac3
7
- data.tar.gz: ecc62ec38bbf17b268990456f56596d22c2dd0b913cbbb6cf1f94e5069765b067065bb3e5b9b11c5e3440db4fa31abc0943eff70d1a29ffe9cdc1f9125c662ca
6
+ metadata.gz: c186e300c565b57e198ab517f753f3f5a129909660bc38eb6efb4210d2927a24202668c43bbe5a949e6c201c8d4d5ba18f671ccc0cd2622eb806ee2b1bece3b1
7
+ data.tar.gz: fada74ff2f22b20989a0e514f97fb4a504dc768c29aec547369b04e96bf7d694f901319b3b5efe5a3d86c6e1049539f4c46f6a76e4f1044de82475ccd4a9b91a
@@ -39,7 +39,7 @@ module Metanorma
39
39
  # ooption, and in that case it will use that template.
40
40
  #
41
41
  def self.run(name, type:, doctype:, **options)
42
- new(name, **options.merge(type: type, doctype: doctype)).run
42
+ new(name, **options, type: type, doctype: doctype).run
43
43
  end
44
44
 
45
45
  private
@@ -53,9 +53,13 @@ module Metanorma
53
53
  def create_metanorma_document
54
54
  type_template = type_specific_template
55
55
 
56
- if type_template.empty?
56
+ if type_template.nil?
57
57
  UI.say(
58
- "Unable to generate document:\n#{create_metanorma_document_error}",
58
+ "Unable to generate document:\n#{type_not_found_error}",
59
+ )
60
+ elsif type_template.empty?
61
+ UI.say(
62
+ "Unable to generate document:\n#{doctype_not_found_error}",
59
63
  )
60
64
  else
61
65
  templates = base_templates.merge(type_template)
@@ -63,12 +67,29 @@ module Metanorma
63
67
  end
64
68
  end
65
69
 
66
- def create_metanorma_document_error
70
+ def type_not_found_error
71
+ "Templates for type #{type} cannot be found -- " \
72
+ "please provide a valid `type` or a template URL"
73
+ end
74
+
75
+ def doctype_not_found_error
67
76
  type == "ogc" && doctype == "charter" and return <<~ERR
68
77
  The template for OGC charter documents can be downloaded from https://github.com/opengeospatial/templates/tree/master/charter_templates
69
78
  ERR
70
- "Templates for type #{type} cannot be found -- "\
71
- "please provide a valid `type` or a template URL"
79
+ available = available_template_doctypes
80
+ msg = "Doctype '#{doctype}' not found in templates for type '#{type}'."
81
+ msg += " Available doctypes: #{available.join(', ')}." unless available.empty?
82
+ msg
83
+ end
84
+
85
+ def available_template_doctypes
86
+ return [] unless @type_template_path
87
+
88
+ Pathname.new(@type_template_path).children
89
+ .select(&:directory?)
90
+ .map { |d| d.basename.to_s }
91
+ .reject { |d| d == "common" || d.start_with?(".") }
92
+ .sort
72
93
  end
73
94
 
74
95
  def find_standard_template(type)
@@ -85,13 +106,13 @@ module Metanorma
85
106
  end
86
107
 
87
108
  def type_specific_template
88
- template_path = custom_template || find_standard_template(type)
89
- return {} if template_path.nil?
109
+ @type_template_path = custom_template || find_standard_template(type)
110
+ return nil if @type_template_path.nil?
90
111
 
91
- result = build_template_hash(template_path, doctype)
112
+ result = build_template_hash(@type_template_path, doctype)
92
113
  return result if result.empty?
93
114
 
94
- result.merge(build_template_common_hash(template_path))
115
+ result.merge(build_template_common_hash(@type_template_path))
95
116
  end
96
117
 
97
118
  def custom_template
@@ -86,6 +86,11 @@ module Metanorma
86
86
  iec: "https://github.com/metanorma/mn-templates-iec",
87
87
  itu: "https://github.com/metanorma/mn-templates-itu",
88
88
  ietf: "https://github.com/metanorma/mn-templates-ietf",
89
+ iho: "https://github.com/metanorma/mn-templates-iho",
90
+ cc: "https://github.com/metanorma/mn-templates-cc",
91
+ un: "https://github.com/metanorma/mn-templates-un",
92
+ nist: "https://github.com/metanorma/mn-templates-nist",
93
+ m3aawg: "https://github.com/metanorma/mn-templates-m3aawg",
89
94
  }
90
95
  end
91
96
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.15.3".freeze
3
+ VERSION = "1.15.5".freeze
4
4
  end
5
5
  end
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  # spec.add_dependency 'metanorma-mpfa', "~> 0.9.0"
40
40
  spec.add_dependency "git", ">= 3.0"
41
41
  spec.add_dependency "lutaml-model"
42
- spec.add_dependency "metanorma", "~> 2.3.0"
42
+ spec.add_dependency "metanorma", "~> 2.3.3"
43
43
  spec.add_dependency "metanorma-iho", "~> 1.3.0"
44
44
  spec.add_dependency "metanorma-itu", "~> 2.8.0"
45
45
  # spec.add_dependency "metanorma-nist", "~> 2.7.0"
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.15.3
4
+ version: 1.15.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-17 00:00:00.000000000 Z
11
+ date: 2026-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-ietf
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 2.3.0
173
+ version: 2.3.3
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 2.3.0
180
+ version: 2.3.3
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: metanorma-iho
183
183
  requirement: !ruby/object:Gem::Requirement