expressir 2.1.29 → 2.1.31

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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +98 -0
  3. data/.github/workflows/links.yml +100 -0
  4. data/.github/workflows/rake.yml +4 -0
  5. data/.github/workflows/release.yml +5 -0
  6. data/.github/workflows/validate_schemas.yml +1 -1
  7. data/.gitignore +3 -0
  8. data/.rubocop.yml +1 -1
  9. data/.rubocop_todo.yml +209 -55
  10. data/Gemfile +2 -1
  11. data/README.adoc +650 -83
  12. data/docs/Gemfile +12 -0
  13. data/docs/_config.yml +141 -0
  14. data/docs/_guides/changes/changes-format.adoc +778 -0
  15. data/docs/_guides/changes/importing-eengine.adoc +898 -0
  16. data/docs/_guides/changes/index.adoc +396 -0
  17. data/docs/_guides/changes/programmatic-usage.adoc +1038 -0
  18. data/docs/_guides/changes/validating-changes.adoc +681 -0
  19. data/docs/_guides/cli/benchmark-performance.adoc +834 -0
  20. data/docs/_guides/cli/coverage-analysis.adoc +921 -0
  21. data/docs/_guides/cli/format-schemas.adoc +547 -0
  22. data/docs/_guides/cli/index.adoc +8 -0
  23. data/docs/_guides/cli/managing-changes.adoc +927 -0
  24. data/docs/_guides/cli/validate-ascii.adoc +645 -0
  25. data/docs/_guides/cli/validate-schemas.adoc +534 -0
  26. data/docs/_guides/index.adoc +165 -0
  27. data/docs/_guides/ler/creating-packages.adoc +664 -0
  28. data/docs/_guides/ler/index.adoc +305 -0
  29. data/docs/_guides/ler/loading-packages.adoc +707 -0
  30. data/docs/_guides/ler/package-formats.adoc +748 -0
  31. data/docs/_guides/ler/querying-packages.adoc +826 -0
  32. data/docs/_guides/ler/validating-packages.adoc +750 -0
  33. data/docs/_guides/liquid/basic-templates.adoc +813 -0
  34. data/docs/_guides/liquid/documentation-generation.adoc +1042 -0
  35. data/docs/_guides/liquid/drops-reference.adoc +829 -0
  36. data/docs/_guides/liquid/filters-and-tags.adoc +912 -0
  37. data/docs/_guides/liquid/index.adoc +468 -0
  38. data/docs/_guides/manifests/creating-manifests.adoc +483 -0
  39. data/docs/_guides/manifests/index.adoc +307 -0
  40. data/docs/_guides/manifests/resolving-manifests.adoc +557 -0
  41. data/docs/_guides/manifests/validating-manifests.adoc +713 -0
  42. data/docs/_guides/ruby-api/formatting-schemas.adoc +605 -0
  43. data/docs/_guides/ruby-api/index.adoc +257 -0
  44. data/docs/_guides/ruby-api/parsing-files.adoc +421 -0
  45. data/docs/_guides/ruby-api/search-engine.adoc +609 -0
  46. data/docs/_guides/ruby-api/working-with-repository.adoc +577 -0
  47. data/docs/_pages/data-model.adoc +665 -0
  48. data/docs/_pages/express-language.adoc +506 -0
  49. data/docs/_pages/getting-started.adoc +414 -0
  50. data/docs/_pages/index.adoc +116 -0
  51. data/docs/_pages/introduction.adoc +256 -0
  52. data/docs/_pages/ler-packages.adoc +837 -0
  53. data/docs/_pages/parsers.adoc +683 -0
  54. data/docs/_pages/schema-manifests.adoc +431 -0
  55. data/docs/_references/index.adoc +228 -0
  56. data/docs/_tutorials/creating-ler-package.adoc +735 -0
  57. data/docs/_tutorials/documentation-coverage.adoc +795 -0
  58. data/docs/_tutorials/index.adoc +221 -0
  59. data/docs/_tutorials/liquid-templates.adoc +806 -0
  60. data/docs/_tutorials/parsing-your-first-schema.adoc +522 -0
  61. data/docs/_tutorials/querying-schemas.adoc +751 -0
  62. data/docs/_tutorials/working-with-multiple-schemas.adoc +676 -0
  63. data/docs/index.adoc +242 -0
  64. data/docs/lychee.toml +84 -0
  65. data/examples/demo_ler_usage.sh +86 -0
  66. data/examples/ler/README.md +111 -0
  67. data/examples/ler/simple_example.ler +0 -0
  68. data/examples/ler/simple_schema.exp +33 -0
  69. data/examples/ler_build.rb +75 -0
  70. data/examples/ler_cli.rb +79 -0
  71. data/examples/ler_demo_complete.rb +276 -0
  72. data/examples/ler_query.rb +91 -0
  73. data/examples/ler_query_examples.rb +305 -0
  74. data/examples/ler_stats.rb +81 -0
  75. data/examples/phase3_demo.rb +159 -0
  76. data/examples/query_demo_simple.rb +131 -0
  77. data/expressir.gemspec +2 -0
  78. data/lib/expressir/changes/schema_change.rb +32 -22
  79. data/lib/expressir/changes/{edition_change.rb → version_change.rb} +3 -3
  80. data/lib/expressir/cli.rb +12 -4
  81. data/lib/expressir/commands/changes_import_eengine.rb +2 -2
  82. data/lib/expressir/commands/changes_validate.rb +1 -1
  83. data/lib/expressir/commands/manifest.rb +427 -0
  84. data/lib/expressir/commands/package.rb +1274 -0
  85. data/lib/expressir/commands/validate.rb +70 -37
  86. data/lib/expressir/commands/validate_ascii.rb +607 -0
  87. data/lib/expressir/commands/validate_load.rb +88 -0
  88. data/lib/expressir/express/formatter.rb +5 -1
  89. data/lib/expressir/express/formatters/remark_item_formatter.rb +25 -0
  90. data/lib/expressir/express/parser.rb +33 -0
  91. data/lib/expressir/manifest/resolver.rb +213 -0
  92. data/lib/expressir/manifest/validator.rb +195 -0
  93. data/lib/expressir/model/declarations/entity.rb +6 -0
  94. data/lib/expressir/model/dependency_resolver.rb +270 -0
  95. data/lib/expressir/model/indexes/entity_index.rb +103 -0
  96. data/lib/expressir/model/indexes/reference_index.rb +148 -0
  97. data/lib/expressir/model/indexes/type_index.rb +149 -0
  98. data/lib/expressir/model/interface_validator.rb +384 -0
  99. data/lib/expressir/model/repository.rb +400 -5
  100. data/lib/expressir/model/repository_validator.rb +295 -0
  101. data/lib/expressir/model/search_engine.rb +525 -0
  102. data/lib/expressir/model.rb +4 -94
  103. data/lib/expressir/package/builder.rb +200 -0
  104. data/lib/expressir/package/metadata.rb +81 -0
  105. data/lib/expressir/package/reader.rb +165 -0
  106. data/lib/expressir/schema_manifest.rb +11 -1
  107. data/lib/expressir/version.rb +1 -1
  108. data/lib/expressir.rb +16 -3
  109. metadata +115 -5
  110. data/docs/benchmarking.adoc +0 -107
  111. data/docs/liquid_drops.adoc +0 -1547
