metanorma-cli 1.9.1 → 1.9.3

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: 33a8d3ab6a46792e4581ccd7e21c612096e3df2b79b0042b7c3e1c2a7d2e4939
4
- data.tar.gz: 5f478d0b9e1f4fa729b0d9b706225be16e2581d7531de8257714825fa4000f12
3
+ metadata.gz: 6374dea57f8ef27b71328101ecd7f6354a4ac15f64a7e9173beb8b03bdad7e5e
4
+ data.tar.gz: 5252dc597e3ad2ed859fbdbdc77fe409e5540248030db3a64ebe945844e3d8d2
5
5
  SHA512:
6
- metadata.gz: e0e61f71bc27035adec9a4cb8f65e0c6d07c092d15a68eb970e3d78e36c437aa649c1f2e95b81fe2c0411b4976572ba9694bf43f8eb5285590d93b4b45d3b6a0
7
- data.tar.gz: 2794bbec1d0f738fba3db4c2b74cdb5e1025b2c3af933789e5b5a1a9aa079b809d755f679898178d21cd13de01b9adf9881c7eca6155bcbf6372e06c32662ac2
6
+ metadata.gz: b1371ef01303a1298491072a2193a34852d0a142e0919c89bafd380a5bbc29debb3e2ed1d0653ae0485b036465a0230ec7107a977f247ae11424c22adbb71d0d
7
+ data.tar.gz: 8c22dd5965af4862f01e9ec6c0d0a8cefbc14eeb8bdf7d86cbaac4be75eb0797bda0e5cb82c498230cb05632ebfbc98b07be3ccb4fdac1886dfd269e3c38f75e
@@ -5,6 +5,24 @@ module Metanorma
5
5
 
6
6
  class FileNotFoundError < StandardError; end
7
7
  class InvalidManifestFileError < StandardError; end
8
+
9
+ class FatalCompilationError < StandardError
10
+ attr_reader :fatals
11
+
12
+ def initialize(fatals)
13
+ super()
14
+ @fatals = fatals
15
+ end
16
+
17
+ def message
18
+ <<~MSG
19
+ Fatal compilation error(s):
20
+ #{fatals.map { |f| "- #{f}" }.join("\n")}
21
+
22
+ Look at error.log for more details
23
+ MSG
24
+ end
25
+ end
8
26
  end
9
27
  end
10
28
  end
@@ -28,7 +28,12 @@ module Metanorma
28
28
 
29
29
  def generate
30
30
  site_directory = asset_directory.join("..")
31
- select_source_files.each { |source| compile(source) }
31
+
32
+ fatals = select_source_files.map { |source| compile(source) }
33
+ .flatten
34
+ .compact
35
+
36
+ raise Errors::FatalCompilationError, fatals unless fatals.empty?
32
37
 
33
38
  Dir.chdir(site_directory) do
34
39
  build_collection_file(collection_name)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.9.1".freeze
3
+ VERSION = "1.9.3".freeze
4
4
  end
5
5
  end
data/lib/metanorma/cli.rb CHANGED
@@ -34,9 +34,11 @@ module Metanorma
34
34
  Metanorma::Cli::Command.start(arguments)
35
35
  rescue Interrupt, SignalException => _e
36
36
  UI.say("Process cancelled, exiting.")
37
- rescue Errors::FileNotFoundError => error
38
- UI.say("Error: #{error}. \nNot sure what to run? try: metanorma help")
37
+ rescue Errors::FileNotFoundError => e
38
+ UI.say("Error: #{e}. \nNot sure what to run? try: metanorma help")
39
39
  exit(Errno::ENOENT::Errno)
40
+ rescue Errors::FatalCompilationError => e
41
+ print_fatal_summary(e)
40
42
  end
41
43
 
42
44
  def self.root
@@ -72,11 +74,11 @@ module Metanorma
72
74
  def self.writable_templates_path?
73
75
  parent_directory = templates_path.join("..", "..")
74
76
 
75
- unless parent_directory && parent_directory.writable?
77
+ unless parent_directory&.writable?
76
78
  raise Errno::EACCES, "No permission to write in this directory"
77
79
  end
78
80
 
79
- return true
81
+ true
80
82
  end
81
83
 
82
84
  def self.root_path
@@ -91,5 +93,12 @@ module Metanorma
91
93
  commands = Metanorma::Cli::Command.all_commands.keys
92
94
  commands.select { |cmd| arguments.include?(cmd.gsub("_", "-")) == true }
93
95
  end
