metanorma-cli 1.5.8 → 1.5.9pre
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 +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5580b948d0d190232adc2a1977a8ce0fcfa2a2c7ad26385de1ac33e717bb56dd
|
4
|
+
data.tar.gz: 62932c33266289b60da258d1ae203ad4726145396b991b36203d328fbe67fb5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10b5780f1b8aa3220ec4087f103b8d710d452a49e1eddb63dc50199150c39b08b1ef74e0c5347599f82fab87fa76010df3e50d98ba174276d2816bd2c453f7fd
|
7
|
+
data.tar.gz: 1b0d9eb8dba65202ad10f9077d26d0b5639c9df8de59a17e1cc5f1e9a083c70789b0881ca0b085feca147ccf99b1ac7e82870930138573f0682bd6479f9af61f
|
@@ -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.9pre
|
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
|
@@ -510,9 +510,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
510
510
|
version: 2.5.0
|
511
511
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
512
512
|
requirements:
|
513
|
-
- - "
|
513
|
+
- - ">"
|
514
514
|
- !ruby/object:Gem::Version
|
515
|
-
version:
|
515
|
+
version: 1.3.1
|
516
516
|
requirements: []
|
517
517
|
rubygems_version: 3.2.32
|
518
518
|
signing_key:
|