metanorma-cli 1.5.7 → 1.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/cli/generator.rb +18 -11
- data/lib/metanorma/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6282445acbd814d5fe7561a6c2f0aa79ebdc3e783c6fc18b79a3ea5b458484ac
|
4
|
+
data.tar.gz: 52f15df8bcb0817ab747f7224866a8099251fcf48a86c6a820558fbb567bdde5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05a4a3e14905e1768ae10abdb5bf153896b55ccc73911b2b22d3013dea6d04c8719121aa4f24b315932b7522450935aa634217fd6f995b1b21356f377cdebc8a
|
7
|
+
data.tar.gz: 5e04c708242ce2917d62887920aa966aafa285ff7829006bef98101a49bf3321820c7db73db3a662c216aea7765231cb009c3e323ccf67b594a2933ea98acad0
|
@@ -18,12 +18,12 @@ module Metanorma
|
|
18
18
|
if Cli.writable_templates_path?
|
19
19
|
if name && document_path.exist?
|
20
20
|
return unless overwrite?(document_path)
|
21
|
+
|
21
22
|
document_path.rmtree
|
22
23
|
end
|
23
24
|
|
24
25
|
create_metanorma_document
|
25
26
|
end
|
26
|
-
|
27
27
|
rescue Errno::EACCES
|
28
28
|
permission_missing_error
|
29
29
|
end
|
@@ -53,17 +53,24 @@ module Metanorma
|
|
53
53
|
def create_metanorma_document
|
54
54
|
type_template = type_specific_template
|
55
55
|
|
56
|
-
|
57
|
-
templates = base_templates.merge(type_template)
|
58
|
-
templates.each { |source, dest| create_file(source, dest) }
|
59
|
-
else
|
56
|
+
if type_template.empty?
|
60
57
|
UI.say(
|
61
|
-
"Unable to generate document:\n"
|
62
|
-
"Templates for type #{type.to_s} cannot be found -- please provide a valid `type` or a template URL"
|
58
|
+
"Unable to generate document:\n#{create_metanorma_document_error}",
|
63
59
|
)
|
60
|
+
else
|
61
|
+
templates = base_templates.merge(type_template)
|
62
|
+
templates.each { |source, dest| create_file(source, dest) }
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
66
|
+
def create_metanorma_document_error
|
67
|
+
type == "ogc" && doctype == "charter" and return <<~ERR
|
68
|
+
The template for OGC charter documents can be downloaded from https://github.com/opengeospatial/templates/tree/master/charter_templates
|
69
|
+
ERR
|
70
|
+
"Templates for type #{type} cannot be found -- "\
|
71
|
+
"please provide a valid `type` or a template URL"
|
72
|
+
end
|
73
|
+
|
67
74
|
def find_standard_template(type)
|
68
75
|
Cli::GitTemplate.find_or_download_by(type)
|
69
76
|
end
|
@@ -85,7 +92,7 @@ module Metanorma
|
|
85
92
|
|
86
93
|
def custom_template
|
87
94
|
if template
|
88
|
-
if template
|
95
|
+
if !template&.match?(URI::DEFAULT_PARSER.make_regexp)
|
89
96
|
return Pathname.new(template)
|
90
97
|
end
|
91
98
|
|
@@ -124,13 +131,13 @@ module Metanorma
|
|
124
131
|
|
125
132
|
def ask_to_confirm(document)
|
126
133
|
UI.ask(
|
127
|
-
"You've an existing document with the #{document
|
134
|
+
"You've an existing document with the #{document}\n" \
|
128
135
|
"Still want to continue, and overwrite the existing one? (yes/no):",
|
129
136
|
).downcase
|
130
137
|
end
|
131
138
|
|
132
139
|
def file_creation_message(document, destination)
|
133
|
-
UI.say("Creating #{[document, destination].join(
|
140
|
+
UI.say("Creating #{[document, destination].join('/').gsub('//', '/')}")
|
134
141
|
end
|
135
142
|
|
136
143
|
def permission_missing_error
|
@@ -139,7 +146,7 @@ module Metanorma
|
|
139
146
|
"The current user does not have permission to write to this path:\n" \
|
140
147
|
"#{Cli.templates_path}\n" \
|
141
148
|
"Please ensure the path is writable by the current user, or\n" \
|
142
|
-
"run Metanorma using a different user with write permissions."
|
149
|
+
"run Metanorma using a different user with write permissions.",
|
143
150
|
)
|
144
151
|
end
|
145
152
|
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.5.
|
4
|
+
version: 1.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|