96
+
97
+ def self.print_fatal_summary(error)
98
+ $stdout.flush
99
+ $stderr.flush
100
+ UI.error(error.message)
101
+ exit(-1)
102
+ end
94
103
  end
95
104
  end
@@ -36,20 +36,20 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "sassc"
37
37
 
38
38
  spec.add_runtime_dependency "metanorma-ietf", "~> 3.3.0"
39
- spec.add_runtime_dependency "metanorma-iso", "~> 2.7.0"
39
+ spec.add_runtime_dependency "metanorma-iso", "~> 2.7.3"
40
40
  spec.add_runtime_dependency "mnconvert"
41
- spec.add_runtime_dependency "thor", "~> 1.0"
41
+ # spec.add_runtime_dependency "thor", "~> 1.0" # inherited from vectory
42
42
  # spec.add_runtime_dependency "metanorma-gb", "~> 1.5.0"
43
43
  spec.add_runtime_dependency "metanorma-cc", "~> 2.4.0"
44
44
  spec.add_runtime_dependency "metanorma-csa", "~> 2.4.0"
45
45
  spec.add_runtime_dependency "metanorma-iec", "~> 2.4.0"
46
46
  # spec.add_runtime_dependency 'metanorma-ribose', "~> 2.3.0"
47
47
  spec.add_runtime_dependency "metanorma-bipm", "~> 2.4.0"
48
- spec.add_runtime_dependency "metanorma-generic", "~> 2.6.0"
49
- spec.add_runtime_dependency "metanorma-standoc", "~> 2.8.0"
48
+ spec.add_runtime_dependency "metanorma-generic", "~> 2.6.2"
49
+ spec.add_runtime_dependency "metanorma-standoc", "~> 2.8.4"
50
50
  # spec.add_runtime_dependency 'metanorma-mpfa', "~> 0.9.0"
51
51
  spec.add_runtime_dependency "git", "~> 1.5"
52
- spec.add_runtime_dependency "metanorma", "~> 1.7.0"
52
+ spec.add_runtime_dependency "metanorma", "~> 1.7.1"
53
53
  spec.add_runtime_dependency "metanorma-iho", "~> 0.9.0"
54
54
  spec.add_runtime_dependency "metanorma-itu", "~> 2.4.0"
55
55
  # spec.add_runtime_dependency "metanorma-nist", "~> 2.3.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.9.1
4
+ version: 1.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-06 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 2.7.0
173
+ version: 2.7.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.7.0
180
+ version: 2.7.3
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: mnconvert
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -192,20 +192,6 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: thor
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '1.0'
202
- type: :runtime
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '1.0'
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: metanorma-cc
211
197
  requirement: !ruby/object:Gem::Requirement
@@ -268,28 +254,28 @@ dependencies:
268
254
  requirements:
269
255
  - - "~>"
270
256
  - !ruby/object:Gem::Version
271
- version: 2.6.0
257
+ version: 2.6.2
272
258
  type: :runtime
273
259
  prerelease: false
274
260
  version_requirements: !ruby/object:Gem::Requirement
275
261
  requirements:
276
262
  - - "~>"
277
263
  - !ruby/object:Gem::Version
278
- version: 2.6.0
264
+ version: 2.6.2
279
265
  - !ruby/object:Gem::Dependency
280
266
  name: metanorma-standoc
281
267
  requirement: !ruby/object:Gem::Requirement
282
268
  requirements:
283
269
  - - "~>"
284
270
  - !ruby/object:Gem::Version
285
- version: 2.8.0
271
+ version: 2.8.4
286
272
  type: :runtime
287
273
  prerelease: false
288
274
  version_requirements: !ruby/object:Gem::Requirement
289
275
  requirements:
290
276
  - - "~>"
291
277
  - !ruby/object:Gem::Version
292
- version: 2.8.0
278
+ version: 2.8.4
293
279
  - !ruby/object:Gem::Dependency
294
280
  name: git
295
281
  requirement: !ruby/object:Gem::Requirement
@@ -310,14 +296,14 @@ dependencies:
310
296
  requirements:
311
297
  - - "~>"
312
298
  - !ruby/object:Gem::Version
313
- version: 1.7.0
299
+ version: 1.7.1
314
300
  type: :runtime
315
301
  prerelease: false
316
302
  version_requirements: !ruby/object:Gem::Requirement
317
303
  requirements:
318
304
  - - "~>"
319
305
  - !ruby/object:Gem::Version
320
- version: 1.7.0
306
+ version: 1.7.1
321
307
  - !ruby/object:Gem::Dependency
322
308
  name: metanorma-iho
323
309
  requirement: !ruby/object:Gem::Requirement