expressir 2.2.0 → 2.2.1
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/.rubocop_todo.yml +20 -15
- data/expressir.gemspec +1 -0
- data/lib/expressir/commands/base.rb +2 -9
- data/lib/expressir/commands/format.rb +5 -3
- data/lib/expressir/commands/package.rb +92 -87
- data/lib/expressir/commands/validate_ascii.rb +2 -4
- data/lib/expressir/commands/validate_load.rb +8 -5
- data/lib/expressir/errors.rb +115 -0
- data/lib/expressir/version.rb +1 -1
- data/lib/expressir.rb +1 -3
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cf66e8d02967b85a1d4514eabaf543948bb3631c651b27dcbd74794f65eb56a
|
|
4
|
+
data.tar.gz: 6d04084c3f3498d716a4e81bff5bb5098dd233756c3c8decac9887214a25e394
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 995539b97506ccd8547382efd281922b00ae60855e22f433e8568f9149bd14fc444a7890c373c8f984610b2e0d06694a8bc3fc89f7c864c24136bfe629496784
|
|
7
|
+
data.tar.gz: 2634792ad654c03c71992dc976c3dc44b96d344961c1256f7e5f4a55f30b8345b4ba8b2587d7af058bf0068693637cc7eaec5975ee9aa61344889f22dc7bd00a
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-03-
|
|
3
|
+
# on 2026-03-12 10:28:38 UTC using RuboCop version 1.85.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -18,7 +18,7 @@ Layout/ExtraSpacing:
|
|
|
18
18
|
Exclude:
|
|
19
19
|
- 'lib/expressir/benchmark.rb'
|
|
20
20
|
|
|
21
|
-
# Offense count:
|
|
21
|
+
# Offense count: 990
|
|
22
22
|
# This cop supports safe autocorrection (--autocorrect).
|
|
23
23
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
24
24
|
# URISchemes: http, https
|
|
@@ -47,12 +47,6 @@ Lint/DuplicateMethods:
|
|
|
47
47
|
Exclude:
|
|
48
48
|
- 'lib/expressir/commands/validate_ascii.rb'
|
|
49
49
|
|
|
50
|
-
# Offense count: 1
|
|
51
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
52
|
-
Lint/ScriptPermission:
|
|
53
|
-
Exclude:
|
|
54
|
-
- 'regenerate_yaml.rb'
|
|
55
|
-
|
|
56
50
|
# Offense count: 2
|
|
57
51
|
# Configuration parameters: AllowedPatterns.
|
|
58
52
|
# AllowedPatterns: (?-mix:(exactly|at_least|at_most)\(\d+\)\.times)
|
|
@@ -80,7 +74,7 @@ Metrics/AbcSize:
|
|
|
80
74
|
Metrics/BlockLength:
|
|
81
75
|
Max: 98
|
|
82
76
|
|
|
83
|
-
# Offense count:
|
|
77
|
+
# Offense count: 14
|
|
84
78
|
# Configuration parameters: CountBlocks, CountModifierForms.
|
|
85
79
|
Metrics/BlockNesting:
|
|
86
80
|
Max: 6
|
|
@@ -93,7 +87,7 @@ Metrics/CyclomaticComplexity:
|
|
|
93
87
|
# Offense count: 276
|
|
94
88
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
95
89
|
Metrics/MethodLength:
|
|
96
|
-
Max:
|
|
90
|
+
Max: 170
|
|
97
91
|
|
|
98
92
|
# Offense count: 6
|
|
99
93
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
@@ -323,11 +317,6 @@ Style/HashLikeCase:
|
|
|
323
317
|
Exclude:
|
|
324
318
|
- 'lib/expressir/express/remark_attacher.rb'
|
|
325
319
|
|
|
326
|
-
# Offense count: 1
|
|
327
|
-
Style/OpenStructUse:
|
|
328
|
-
Exclude:
|
|
329
|
-
- 'spec/expressir/commands/package_tree_spec.rb'
|
|
330
|
-
|
|
331
320
|
# Offense count: 2
|
|
332
321
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
333
322
|
Style/PartitionInsteadOfDoubleSelect:
|
|
@@ -359,3 +348,19 @@ Style/SelectByKind:
|
|
|
359
348
|
Style/SoleNestedConditional:
|
|
360
349
|
Exclude:
|
|
361
350
|
- 'lib/expressir/model/search_engine.rb'
|
|
351
|
+
|
|
352
|
+
# Offense count: 1
|
|
353
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
354
|
+
Style/SuperArguments:
|
|
355
|
+
Exclude:
|
|
356
|
+
- 'lib/expressir/errors.rb'
|
|
357
|
+
|
|
358
|
+
# Offense count: 18
|
|
359
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
360
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
361
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
362
|
+
Style/TrailingCommaInArguments:
|
|
363
|
+
Exclude:
|
|
364
|
+
- 'lib/expressir/commands/format.rb'
|
|
365
|
+
- 'lib/expressir/commands/package.rb'
|
|
366
|
+
- 'lib/expressir/commands/validate_load.rb'
|
data/expressir.gemspec
CHANGED
|
@@ -17,15 +17,8 @@ module Expressir
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def exit_with_error(message,
|
|
21
|
-
|
|
22
|
-
# In test mode, raise an exception instead of exiting
|
|
23
|
-
# This makes it easier to test error cases
|
|
24
|
-
if defined?(@test_mode) && @test_mode
|
|
25
|
-
raise message # Just raise the message as an exception
|
|
26
|
-
else
|
|
27
|
-
exit exit_code
|
|
28
|
-
end
|
|
20
|
+
def exit_with_error(message, _exit_code = 1)
|
|
21
|
+
raise Expressir::CommandError.new(message)
|
|
29
22
|
end
|
|
30
23
|
end
|
|
31
24
|
end
|
|
@@ -12,9 +12,11 @@ module Expressir
|
|
|
12
12
|
when "iso"
|
|
13
13
|
format_with_iso_profile(repository)
|
|
14
14
|
else
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
raise Expressir::InvalidOptionError.new(
|
|
16
|
+
"profile",
|
|
17
|
+
profile,
|
|
18
|
+
valid_options: ["iso", "elf"]
|
|
19
|
+
)
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
|
|
@@ -101,18 +101,16 @@ module Expressir
|
|
|
101
101
|
schema_files = if options[:manifest]
|
|
102
102
|
# Manifest-based mode
|
|
103
103
|
unless File.exist?(options[:manifest])
|
|
104
|
-
|
|
105
|
-
:red
|
|
106
|
-
exit 1
|
|
104
|
+
raise Expressir::ManifestNotFoundError.new(options[:manifest])
|
|
107
105
|
end
|
|
108
106
|
|
|
109
107
|
# Override output if not provided
|
|
110
108
|
output ||= root_schema
|
|
111
109
|
unless output
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
raise Expressir::MissingRequiredArgumentError.new(
|
|
111
|
+
"OUTPUT path is required",
|
|
112
|
+
usage_hint: "expressir package build --manifest MANIFEST.yaml OUTPUT.ler"
|
|
113
|
+
)
|
|
116
114
|
end
|
|
117
115
|
|
|
118
116
|
# Build repository
|
|
@@ -141,29 +139,19 @@ module Expressir
|
|
|
141
139
|
# Check file existence
|
|
142
140
|
file_errors = validator.validate_file_existence
|
|
143
141
|
unless file_errors.empty?
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
end
|
|
149
|
-
exit 1
|
|
142
|
+
raise Expressir::ManifestValidationError.new(
|
|
143
|
+
"Manifest validation failed",
|
|
144
|
+
errors: file_errors.map { |e| e[:message] }
|
|
145
|
+
)
|
|
150
146
|
end
|
|
151
147
|
|
|
152
148
|
# Check referential integrity
|
|
153
149
|
reference_errors = validator.validate_referential_integrity
|
|
154
150
|
unless reference_errors.empty?
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
reference_errors.each do |e|
|
|
160
|
-
say " - #{e[:message]}", :red
|
|
161
|
-
end
|
|
162
|
-
say ""
|
|
163
|
-
say "This package may be incomplete or inconsistent.",
|
|
164
|
-
:red
|
|
165
|
-
say "To build anyway, use: --skip-verify", :yellow
|
|
166
|
-
exit 1
|
|
151
|
+
raise Expressir::ReferentialIntegrityError.new(
|
|
152
|
+
reference_errors,
|
|
153
|
+
message: "Manifest has unresolved dependencies"
|
|
154
|
+
)
|
|
167
155
|
end
|
|
168
156
|
|
|
169
157
|
say "✓ Manifest verified", :green
|
|
@@ -199,9 +187,10 @@ module Expressir
|
|
|
199
187
|
end
|
|
200
188
|
|
|
201
189
|
unless errors.empty?
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
190
|
+
raise Expressir::ManifestValidationError.new(
|
|
191
|
+
"Manifest validation failed",
|
|
192
|
+
errors: errors
|
|
193
|
+
)
|
|
205
194
|
end
|
|
206
195
|
|
|
207
196
|
if options[:verbose] && warnings.any?
|
|
@@ -214,18 +203,17 @@ module Expressir
|
|
|
214
203
|
else
|
|
215
204
|
# Auto-resolution mode
|
|
216
205
|
unless root_schema
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
exit 1
|
|
206
|
+
raise Expressir::MissingRequiredArgumentError.new(
|
|
207
|
+
"ROOT_SCHEMA is required when not using --manifest",
|
|
208
|
+
usage_hint: "expressir package build ROOT_SCHEMA OUTPUT.ler"
|
|
209
|
+
)
|
|
222
210
|
end
|
|
223
211
|
|
|
224
212
|
unless output
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
213
|
+
raise Expressir::MissingRequiredArgumentError.new(
|
|
214
|
+
"OUTPUT path is required",
|
|
215
|
+
usage_hint: "expressir package build ROOT_SCHEMA OUTPUT.ler"
|
|
216
|
+
)
|
|
229
217
|
end
|
|
230
218
|
|
|
231
219
|
say "Building LER package from #{root_schema}..." if options[:verbose]
|
|
@@ -272,35 +260,21 @@ module Expressir
|
|
|
272
260
|
say "Validating repository..." if options[:verbose]
|
|
273
261
|
validation = repo.validate
|
|
274
262
|
unless validation[:valid?]
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
end
|
|
289
|
-
say " #{i + 1}. #{error_msg}", :red
|
|
290
|
-
if e.is_a?(Hash) && e[:schema]
|
|
291
|
-
say " Schema: #{e[:schema]}",
|
|
292
|
-
:red
|
|
293
|
-
end
|
|
294
|
-
if e.is_a?(Hash) && e[:referenced_schema]
|
|
295
|
-
say " Referenced: #{e[:referenced_schema]}",
|
|
296
|
-
:red
|
|
263
|
+
raise Expressir::SchemaValidationError.new(
|
|
264
|
+
"Repository validation failed",
|
|
265
|
+
errors: (validation[:errors] || []).map do |e|
|
|
266
|
+
if e.is_a?(Hash)
|
|
267
|
+
msg = e[:message] || "Unknown error"
|
|
268
|
+
type = e[:type] ? "[#{e[:type]}] " : ""
|
|
269
|
+
schema = e[:schema] ? " (schema: #{e[:schema]})" : ""
|
|
270
|
+
ref = e[:referenced_schema] ? " (referenced: #{e[:referenced_schema]})" : ""
|
|
271
|
+
iface = e[:interface_type] ? " (interface: #{e[:interface_type]})" : ""
|
|
272
|
+
"#{type}#{msg}#{schema}#{ref}#{iface}"
|
|
273
|
+
else
|
|
274
|
+
e.to_s
|
|
275
|
+
end
|
|
297
276
|
end
|
|
298
|
-
|
|
299
|
-
say " Interface: #{e[:interface_type]}",
|
|
300
|
-
:red
|
|
301
|
-
end
|
|
302
|
-
end
|
|
303
|
-
exit 1
|
|
277
|
+
)
|
|
304
278
|
end
|
|
305
279
|
say " ✓ Validation passed" if options[:verbose]
|
|
306
280
|
end
|
|
@@ -311,10 +285,13 @@ module Expressir
|
|
|
311
285
|
|
|
312
286
|
say "✓ Package created: #{output}", :green
|
|
313
287
|
say " Schemas: #{repo.schemas.size}", :green if options[:verbose]
|
|
288
|
+
rescue Expressir::Error
|
|
289
|
+
raise # Re-raise Expressir errors
|
|
314
290
|
rescue StandardError => e
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
291
|
+
raise Expressir::PackageBuildError.new(
|
|
292
|
+
"Error building package: #{e.message}",
|
|
293
|
+
command_name: "package build"
|
|
294
|
+
)
|
|
318
295
|
end
|
|
319
296
|
|
|
320
297
|
desc "info PACKAGE", "Display package metadata and statistics"
|
|
@@ -349,9 +326,13 @@ module Expressir
|
|
|
349
326
|
else
|
|
350
327
|
output_text_info(metadata, repo)
|
|
351
328
|
end
|
|
329
|
+
rescue Expressir::Error
|
|
330
|
+
raise # Re-raise Expressir errors
|
|
352
331
|
rescue StandardError => e
|
|
353
|
-
|
|
354
|
-
|
|
332
|
+
raise Expressir::PackageReadError.new(
|
|
333
|
+
"Error reading package info: #{e.message}",
|
|
334
|
+
command_name: "package info"
|
|
335
|
+
)
|
|
355
336
|
end
|
|
356
337
|
|
|
357
338
|
desc "validate PACKAGE", "Validate package structure and integrity"
|
|
@@ -412,10 +393,19 @@ module Expressir
|
|
|
412
393
|
output_text_validation(validation)
|
|
413
394
|
end
|
|
414
395
|
|
|
415
|
-
|
|
396
|
+
unless validation[:valid?]
|
|
397
|
+
raise Expressir::PackageValidationError.new(
|
|
398
|
+
"Package validation failed",
|
|
399
|
+
errors: validation[:errors] || []
|
|
400
|
+
)
|
|
401
|
+
end
|
|
402
|
+
rescue Expressir::Error
|
|
403
|
+
raise # Re-raise Expressir errors
|
|
416
404
|
rescue StandardError => e
|
|
417
|
-
|
|
418
|
-
|
|
405
|
+
raise Expressir::PackageValidationError.new(
|
|
406
|
+
"Error validating package: #{e.message}",
|
|
407
|
+
command_name: "package validate"
|
|
408
|
+
)
|
|
419
409
|
end
|
|
420
410
|
|
|
421
411
|
desc "extract PACKAGE", "Extract package contents to directory"
|
|
@@ -439,10 +429,10 @@ module Expressir
|
|
|
439
429
|
require "fileutils"
|
|
440
430
|
|
|
441
431
|
unless options[:output]
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
432
|
+
raise Expressir::MissingRequiredArgumentError.new(
|
|
433
|
+
"output directory is required",
|
|
434
|
+
usage_hint: "expressir package extract PACKAGE --output OUTPUT_DIR"
|
|
435
|
+
)
|
|
446
436
|
end
|
|
447
437
|
|
|
448
438
|
output_dir = options[:output]
|
|
@@ -460,9 +450,13 @@ module Expressir
|
|
|
460
450
|
say " Files extracted: #{Dir.glob(File.join(output_dir, '**', '*')).select do |f|
|
|
461
451
|
File.file?(f)
|
|
462
452
|
end.size}", :green
|
|
453
|
+
rescue Expressir::Error
|
|
454
|
+
raise # Re-raise Expressir errors
|
|
463
455
|
rescue StandardError => e
|
|
464
|
-
|
|
465
|
-
|
|
456
|
+
raise Expressir::PackageExtractError.new(
|
|
457
|
+
"Error extracting package: #{e.message}",
|
|
458
|
+
command_name: "package extract"
|
|
459
|
+
)
|
|
466
460
|
end
|
|
467
461
|
|
|
468
462
|
desc "list PACKAGE", "List all elements of a specific type"
|
|
@@ -522,9 +516,13 @@ module Expressir
|
|
|
522
516
|
output_text_list(results, options[:type], options[:schema],
|
|
523
517
|
options[:category])
|
|
524
518
|
end
|
|
519
|
+
rescue Expressir::Error
|
|
520
|
+
raise # Re-raise Expressir errors
|
|
525
521
|
rescue StandardError => e
|
|
526
|
-
|
|
527
|
-
|
|
522
|
+
raise Expressir::PackageListError.new(
|
|
523
|
+
"Error listing elements: #{e.message}",
|
|
524
|
+
command_name: "package list"
|
|
525
|
+
)
|
|
528
526
|
end
|
|
529
527
|
|
|
530
528
|
desc "search PACKAGE PATTERN", "Search for elements matching a pattern"
|
|
@@ -602,9 +600,13 @@ module Expressir
|
|
|
602
600
|
else
|
|
603
601
|
output_text_search_results(results, pattern)
|
|
604
602
|
end
|
|
603
|
+
rescue Expressir::Error
|
|
604
|
+
raise # Re-raise Expressir errors
|
|
605
605
|
rescue StandardError => e
|
|
606
|
-
|
|
607
|
-
|
|
606
|
+
raise Expressir::PackageSearchError.new(
|
|
607
|
+
"Error searching: #{e.message}",
|
|
608
|
+
command_name: "package search"
|
|
609
|
+
)
|
|
608
610
|
end
|
|
609
611
|
desc "tree PACKAGE", "Display hierarchical tree view of package contents"
|
|
610
612
|
long_desc <<~DESC
|
|
@@ -669,9 +671,13 @@ module Expressir
|
|
|
669
671
|
is_last_schema = idx == schemas.size - 1
|
|
670
672
|
display_schema_tree(schema, is_last_schema, "", 1)
|
|
671
673
|
end
|
|
674
|
+
rescue Expressir::Error
|
|
675
|
+
raise # Re-raise Expressir errors
|
|
672
676
|
rescue StandardError => e
|
|
673
|
-
|
|
674
|
-
|
|
677
|
+
raise Expressir::PackageTreeError.new(
|
|
678
|
+
"Error displaying tree: #{e.message}",
|
|
679
|
+
command_name: "package tree"
|
|
680
|
+
)
|
|
675
681
|
end
|
|
676
682
|
|
|
677
683
|
private
|
|
@@ -694,8 +700,7 @@ module Expressir
|
|
|
694
700
|
# @return [Model::Repository] Loaded repository
|
|
695
701
|
def load_package(package_path)
|
|
696
702
|
unless File.exist?(package_path)
|
|
697
|
-
|
|
698
|
-
exit 1
|
|
703
|
+
raise Expressir::PackageNotFoundError.new(package_path)
|
|
699
704
|
end
|
|
700
705
|
|
|
701
706
|
Expressir::Model::Repository.from_package(package_path)
|
|
@@ -559,8 +559,7 @@ module Expressir
|
|
|
559
559
|
|
|
560
560
|
def validate_from_manifest(manifest_path)
|
|
561
561
|
unless File.exist?(manifest_path)
|
|
562
|
-
|
|
563
|
-
exit 1
|
|
562
|
+
raise Expressir::ManifestNotFoundError.new(manifest_path)
|
|
564
563
|
end
|
|
565
564
|
|
|
566
565
|
say "Loading manifest: #{manifest_path}..." if options[:verbose]
|
|
@@ -574,8 +573,7 @@ module Expressir
|
|
|
574
573
|
end
|
|
575
574
|
|
|
576
575
|
if exp_files.empty?
|
|
577
|
-
|
|
578
|
-
exit 1
|
|
576
|
+
raise Expressir::NoValidSchemaPathsError.new("No valid schema paths found in manifest")
|
|
579
577
|
end
|
|
580
578
|
|
|
581
579
|
say "Validating #{exp_files.size} schema(s) from manifest for ASCII compliance..." if options[:verbose]
|
|
@@ -16,8 +16,7 @@ module Expressir
|
|
|
16
16
|
|
|
17
17
|
def validate_from_manifest(manifest_path)
|
|
18
18
|
unless File.exist?(manifest_path)
|
|
19
|
-
|
|
20
|
-
exit 1
|
|
19
|
+
raise Expressir::ManifestNotFoundError.new(manifest_path)
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
say "Loading manifest: #{manifest_path}..." if options[:verbose]
|
|
@@ -29,8 +28,7 @@ module Expressir
|
|
|
29
28
|
paths = manifest.schemas.map(&:path).reject { |p| p.nil? || p.empty? }
|
|
30
29
|
|
|
31
30
|
if paths.empty?
|
|
32
|
-
|
|
33
|
-
exit 1
|
|
31
|
+
raise Expressir::NoValidSchemaPathsError.new("No valid schema paths found in manifest")
|
|
34
32
|
end
|
|
35
33
|
|
|
36
34
|
say "Validating #{paths.size} schema(s) from manifest..." if options[:verbose]
|
|
@@ -60,7 +58,12 @@ module Expressir
|
|
|
60
58
|
print_validation_errors(:failed_to_parse, no_valid)
|
|
61
59
|
print_validation_errors(:missing_version_string, no_version)
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
unless [no_valid, no_version].all?(&:empty?)
|
|
62
|
+
raise Expressir::SchemaValidationError.new(
|
|
63
|
+
"Schema validation failed",
|
|
64
|
+
errors: no_valid + no_version
|
|
65
|
+
)
|
|
66
|
+
end
|
|
64
67
|
|
|
65
68
|
say "Validation passed for all EXPRESS schemas."
|
|
66
69
|
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
# Base error class with details support
|
|
5
|
+
class Error < StandardError
|
|
6
|
+
attr_reader :details
|
|
7
|
+
|
|
8
|
+
def initialize(message = nil, details: nil)
|
|
9
|
+
@details = details
|
|
10
|
+
super(message)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# File/Resource Errors
|
|
15
|
+
class FileNotFoundError < Error
|
|
16
|
+
attr_reader :file_path, :file_type
|
|
17
|
+
|
|
18
|
+
def initialize(file_path, file_type: nil)
|
|
19
|
+
@file_path = file_path
|
|
20
|
+
@file_type = file_type
|
|
21
|
+
super("#{file_type || 'File'} not found: #{file_path}")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class ManifestNotFoundError < FileNotFoundError
|
|
26
|
+
def initialize(file_path)
|
|
27
|
+
super(file_path, file_type: "Manifest file")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class PackageNotFoundError < FileNotFoundError
|
|
32
|
+
def initialize(file_path)
|
|
33
|
+
super(file_path, file_type: "Package file")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class SchemaNotFoundError < FileNotFoundError
|
|
38
|
+
def initialize(file_path)
|
|
39
|
+
super(file_path, file_type: "Schema file")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Usage/Argument Errors
|
|
44
|
+
class UsageError < Error
|
|
45
|
+
attr_reader :usage_hint
|
|
46
|
+
|
|
47
|
+
def initialize(message, usage_hint: nil)
|
|
48
|
+
@usage_hint = usage_hint
|
|
49
|
+
super(message)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class MissingRequiredArgumentError < UsageError; end
|
|
54
|
+
|
|
55
|
+
class InvalidOptionError < UsageError
|
|
56
|
+
attr_reader :option_name, :valid_options
|
|
57
|
+
|
|
58
|
+
def initialize(option_name, value, valid_options: nil)
|
|
59
|
+
@option_name = option_name
|
|
60
|
+
@valid_options = valid_options
|
|
61
|
+
msg = "Invalid value '#{value}' for #{option_name}"
|
|
62
|
+
msg += ". Valid options: #{valid_options.join(', ')}" if valid_options
|
|
63
|
+
super(msg)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Validation Errors
|
|
68
|
+
class ValidationError < Error
|
|
69
|
+
attr_reader :errors
|
|
70
|
+
|
|
71
|
+
def initialize(message, errors: [])
|
|
72
|
+
@errors = errors
|
|
73
|
+
super(message)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
class ManifestValidationError < ValidationError; end
|
|
78
|
+
class SchemaValidationError < ValidationError; end
|
|
79
|
+
|
|
80
|
+
class ReferentialIntegrityError < ValidationError
|
|
81
|
+
attr_reader :unresolved_references
|
|
82
|
+
|
|
83
|
+
def initialize(unresolved_references, message: "Referential integrity check failed")
|
|
84
|
+
@unresolved_references = unresolved_references
|
|
85
|
+
super(message)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class NoValidSchemaPathsError < ValidationError
|
|
90
|
+
def initialize(message = "No valid schema paths found")
|
|
91
|
+
super(message)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Command Errors (for rescue blocks)
|
|
96
|
+
class CommandError < Error
|
|
97
|
+
attr_reader :command_name
|
|
98
|
+
|
|
99
|
+
def initialize(message, command_name: nil)
|
|
100
|
+
@command_name = command_name
|
|
101
|
+
super(message)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class PackageBuildError < CommandError; end
|
|
106
|
+
class PackageReadError < CommandError; end
|
|
107
|
+
class PackageExtractError < CommandError; end
|
|
108
|
+
class PackageValidationError < CommandError; end
|
|
109
|
+
class PackageListError < CommandError; end
|
|
110
|
+
class PackageSearchError < CommandError; end
|
|
111
|
+
class PackageTreeError < CommandError; end
|
|
112
|
+
|
|
113
|
+
# Backward compatibility - alias the old name to the new class
|
|
114
|
+
InvalidSchemaManifestError = ManifestValidationError
|
|
115
|
+
end
|
data/lib/expressir/version.rb
CHANGED
data/lib/expressir.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require_relative "expressir/version"
|
|
2
|
+
require_relative "expressir/errors"
|
|
2
3
|
require_relative "expressir/cli"
|
|
3
4
|
require_relative "expressir/config"
|
|
4
5
|
require_relative "expressir/benchmark"
|
|
@@ -28,9 +29,6 @@ else
|
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
module Expressir
|
|
31
|
-
class Error < StandardError; end
|
|
32
|
-
class InvalidSchemaManifestError < Error; end
|
|
33
|
-
|
|
34
32
|
def self.root
|
|
35
33
|
File.dirname(__dir__)
|
|
36
34
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: expressir
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.1
|
|
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-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: benchmark
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: benchmark-ips
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -305,6 +319,7 @@ files:
|
|
|
305
319
|
- lib/expressir/eengine/compare_report.rb
|
|
306
320
|
- lib/expressir/eengine/mim_compare_report.rb
|
|
307
321
|
- lib/expressir/eengine/modified_object.rb
|
|
322
|
+
- lib/expressir/errors.rb
|
|
308
323
|
- lib/expressir/express/builder.rb
|
|
309
324
|
- lib/expressir/express/builders.rb
|
|
310
325
|
- lib/expressir/express/builders/attribute_decl_builder.rb
|