metanorma-cli 1.15.1 → 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 +4 -4
- data/lib/metanorma/cli/flavor.rb +3 -3
- data/lib/metanorma/cli/generator.rb +31 -10
- data/lib/metanorma/cli/git_template.rb +5 -0
- data/lib/metanorma/cli/version.rb +1 -1
- data/metanorma-cli.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 629f9930c5707c6784dd64a5e518114320d813cbde1690d56469833632ed872d
|
|
4
|
+
data.tar.gz: 59251c03a7c437a62e3b8fa131e66f6232b440fc03f3da0e06807ce06c535510
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c186e300c565b57e198ab517f753f3f5a129909660bc38eb6efb4210d2927a24202668c43bbe5a949e6c201c8d4d5ba18f671ccc0cd2622eb806ee2b1bece3b1
|
|
7
|
+
data.tar.gz: fada74ff2f22b20989a0e514f97fb4a504dc768c29aec547369b04e96bf7d694f901319b3b5efe5a3d86c6e1049539f4c46f6a76e4f1044de82475ccd4a9b91a
|
data/lib/metanorma/cli/flavor.rb
CHANGED
|
@@ -106,8 +106,8 @@ module Metanorma
|
|
|
106
106
|
|
|
107
107
|
DEPENDENCY_GEMS =
|
|
108
108
|
%w(html2doc isodoc metanorma-utils mn2pdf mn-requirements isodoc-i18n
|
|
109
|
-
metanorma-plugin-glossarist
|
|
110
|
-
metanorma-
|
|
109
|
+
metanorma-plugin-glossarist metanorma-plugin-lutaml
|
|
110
|
+
metanorma-taste relaton-cli pubid glossarist fontist
|
|
111
111
|
plurimath lutaml expressir xmi lutaml-model emf2svg unitsml
|
|
112
112
|
vectory ogc-gml oscal).freeze
|
|
113
113
|
|
|
@@ -149,7 +149,7 @@ module Metanorma
|
|
|
149
149
|
Metanorma::Cli.load_flavors
|
|
150
150
|
errors = Metanorma::Cli::Compiler.compile(filename, options)
|
|
151
151
|
errors.each { |error| Util.log(error, :error) }
|
|
152
|
-
|
|
152
|
+
abort if errors.any?
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
EXPORT_CONFIG_FLAVOR_FILES = [
|
|
@@ -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
|
|
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.
|
|
56
|
+
if type_template.nil?
|
|
57
57
|
UI.say(
|
|
58
|
-
"Unable to generate document:\n#{
|
|
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
|
|
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
|
-
|
|
71
|
-
|
|
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
|
-
|
|
89
|
-
return
|
|
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(
|
|
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(
|
|
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
|
|
data/metanorma-cli.gemspec
CHANGED
|
@@ -37,9 +37,9 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency "metanorma-ribose", "~> 2.8.0"
|
|
38
38
|
spec.add_dependency "metanorma-standoc", "~> 3.3.1"
|
|
39
39
|
# spec.add_dependency 'metanorma-mpfa', "~> 0.9.0"
|
|
40
|
-
spec.add_dependency "git", "
|
|
40
|
+
spec.add_dependency "git", ">= 3.0"
|
|
41
41
|
spec.add_dependency "lutaml-model"
|
|
42
|
-
spec.add_dependency "metanorma", "~> 2.3.
|
|
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.
|
|
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-
|
|
11
|
+
date: 2026-03-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-ietf
|
|
@@ -140,16 +140,16 @@ dependencies:
|
|
|
140
140
|
name: git
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements:
|
|
143
|
-
- - "
|
|
143
|
+
- - ">="
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '
|
|
145
|
+
version: '3.0'
|
|
146
146
|
type: :runtime
|
|
147
147
|
prerelease: false
|
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
149
|
requirements:
|
|
150
|
-
- - "
|
|
150
|
+
- - ">="
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '
|
|
152
|
+
version: '3.0'
|
|
153
153
|
- !ruby/object:Gem::Dependency
|
|
154
154
|
name: lutaml-model
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -170,14 +170,14 @@ dependencies:
|
|
|
170
170
|
requirements:
|
|
171
171
|
- - "~>"
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: 2.3.
|
|
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.
|
|
180
|
+
version: 2.3.3
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
182
|
name: metanorma-iho
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|