@@ -1,52 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+
1
5
  module Expressir
2
6
  module Commands
3
- class Validate < Base
4
- def run(paths)
5
- no_version = []
6
- no_valid = []
7
-
8
- paths.each do |path|
9
- x = Pathname.new(path).realpath.relative_path_from(Dir.pwd)
10
- say "Validating #{x}"
11
- ret = validate_schema(path)
7
+ # Thor subcommand for EXPRESS validation operations
8
+ class Validate < Thor
9
+ desc "load PATH_OR_MANIFEST",
10
+ "Validate EXPRESS schema loading and version strings"
11
+ long_desc <<~DESC
12
+ Validate EXPRESS schema(s) for parsing errors and version string presence.
12
13
 
13
- if ret.nil?
14
- no_valid << "Failed to parse: #{x}"
15
- next
16
- end
14
+ Accepts either:
15
+ - Individual EXPRESS file paths (*.exp)
16
+ - A Schema Manifest YAML file (*.yaml) containing schema definitions
17
17
 
18
- ret.each do |schema_id|
19
- no_version << "Missing version string: schema `#{schema_id}` | #{x}"
20
- end
21
- end
18
+ When using a Schema Manifest, all schemas in the manifest will be validated.
22
19
 
23
- print_validation_errors(:failed_to_parse, no_valid)
24
- print_validation_errors(:missing_version_string, no_version)
20
+ Examples:
21
+ # Validate individual EXPRESS files
22
+ expressir validate load schema1.exp schema2.exp
25
23
 
26
- exit 1 unless [no_valid, no_version].all?(&:empty?)
24
+ # Validate schemas from a manifest
25
+ expressir validate load manifest.yaml
27
26
 
28
- say "Validation passed for all EXPRESS schemas."
27
+ # Validate with verbose output
28
+ expressir validate load manifest.yaml --verbose
29
+ DESC
30
+ method_option :verbose, type: :boolean, default: false,
31
+ desc: "Show verbose output"
32
+ def load(*paths)
33
+ require_relative "validate_load"
34
+ ValidateLoad.new(options).run(paths)
29
35
  end
30
36
 
31
- private
37
+ desc "ascii PATH_OR_MANIFEST",
38
+ "Validate EXPRESS files for ASCII-only content"
39
+ long_desc <<~DESC
40
+ Validate EXPRESS file(s) for non-ASCII characters and provide replacement suggestions.
32
41
 
33
- def validate_schema(path)
34
- repository = Expressir::Express::Parser.from_file(path)
35
- repository.schemas.inject([]) do |acc, schema|
36
- acc << schema.id unless schema.version&.value
37
- acc
38
- end
39
- rescue StandardError
40
- nil
41
- end
42
+ Accepts either:
43
+ - Individual EXPRESS file path (*.exp)
44
+ - A directory path (with --recursive option)
45
+ - A Schema Manifest YAML file (*.yaml) containing schema definitions
46
+
47
+ When using a Schema Manifest, all schemas in the manifest will be validated.
48
+
49
+ This command:
50
+ - Scans each line for non-ASCII characters
51
+ - Reports detailed information about each violation
52
+ - Provides specific replacement suggestions (AsciiMath or ISO 10303-11)
53
+ - Displays a summary table showing all violations
54
+ - Optionally outputs structured data in YAML format
55
+
56
+ Examples:
57
+ # Validate a single EXPRESS file
58
+ expressir validate ascii schema.exp
59
+
60
+ # Validate all EXPRESS files in a directory recursively
61
+ expressir validate ascii ../iso-10303/schemas -r
62
+
63
+ # Validate schemas from a manifest
64
+ expressir validate ascii manifest.yaml
42
65
 
43
- def print_validation_errors(type, array)
44
- return if array.empty?
66
+ # Output results in YAML format
67
+ expressir validate ascii manifest.yaml -y
45
68
 
46
- say "#{'*' * 20} RESULTS: #{type.to_s.upcase.tr('_', ' ')} #{'*' * 20}"
47
- array.each do |msg|
48
- say msg
49
- end
69
+ # Include remarks in validation (default: false)
70
+ expressir validate ascii schema.exp --check-remarks
71
+ DESC
72
+ method_option :recursive, type: :boolean, default: false, aliases: "-r",
73
+ desc: "Validate EXPRESS files under the specified path recursively"
74
+ method_option :yaml, type: :boolean, default: false, aliases: "-y",
75
+ desc: "Output results in YAML format"
76
+ method_option :check_remarks, type: :boolean, default: false,
77
+ desc: "Include remarks in ASCII validation (default: false, remarks are excluded)"
78
+ method_option :verbose, type: :boolean, default: false,
79
+ desc: "Show verbose output"
80
+ def ascii(path)
81
+ require_relative "validate_ascii"
82
+ ValidateAscii.new(options).run(path)
50
83
  end
51
84
  end
52
85
  end