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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f21088e13696d1170c99a3533f1fff240743ccfd11e5988bfb5a2542ed5d9de7
4
- data.tar.gz: 74254c94389b45e243685087d5bb661ae00a9871438dabd7798f1f5c750e3324
3
+ metadata.gz: 5580b948d0d190232adc2a1977a8ce0fcfa2a2c7ad26385de1ac33e717bb56dd
4
+ data.tar.gz: 62932c33266289b60da258d1ae203ad4726145396b991b36203d328fbe67fb5d
5
5
  SHA512:
6
- metadata.gz: 36ebaac6f842b6ef166329fb06e4d7b4856f0576e8775a36d57a2084ea7bb883812726362982d7047cf22ede3a425f88fcbd6ea18648a73c61d965e1fb1577b5
7
- data.tar.gz: d8c432f10e48f7b2291eed12242e5628845cbe6687134d1a0b33484088f8673d526ead112a599a4291e2e901479804aaa6f1df31d3be4ceed36c991736ca7b1c
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
- unless type_template.empty?
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 !~ URI::regexp
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.to_s}\n" \
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("/").gsub("//", "/")}")
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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.5.8".freeze
3
+ VERSION = "1.5.9pre".freeze
4
4
  end
5
5
  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.8
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-01-22 00:00:00.000000000 Z
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: '0'
515
+ version: 1.3.1
516
516
  requirements: []
517
517
  rubygems_version: 3.2.32
518
518
  signing_key: