expressir 2.4.29-arm-linux
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 +7 -0
- data/.cargo/config.toml +3 -0
- data/.github/scripts/test_installed_gem.rb +34 -0
- data/.github/workflows/codeql.yml +35 -0
- data/.github/workflows/docs.yml +99 -0
- data/.github/workflows/links.yml +100 -0
- data/.github/workflows/native-gems.yml +201 -0
- data/.github/workflows/rake.yml +19 -0
- data/.github/workflows/release.yml +37 -0
- data/.github/workflows/rust-ext.yml +41 -0
- data/.github/workflows/stress.yml +36 -0
- data/.github/workflows/validate_schemas.yml +48 -0
- data/.github/workflows/verify_remarks.yml +33 -0
- data/.gitignore +55 -0
- data/.hound.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_todo.yml +297 -0
- data/CHANGELOG.md +159 -0
- data/Gemfile +18 -0
- data/README.adoc +2783 -0
- data/Rakefile +41 -0
- data/TODO.bugs/01-stale-transformer-autoload.md +39 -0
- data/TODO.bugs/02-parser-class-instance-vars.md +36 -0
- data/TODO.bugs/03-builder-mutable-state.md +43 -0
- data/TODO.bugs/04-formatter-public-send-dispatch.md +53 -0
- data/TODO.bugs/05-anonymous-formatter-subclass.md +45 -0
- data/TODO.bugs/06-collection-registry-single-source.md +53 -0
- data/TODO.bugs/07-require-relative-cleanup.md +42 -0
- data/TODO.bugs/08-require-expressir-in-commands.md +34 -0
- data/TODO.bugs/09-parser-split.md +53 -0
- data/TODO.bugs/10-to-s-override.md +42 -0
- data/TODO.bugs/11-parser-class-variables.md +39 -0
- data/TODO.bugs/12-marker-modules-vs-registry.md +64 -0
- data/TODO.bugs/13-string-literal-scanner-limitation.md +52 -0
- data/TODO.bugs/14-model-formatting-leak.md +30 -0
- data/TODO.bugs/15-expression-children-macro.md +27 -0
- data/TODO.bugs/16-pretty-formatter-duplication.md +28 -0
- data/TODO.bugs/17-snake-case-cache-mutable-constant.md +28 -0
- data/TODO.bugs/18-const-get-private-constants.md +30 -0
- data/TODO.bugs/19-format-methods-public.md +22 -0
- data/TODO.bugs/20-coverage-nested-entities-dedup.md +20 -0
- data/TODO.bugs/21-operator-tokens-secondary-dispatch.md +21 -0
- data/TODO.bugs/22-builder-fast-path-wrappers.md +32 -0
- data/TODO.bugs/23-coverage-inverse-maps.md +21 -0
- data/TODO.bugs/24-streaming-builder-complexity.md +19 -0
- data/TODO.bugs/25-debug-puts-in-production.md +21 -0
- data/TODO.bugs/26-generic-entity-children-misplaced.md +21 -0
- data/TODO.bugs/27-package-build-god-method.md +19 -0
- data/TODO.bugs/28-package-god-class.md +30 -0
- data/TODO.bugs/29-validate-ascii-god-class.md +24 -0
- data/TODO.bugs/30-unicode-map-extraction.md +19 -0
- data/TODO.bugs/README.md +43 -0
- data/TODO.max-perf/01-restore-ci-green.md +36 -0
- data/TODO.max-perf/02-streaming-parse-path.md +31 -0
- data/TODO.max-perf/03-cli-parallel-opt-in.md +27 -0
- data/TODO.max-perf/04-benchmark-harness.md +28 -0
- data/TODO.max-perf/05-parallel-fidelity-specs.md +22 -0
- data/TODO.max-perf/06-builder-cpu-audit.md +41 -0
- data/TODO.max-perf/07-upstream-parsanol-roadmap.md +27 -0
- data/TODO.max-perf/08-builder-build-perf.md +45 -0
- data/TODO.max-perf/09-grammar-cold-start.md +25 -0
- data/TODO.max-perf/10-parser-facade-hygiene.md +23 -0
- data/TODO.max-perf/11-ci-green-closeout.md +25 -0
- data/TODO.max-perf/12-require-boot-profile.md +25 -0
- data/TODO.max-perf/13-key-conversion-specs.md +26 -0
- data/TODO.max-perf/14-builder-call-handler-audit.md +28 -0
- data/TODO.parity-ee/00-overview.md +76 -0
- data/TODO.parity-ee/01-annex-g-rule-extraction.md +41 -0
- data/TODO.parity-ee/02-eeng-algorithm-inventory.md +8 -0
- data/TODO.parity-ee/03-eeng-oracle-harness.md +33 -0
- data/TODO.parity-ee/04-shtolo-concatenate.md +44 -0
- data/TODO.parity-ee/05-shtolo-longform-flatten.md +53 -0
- data/TODO.parity-ee/06-interface-scheduling-parity.md +47 -0
- data/TODO.parity-ee/07-semantic-checks-port.md +35 -0
- data/TODO.parity-ee/08-pretty-roundtrip-gate.md +27 -0
- data/TODO.parity-ee/09-smrl-index-and-listing.md +22 -0
- data/TODO.parity-ee/10-interface-dot-graph.md +21 -0
- data/TODO.parity-ee/11-import-eeng-tests.md +79 -0
- data/TODO.parity-ee/12-full-check-catalog.md +67 -0
- data/TODO.parity-ee/13-population-p21.md +54 -0
- data/TODO.parity-ee/14-shtolo-completion.md +44 -0
- data/TODO.parity-ee/15-part28-xml.md +51 -0
- data/TODO.parity-ee/16-compare-patch.md +48 -0
- data/TODO.parity-ee/17-official-tests.md +42 -0
- data/TODO.parity-ee/18-mim-mapping.md +47 -0
- data/TODO.parity-ee/19-architecture.md +97 -0
- data/TODO.parity-ee/parity-matrix.md +108 -0
- data/TODO.refpath-v2/00-overview.md +64 -0
- data/TODO.suma-improvements/00-overview.md +23 -0
- data/TODO.suma-improvements/01-prebuilt-platform-gems.md +33 -0
- data/TODO.suma-improvements/02-suma-e2e.md +39 -0
- data/TODO.suma-improvements/03-item-graph.md +22 -0
- data/TODO.suma-improvements/04-compiled-set-default.md +16 -0
- data/TODO.suma-improvements/05-validation-in-docs.md +17 -0
- data/TODO.suma-improvements/06-memory-remeasure.md +36 -0
- data/TODO.suma-improvements/07-part28-xml.md +15 -0
- data/TODO.suma-improvements/08-windows-gnu-toolchain.md +15 -0
- data/TODO.suma-improvements/09-checker-tranche3.md +13 -0
- data/TODO.suma-improvements/10-expressdoc.md +8 -0
- data/benchmark/srl_benchmark.rb +458 -0
- data/benchmark/srl_native_benchmark.rb +146 -0
- data/benchmark/srl_ruby_benchmark.rb +132 -0
- data/bin/console +11 -0
- data/bin/rspec +30 -0
- data/bin/setup +8 -0
- data/docs/Gemfile +12 -0
- data/docs/_config.yml +141 -0
- data/docs/_guides/changes/changes-format.adoc +778 -0
- data/docs/_guides/changes/importing-eengine.adoc +898 -0
- data/docs/_guides/changes/index.adoc +396 -0
- data/docs/_guides/changes/programmatic-usage.adoc +1038 -0
- data/docs/_guides/changes/validating-changes.adoc +681 -0
- data/docs/_guides/cli/benchmark-performance.adoc +834 -0
- data/docs/_guides/cli/coverage-analysis.adoc +921 -0
- data/docs/_guides/cli/format-schemas.adoc +547 -0
- data/docs/_guides/cli/index.adoc +8 -0
- data/docs/_guides/cli/managing-changes.adoc +927 -0
- data/docs/_guides/cli/validate-ascii.adoc +645 -0
- data/docs/_guides/cli/validate-schemas.adoc +534 -0
- data/docs/_guides/formatter/formatter-architecture.adoc +401 -0
- data/docs/_guides/index.adoc +165 -0
- data/docs/_guides/ler/creating-packages.adoc +664 -0
- data/docs/_guides/ler/index.adoc +305 -0
- data/docs/_guides/ler/loading-packages.adoc +707 -0
- data/docs/_guides/ler/package-formats.adoc +748 -0
- data/docs/_guides/ler/querying-packages.adoc +826 -0
- data/docs/_guides/ler/step-packages.adoc +385 -0
- data/docs/_guides/ler/validating-packages.adoc +750 -0
- data/docs/_guides/liquid/basic-templates.adoc +813 -0
- data/docs/_guides/liquid/documentation-generation.adoc +1042 -0
- data/docs/_guides/liquid/drops-reference.adoc +829 -0
- data/docs/_guides/liquid/filters-and-tags.adoc +912 -0
- data/docs/_guides/liquid/index.adoc +468 -0
- data/docs/_guides/manifests/creating-manifests.adoc +483 -0
- data/docs/_guides/manifests/index.adoc +307 -0
- data/docs/_guides/manifests/resolving-manifests.adoc +557 -0
- data/docs/_guides/manifests/validating-manifests.adoc +713 -0
- data/docs/_guides/ruby-api/formatting-schemas.adoc +605 -0
- data/docs/_guides/ruby-api/index.adoc +257 -0
- data/docs/_guides/ruby-api/parsing-files.adoc +421 -0
- data/docs/_guides/ruby-api/search-engine.adoc +609 -0
- data/docs/_guides/ruby-api/working-with-repository.adoc +577 -0
- data/docs/_pages/data-model.adoc +665 -0
- data/docs/_pages/express-language.adoc +506 -0
- data/docs/_pages/getting-started.adoc +414 -0
- data/docs/_pages/index.adoc +116 -0
- data/docs/_pages/introduction.adoc +256 -0
- data/docs/_pages/ler-packages.adoc +837 -0
- data/docs/_pages/parsers.adoc +709 -0
- data/docs/_pages/schema-manifests.adoc +431 -0
- data/docs/_references/index.adoc +228 -0
- data/docs/_tutorials/creating-ler-package.adoc +735 -0
- data/docs/_tutorials/documentation-coverage.adoc +795 -0
- data/docs/_tutorials/formatting-schemas.adoc +89 -0
- data/docs/_tutorials/index.adoc +231 -0
- data/docs/_tutorials/liquid-templates.adoc +806 -0
- data/docs/_tutorials/parsing-your-first-schema.adoc +522 -0
- data/docs/_tutorials/querying-schemas.adoc +751 -0
- data/docs/_tutorials/working-with-multiple-schemas.adoc +676 -0
- data/docs/index.adoc +242 -0
- data/docs/lychee.toml +90 -0
- data/examples/demo_ler_usage.sh +86 -0
- data/examples/ler/README.md +111 -0
- data/examples/ler/simple_example.ler +0 -0
- data/examples/ler/simple_schema.exp +33 -0
- data/examples/ler_build.rb +75 -0
- data/examples/ler_cli.rb +79 -0
- data/examples/ler_demo_complete.rb +276 -0
- data/examples/ler_query.rb +91 -0
- data/examples/ler_query_examples.rb +305 -0
- data/examples/ler_stats.rb +81 -0
- data/examples/phase3_demo.rb +159 -0
- data/examples/query_demo_simple.rb +131 -0
- data/exe/expressir +11 -0
- data/exe/expressir-format +14 -0
- data/exe/expressir-format-test +82 -0
- data/expressir.gemspec +61 -0
- data/lib/expressir/3.2/expressir_core.so +0 -0
- data/lib/expressir/3.3/expressir_core.so +0 -0
- data/lib/expressir/3.4/expressir_core.so +0 -0
- data/lib/expressir/4.0/expressir_core.so +0 -0
- data/lib/expressir/benchmark.rb +310 -0
- data/lib/expressir/changes/item_change.rb +20 -0
- data/lib/expressir/changes/mapping_change.rb +16 -0
- data/lib/expressir/changes/schema_change.rb +85 -0
- data/lib/expressir/changes/version_change.rb +26 -0
- data/lib/expressir/changes.rb +9 -0
- data/lib/expressir/cli.rb +148 -0
- data/lib/expressir/commands/base.rb +25 -0
- data/lib/expressir/commands/benchmark.rb +59 -0
- data/lib/expressir/commands/benchmark_cache.rb +80 -0
- data/lib/expressir/commands/changes.rb +34 -0
- data/lib/expressir/commands/changes_import_eengine.rb +146 -0
- data/lib/expressir/commands/changes_validate.rb +63 -0
- data/lib/expressir/commands/check.rb +56 -0
- data/lib/expressir/commands/clean.rb +20 -0
- data/lib/expressir/commands/coverage.rb +458 -0
- data/lib/expressir/commands/expand.rb +26 -0
- data/lib/expressir/commands/file_violations.rb +70 -0
- data/lib/expressir/commands/fix.rb +33 -0
- data/lib/expressir/commands/flatten.rb +29 -0
- data/lib/expressir/commands/format.rb +43 -0
- data/lib/expressir/commands/manifest.rb +420 -0
- data/lib/expressir/commands/mapping_validate.rb +68 -0
- data/lib/expressir/commands/non_ascii_character.rb +49 -0
- data/lib/expressir/commands/non_ascii_violation_collection.rb +301 -0
- data/lib/expressir/commands/package.rb +1222 -0
- data/lib/expressir/commands/parity_inputs.rb +160 -0
- data/lib/expressir/commands/validate.rb +106 -0
- data/lib/expressir/commands/validate_ascii.rb +94 -0
- data/lib/expressir/commands/validate_load.rb +91 -0
- data/lib/expressir/commands/version.rb +9 -0
- data/lib/expressir/commands/xsd.rb +23 -0
- data/lib/expressir/commands.rb +30 -0
- data/lib/expressir/config.rb +60 -0
- data/lib/expressir/coverage.rb +510 -0
- data/lib/expressir/eengine/arm_compare_report.rb +23 -0
- data/lib/expressir/eengine/changes_section.rb +16 -0
- data/lib/expressir/eengine/compare_report.rb +69 -0
- data/lib/expressir/eengine/mim_compare_report.rb +23 -0
- data/lib/expressir/eengine/modified_object.rb +21 -0
- data/lib/expressir/eengine.rb +9 -0
- data/lib/expressir/errors.rb +113 -0
- data/lib/expressir/express/adoc_hyperlink_formatter.rb +30 -0
- data/lib/expressir/express/adoc_source_formatter.rb +12 -0
- data/lib/expressir/express/ast_key_converter.rb +114 -0
- data/lib/expressir/express/builder.rb +277 -0
- data/lib/expressir/express/builder_context.rb +22 -0
- data/lib/expressir/express/builder_registry.rb +397 -0
- data/lib/expressir/express/builders/attribute_decl_builder.rb +32 -0
- data/lib/expressir/express/builders/built_in_builder.rb +75 -0
- data/lib/expressir/express/builders/constant_builder.rb +108 -0
- data/lib/expressir/express/builders/declaration_builder.rb +20 -0
- data/lib/expressir/express/builders/derive_clause_builder.rb +14 -0
- data/lib/expressir/express/builders/derived_attr_builder.rb +28 -0
- data/lib/expressir/express/builders/domain_rule_builder.rb +21 -0
- data/lib/expressir/express/builders/entity_decl_builder.rb +116 -0
- data/lib/expressir/express/builders/explicit_attr_builder.rb +49 -0
- data/lib/expressir/express/builders/expression_builder.rb +416 -0
- data/lib/expressir/express/builders/function_decl_builder.rb +86 -0
- data/lib/expressir/express/builders/helpers.rb +148 -0
- data/lib/expressir/express/builders/interface_builder.rb +151 -0
- data/lib/expressir/express/builders/inverse_attr_builder.rb +43 -0
- data/lib/expressir/express/builders/inverse_attr_type_builder.rb +30 -0
- data/lib/expressir/express/builders/inverse_clause_builder.rb +14 -0
- data/lib/expressir/express/builders/literal_builder.rb +93 -0
- data/lib/expressir/express/builders/procedure_decl_builder.rb +82 -0
- data/lib/expressir/express/builders/qualifier_builder.rb +102 -0
- data/lib/expressir/express/builders/reference_builder.rb +18 -0
- data/lib/expressir/express/builders/rule_decl_builder.rb +97 -0
- data/lib/expressir/express/builders/schema_body_decl_builder.rb +18 -0
- data/lib/expressir/express/builders/schema_decl_builder.rb +56 -0
- data/lib/expressir/express/builders/schema_version_builder.rb +34 -0
- data/lib/expressir/express/builders/simple_id_builder.rb +17 -0
- data/lib/expressir/express/builders/statement_builder.rb +243 -0
- data/lib/expressir/express/builders/subtype_constraint_builder.rb +166 -0
- data/lib/expressir/express/builders/syntax_builder.rb +30 -0
- data/lib/expressir/express/builders/type_builder.rb +238 -0
- data/lib/expressir/express/builders/type_decl_builder.rb +26 -0
- data/lib/expressir/express/builders/unique_clause_builder.rb +20 -0
- data/lib/expressir/express/builders/unique_rule_builder.rb +41 -0
- data/lib/expressir/express/builders/where_clause_builder.rb +20 -0
- data/lib/expressir/express/builders.rb +55 -0
- data/lib/expressir/express/cache.rb +76 -0
- data/lib/expressir/express/checker.rb +812 -0
- data/lib/expressir/express/concatenator.rb +79 -0
- data/lib/expressir/express/core.rb +95 -0
- data/lib/expressir/express/error.rb +124 -0
- data/lib/expressir/express/formatter.rb +149 -0
- data/lib/expressir/express/formatters/data_types_formatter.rb +362 -0
- data/lib/expressir/express/formatters/declarations_formatter.rb +753 -0
- data/lib/expressir/express/formatters/expressions_formatter.rb +180 -0
- data/lib/expressir/express/formatters/literals_formatter.rb +55 -0
- data/lib/expressir/express/formatters/references_formatter.rb +53 -0
- data/lib/expressir/express/formatters/remark_formatter.rb +270 -0
- data/lib/expressir/express/formatters/remark_item_formatter.rb +28 -0
- data/lib/expressir/express/formatters/statements_formatter.rb +272 -0
- data/lib/expressir/express/formatters/supertype_expressions_formatter.rb +54 -0
- data/lib/expressir/express/formatters.rb +22 -0
- data/lib/expressir/express/grammar/parser.rb +712 -0
- data/lib/expressir/express/grammar.rb +11 -0
- data/lib/expressir/express/hyperlink_formatter.rb +35 -0
- data/lib/expressir/express/interface_dot.rb +105 -0
- data/lib/expressir/express/lazy_repository.rb +211 -0
- data/lib/expressir/express/line_map.rb +48 -0
- data/lib/expressir/express/listing.rb +174 -0
- data/lib/expressir/express/model_traversal.rb +42 -0
- data/lib/expressir/express/model_visitor.rb +25 -0
- data/lib/expressir/express/node_position_index.rb +342 -0
- data/lib/expressir/express/parallel_files.rb +229 -0
- data/lib/expressir/express/parser.rb +523 -0
- data/lib/expressir/express/pretty_formatter.rb +586 -0
- data/lib/expressir/express/pretty_gate.rb +61 -0
- data/lib/expressir/express/refs_overlay.rb +47 -0
- data/lib/expressir/express/remark_attacher.rb +1098 -0
- data/lib/expressir/express/remark_overlay.rb +86 -0
- data/lib/expressir/express/remark_scanner.rb +245 -0
- data/lib/expressir/express/resolve_references_model_visitor.rb +29 -0
- data/lib/expressir/express/schema_block_scanner.rb +137 -0
- data/lib/expressir/express/schema_head_formatter.rb +22 -0
- data/lib/expressir/express/schema_plain_source_formatter.rb +11 -0
- data/lib/expressir/express/schema_source_formatter.rb +15 -0
- data/lib/expressir/express/scope_resolver.rb +223 -0
- data/lib/expressir/express/self_schema_reference.rb +126 -0
- data/lib/expressir/express/shtolo.rb +679 -0
- data/lib/expressir/express/smrl_xml.rb +125 -0
- data/lib/expressir/express/source_formatter.rb +15 -0
- data/lib/expressir/express/streaming_builder.rb +435 -0
- data/lib/expressir/express/xsd.rb +259 -0
- data/lib/expressir/express.rb +53 -0
- data/lib/expressir/liquid.rb +1 -0
- data/lib/expressir/manifest/resolver.rb +210 -0
- data/lib/expressir/manifest/validator.rb +192 -0
- data/lib/expressir/manifest.rb +6 -0
- data/lib/expressir/mapping/refpath.rb +857 -0
- data/lib/expressir/mapping.rb +253 -0
- data/lib/expressir/model/cache.rb +18 -0
- data/lib/expressir/model/concerns.rb +42 -0
- data/lib/expressir/model/data_types/aggregate.rb +26 -0
- data/lib/expressir/model/data_types/array.rb +25 -0
- data/lib/expressir/model/data_types/bag.rb +21 -0
- data/lib/expressir/model/data_types/binary.rb +19 -0
- data/lib/expressir/model/data_types/boolean.rb +15 -0
- data/lib/expressir/model/data_types/enumeration.rb +21 -0
- data/lib/expressir/model/data_types/enumeration_item.rb +24 -0
- data/lib/expressir/model/data_types/generic.rb +24 -0
- data/lib/expressir/model/data_types/generic_entity.rb +24 -0
- data/lib/expressir/model/data_types/integer.rb +15 -0
- data/lib/expressir/model/data_types/list.rb +23 -0
- data/lib/expressir/model/data_types/logical.rb +15 -0
- data/lib/expressir/model/data_types/number.rb +15 -0
- data/lib/expressir/model/data_types/real.rb +17 -0
- data/lib/expressir/model/data_types/select.rb +23 -0
- data/lib/expressir/model/data_types/set.rb +21 -0
- data/lib/expressir/model/data_types/string.rb +19 -0
- data/lib/expressir/model/data_types.rb +25 -0
- data/lib/expressir/model/declarations/attribute.rb +38 -0
- data/lib/expressir/model/declarations/constant.rb +28 -0
- data/lib/expressir/model/declarations/derived_attribute.rb +25 -0
- data/lib/expressir/model/declarations/entity.rb +62 -0
- data/lib/expressir/model/declarations/function.rb +59 -0
- data/lib/expressir/model/declarations/informal_proposition_rule.rb +25 -0
- data/lib/expressir/model/declarations/interface.rb +37 -0
- data/lib/expressir/model/declarations/interface_item.rb +21 -0
- data/lib/expressir/model/declarations/interfaced_item.rb +33 -0
- data/lib/expressir/model/declarations/inverse_attribute.rb +25 -0
- data/lib/expressir/model/declarations/parameter.rb +28 -0
- data/lib/expressir/model/declarations/procedure.rb +57 -0
- data/lib/expressir/model/declarations/remark_item.rb +21 -0
- data/lib/expressir/model/declarations/rule.rb +66 -0
- data/lib/expressir/model/declarations/schema.rb +215 -0
- data/lib/expressir/model/declarations/schema_version.rb +19 -0
- data/lib/expressir/model/declarations/schema_version_item.rb +19 -0
- data/lib/expressir/model/declarations/subtype_constraint.rb +32 -0
- data/lib/expressir/model/declarations/type.rb +45 -0
- data/lib/expressir/model/declarations/unique_rule.rb +26 -0
- data/lib/expressir/model/declarations/variable.rb +28 -0
- data/lib/expressir/model/declarations/where_rule.rb +26 -0
- data/lib/expressir/model/declarations.rb +31 -0
- data/lib/expressir/model/dependency_resolver.rb +268 -0
- data/lib/expressir/model/exp_file.rb +42 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +18 -0
- data/lib/expressir/model/expressions/aggregate_initializer_item.rb +20 -0
- data/lib/expressir/model/expressions/binary_expression.rb +59 -0
- data/lib/expressir/model/expressions/entity_constructor.rb +20 -0
- data/lib/expressir/model/expressions/function_call.rb +20 -0
- data/lib/expressir/model/expressions/interval.rb +29 -0
- data/lib/expressir/model/expressions/query_expression.rb +31 -0
- data/lib/expressir/model/expressions/unary_expression.rb +25 -0
- data/lib/expressir/model/expressions.rb +18 -0
- data/lib/expressir/model/identifier.rb +26 -0
- data/lib/expressir/model/indexes/entity_index.rb +103 -0
- data/lib/expressir/model/indexes/item_graph.rb +185 -0
- data/lib/expressir/model/indexes/reference_index.rb +148 -0
- data/lib/expressir/model/indexes/type_index.rb +149 -0
- data/lib/expressir/model/indexes.rb +12 -0
- data/lib/expressir/model/interface_validator.rb +384 -0
- data/lib/expressir/model/literals/binary.rb +17 -0
- data/lib/expressir/model/literals/integer.rb +17 -0
- data/lib/expressir/model/literals/logical.rb +21 -0
- data/lib/expressir/model/literals/real.rb +17 -0
- data/lib/expressir/model/literals/string.rb +20 -0
- data/lib/expressir/model/literals.rb +13 -0
- data/lib/expressir/model/model_element.rb +377 -0
- data/lib/expressir/model/references/attribute_reference.rb +19 -0
- data/lib/expressir/model/references/group_reference.rb +19 -0
- data/lib/expressir/model/references/index_reference.rb +23 -0
- data/lib/expressir/model/references/simple_reference.rb +21 -0
- data/lib/expressir/model/references.rb +12 -0
- data/lib/expressir/model/remark_format.rb +17 -0
- data/lib/expressir/model/remark_info.rb +92 -0
- data/lib/expressir/model/remark_placement.rb +42 -0
- data/lib/expressir/model/repository.rb +483 -0
- data/lib/expressir/model/repository_validator.rb +293 -0
- data/lib/expressir/model/search_engine.rb +551 -0
- data/lib/expressir/model/statements/alias.rb +31 -0
- data/lib/expressir/model/statements/assignment.rb +23 -0
- data/lib/expressir/model/statements/case.rb +42 -0
- data/lib/expressir/model/statements/case_action.rb +20 -0
- data/lib/expressir/model/statements/compound.rb +21 -0
- data/lib/expressir/model/statements/escape.rb +18 -0
- data/lib/expressir/model/statements/if.rb +26 -0
- data/lib/expressir/model/statements/null.rb +18 -0
- data/lib/expressir/model/statements/procedure_call.rb +22 -0
- data/lib/expressir/model/statements/repeat.rb +40 -0
- data/lib/expressir/model/statements/return.rb +20 -0
- data/lib/expressir/model/statements/skip.rb +18 -0
- data/lib/expressir/model/statements.rb +20 -0
- data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +25 -0
- data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +17 -0
- data/lib/expressir/model/supertype_expressions.rb +12 -0
- data/lib/expressir/model.rb +39 -0
- data/lib/expressir/package/builder.rb +231 -0
- data/lib/expressir/package/metadata.rb +79 -0
- data/lib/expressir/package/reader.rb +149 -0
- data/lib/expressir/package.rb +8 -0
- data/lib/expressir/schema_manifest.rb +159 -0
- data/lib/expressir/schema_manifest_entry.rb +15 -0
- data/lib/expressir/version.rb +8 -0
- data/lib/expressir.rb +94 -0
- data/lib/tasks/verify_remarks.rake +16 -0
- data/rakelib/native.rake +24 -0
- data/rakelib/oracle.rake +52 -0
- data/rakelib/verify_remarks.rake +16 -0
- metadata +692 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.6 Escape statement
|
|
6
|
+
class Escape < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
|
|
9
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
10
|
+
|
|
11
|
+
key_value do
|
|
12
|
+
map "_class", to: :_class, render_default: true
|
|
13
|
+
map "untagged_remarks", to: :untagged_remarks
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.7 If ... Then ... Else statement
|
|
6
|
+
class If < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
|
|
9
|
+
collection_attributes :statements, :else_statements
|
|
10
|
+
child_attributes :expression
|
|
11
|
+
attribute :expression, ModelElement
|
|
12
|
+
attribute :statements, ModelElement, collection: true
|
|
13
|
+
attribute :else_statements, ModelElement, collection: true
|
|
14
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
15
|
+
|
|
16
|
+
key_value do
|
|
17
|
+
map "_class", to: :_class, render_default: true
|
|
18
|
+
map "untagged_remarks", to: :untagged_remarks
|
|
19
|
+
map "expression", to: :expression
|
|
20
|
+
map "statements", to: :statements
|
|
21
|
+
map "else_statements", to: :else_statements
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.1 Null (statement)
|
|
6
|
+
class Null < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
|
|
9
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
10
|
+
|
|
11
|
+
key_value do
|
|
12
|
+
map "_class", to: :_class, render_default: true
|
|
13
|
+
map "untagged_remarks", to: :untagged_remarks
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.8 Procedure call statement
|
|
6
|
+
class ProcedureCall < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
|
|
9
|
+
attribute :procedure, ModelElement
|
|
10
|
+
attribute :parameters, ModelElement, collection: true
|
|
11
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
12
|
+
|
|
13
|
+
key_value do
|
|
14
|
+
map "_class", to: :_class, render_default: true
|
|
15
|
+
map "untagged_remarks", to: :untagged_remarks
|
|
16
|
+
map "procedure", to: :procedure
|
|
17
|
+
map "parameters", to: :parameters
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.9 Repeat statement
|
|
6
|
+
class Repeat < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
include Identifier
|
|
9
|
+
|
|
10
|
+
collection_attributes :statements
|
|
11
|
+
child_attributes :while_expression, :until_expression
|
|
12
|
+
attribute :bound1, ModelElement
|
|
13
|
+
attribute :bound2, ModelElement
|
|
14
|
+
attribute :increment, ModelElement
|
|
15
|
+
attribute :while_expression, ModelElement
|
|
16
|
+
attribute :until_expression, ModelElement
|
|
17
|
+
attribute :statements, ModelElement, collection: true
|
|
18
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
19
|
+
|
|
20
|
+
key_value do
|
|
21
|
+
map "_class", to: :_class, render_default: true
|
|
22
|
+
map "bound1", to: :bound1
|
|
23
|
+
map "bound2", to: :bound2
|
|
24
|
+
map "increment", to: :increment
|
|
25
|
+
map "while_expression", to: :while_expression
|
|
26
|
+
map "until_expression", to: :until_expression
|
|
27
|
+
map "statements", to: :statements
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @return [Array<Declaration>]
|
|
31
|
+
def children
|
|
32
|
+
[
|
|
33
|
+
self,
|
|
34
|
+
*remark_items,
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.10 Return statement
|
|
6
|
+
class Return < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
|
|
9
|
+
attribute :expression, ModelElement
|
|
10
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
11
|
+
|
|
12
|
+
key_value do
|
|
13
|
+
map "_class", to: :_class, render_default: true
|
|
14
|
+
map "untagged_remarks", to: :untagged_remarks
|
|
15
|
+
map "expression", to: :expression
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module Statements
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 13.11 Skip statement
|
|
6
|
+
class Skip < ModelElement
|
|
7
|
+
include Statement
|
|
8
|
+
|
|
9
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
10
|
+
|
|
11
|
+
key_value do
|
|
12
|
+
map "_class", to: :_class, render_default: true
|
|
13
|
+
map "untagged_remarks", to: :untagged_remarks
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
module Model
|
|
5
|
+
module Statements
|
|
6
|
+
autoload :Alias, "#{__dir__}/statements/alias"
|
|
7
|
+
autoload :Assignment, "#{__dir__}/statements/assignment"
|
|
8
|
+
autoload :Case, "#{__dir__}/statements/case"
|
|
9
|
+
autoload :CaseAction, "#{__dir__}/statements/case_action"
|
|
10
|
+
autoload :Compound, "#{__dir__}/statements/compound"
|
|
11
|
+
autoload :Escape, "#{__dir__}/statements/escape"
|
|
12
|
+
autoload :If, "#{__dir__}/statements/if"
|
|
13
|
+
autoload :Null, "#{__dir__}/statements/null"
|
|
14
|
+
autoload :ProcedureCall, "#{__dir__}/statements/procedure_call"
|
|
15
|
+
autoload :Repeat, "#{__dir__}/statements/repeat"
|
|
16
|
+
autoload :Return, "#{__dir__}/statements/return"
|
|
17
|
+
autoload :Skip, "#{__dir__}/statements/skip"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module SupertypeExpressions
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 9.2.5.3 ANDOR
|
|
6
|
+
# - section 9.2.5.4 AND
|
|
7
|
+
class BinarySupertypeExpression < ModelElement
|
|
8
|
+
AND = "AND".freeze
|
|
9
|
+
ANDOR = "ANDOR".freeze
|
|
10
|
+
|
|
11
|
+
attribute :operator, :string, values: %w[AND ANDOR]
|
|
12
|
+
attribute :operand1, ModelElement
|
|
13
|
+
attribute :operand2, ModelElement
|
|
14
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
15
|
+
|
|
16
|
+
key_value do
|
|
17
|
+
map "_class", to: :_class, render_default: true
|
|
18
|
+
map "operator", to: :operator
|
|
19
|
+
map "operand1", to: :operand1
|
|
20
|
+
map "operand2", to: :operand2
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Expressir
|
|
2
|
+
module Model
|
|
3
|
+
module SupertypeExpressions
|
|
4
|
+
# Specified in ISO 10303-11:2004
|
|
5
|
+
# - section 9.2.5.2 ONEOF
|
|
6
|
+
class OneofSupertypeExpression < ModelElement
|
|
7
|
+
attribute :operands, ModelElement, collection: true
|
|
8
|
+
attribute :_class, :string, default: -> { self.class.name }
|
|
9
|
+
|
|
10
|
+
key_value do
|
|
11
|
+
map "_class", to: :_class, render_default: true
|
|
12
|
+
map "operands", to: :operands
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
module Model
|
|
5
|
+
module SupertypeExpressions
|
|
6
|
+
autoload :BinarySupertypeExpression,
|
|
7
|
+
"#{__dir__}/supertype_expressions/binary_supertype_expression"
|
|
8
|
+
autoload :OneofSupertypeExpression,
|
|
9
|
+
"#{__dir__}/supertype_expressions/oneof_supertype_expression"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# lib/expressir/model.rb
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
module Model
|
|
5
|
+
# Marker modules — autoload the same concerns.rb file from each name.
|
|
6
|
+
# The first reference triggers the load; the file defines all eight markers.
|
|
7
|
+
autoload :HasId, "#{__dir__}/model/concerns"
|
|
8
|
+
autoload :HasRemarkItems, "#{__dir__}/model/concerns"
|
|
9
|
+
autoload :HasRemarks, "#{__dir__}/model/concerns"
|
|
10
|
+
autoload :ScopeContainer, "#{__dir__}/model/concerns"
|
|
11
|
+
autoload :HasInformalPropositions, "#{__dir__}/model/concerns"
|
|
12
|
+
autoload :HasWhereRules, "#{__dir__}/model/concerns"
|
|
13
|
+
autoload :TakesInlineRemark, "#{__dir__}/model/concerns"
|
|
14
|
+
autoload :Statement, "#{__dir__}/model/concerns"
|
|
15
|
+
|
|
16
|
+
autoload :ModelElement, "#{__dir__}/model/model_element"
|
|
17
|
+
autoload :Cache, "#{__dir__}/model/cache"
|
|
18
|
+
autoload :ExpFile, "#{__dir__}/model/exp_file"
|
|
19
|
+
autoload :Identifier, "#{__dir__}/model/identifier"
|
|
20
|
+
autoload :Repository, "#{__dir__}/model/repository"
|
|
21
|
+
autoload :RepositoryValidator, "#{__dir__}/model/repository_validator"
|
|
22
|
+
autoload :DependencyResolver, "#{__dir__}/model/dependency_resolver"
|
|
23
|
+
autoload :RemarkFormat, "#{__dir__}/model/remark_format"
|
|
24
|
+
autoload :RemarkPlacement, "#{__dir__}/model/remark_placement"
|
|
25
|
+
autoload :RemarkInfo, "#{__dir__}/model/remark_info"
|
|
26
|
+
autoload :InterfaceValidator, "#{__dir__}/model/interface_validator"
|
|
27
|
+
autoload :SearchEngine, "#{__dir__}/model/search_engine"
|
|
28
|
+
|
|
29
|
+
# Submodules - autoload their namespace files
|
|
30
|
+
autoload :Indexes, "#{__dir__}/model/indexes"
|
|
31
|
+
autoload :DataTypes, "#{__dir__}/model/data_types"
|
|
32
|
+
autoload :Declarations, "#{__dir__}/model/declarations"
|
|
33
|
+
autoload :Expressions, "#{__dir__}/model/expressions"
|
|
34
|
+
autoload :Literals, "#{__dir__}/model/literals"
|
|
35
|
+
autoload :References, "#{__dir__}/model/references"
|
|
36
|
+
autoload :Statements, "#{__dir__}/model/statements"
|
|
37
|
+
autoload :SupertypeExpressions, "#{__dir__}/model/supertype_expressions"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "zip"
|
|
4
|
+
require "time"
|
|
5
|
+
|
|
6
|
+
module Expressir
|
|
7
|
+
module Package
|
|
8
|
+
# Builds LER packages from Repository instances
|
|
9
|
+
# Single responsibility: Create .ler ZIP packages
|
|
10
|
+
class Builder
|
|
11
|
+
# Build LER package from repository
|
|
12
|
+
# @param repository [Model::Repository] Repository to package
|
|
13
|
+
# @param output_path [String] Output .ler file path
|
|
14
|
+
# @param options [Hash] Package options
|
|
15
|
+
# @option options [String] :name Package name
|
|
16
|
+
# @option options [String] :version Package version
|
|
17
|
+
# @option options [String] :description Package description
|
|
18
|
+
# @option options [String] :express_mode ('include_all') Bundling mode
|
|
19
|
+
# @option options [String] :resolution_mode ('resolved') Resolution mode
|
|
20
|
+
# @option options [String] :serialization_format ('marshal') Serialization format
|
|
21
|
+
# @return [String] Path to created package
|
|
22
|
+
def build(repository, output_path, options = {})
|
|
23
|
+
options = normalize_options(options)
|
|
24
|
+
metadata = build_metadata(repository, options)
|
|
25
|
+
|
|
26
|
+
# Validate metadata
|
|
27
|
+
validation = metadata.validate
|
|
28
|
+
unless validation[:valid?]
|
|
29
|
+
raise ArgumentError,
|
|
30
|
+
"Invalid metadata: #{validation[:errors].join(', ')}"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Create ZIP package
|
|
34
|
+
Zip::File.open(output_path, create: true) do |zip|
|
|
35
|
+
add_metadata(zip, metadata)
|
|
36
|
+
add_schemas(zip, repository, options)
|
|
37
|
+
add_indexes(zip, repository)
|
|
38
|
+
add_manifest(zip, repository)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
output_path
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# Normalize options with defaults
|
|
47
|
+
# @param options [Hash] Raw options
|
|
48
|
+
# @return [Hash] Normalized options
|
|
49
|
+
def normalize_options(options)
|
|
50
|
+
{
|
|
51
|
+
name: options[:name] || "Unnamed Package",
|
|
52
|
+
version: options[:version] || "1.0.0",
|
|
53
|
+
description: options[:description] || "",
|
|
54
|
+
express_mode: options[:express_mode] || "include_all",
|
|
55
|
+
resolution_mode: options[:resolution_mode] || "resolved",
|
|
56
|
+
serialization_format: options[:serialization_format] || "marshal",
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Build metadata from repository and options
|
|
61
|
+
# @param repository [Model::Repository] Repository instance
|
|
62
|
+
# @param options [Hash] Package options
|
|
63
|
+
# @return [Metadata] Package metadata
|
|
64
|
+
def build_metadata(repository, options)
|
|
65
|
+
Metadata.new(
|
|
66
|
+
name: options[:name],
|
|
67
|
+
version: options[:version],
|
|
68
|
+
description: options[:description],
|
|
69
|
+
created_at: Time.now.utc.iso8601,
|
|
70
|
+
created_by: "expressir",
|
|
71
|
+
expressir_version: Expressir::Version::VERSION,
|
|
72
|
+
express_mode: options[:express_mode],
|
|
73
|
+
resolution_mode: options[:resolution_mode],
|
|
74
|
+
serialization_format: options[:serialization_format],
|
|
75
|
+
files: count_files(repository),
|
|
76
|
+
schemas: repository.schemas.size,
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Count files in repository
|
|
81
|
+
# @param repository [Model::Repository] Repository instance
|
|
82
|
+
# @return [Integer] File count
|
|
83
|
+
def count_files(repository)
|
|
84
|
+
repository.schemas.count(&:file)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Add metadata to package
|
|
88
|
+
# @param zip [Zip::File] ZIP archive
|
|
89
|
+
# @param metadata [Metadata] Package metadata
|
|
90
|
+
# @return [void]
|
|
91
|
+
def add_metadata(zip, metadata)
|
|
92
|
+
zip.get_output_stream("metadata.yaml") do |stream|
|
|
93
|
+
stream.write(metadata.to_yaml)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Add schemas to package based on resolution mode
|
|
98
|
+
# @param zip [Zip::File] ZIP archive
|
|
99
|
+
# @param repository [Model::Repository] Repository instance
|
|
100
|
+
# @param options [Hash] Package options
|
|
101
|
+
# @return [void]
|
|
102
|
+
def add_schemas(zip, repository, options)
|
|
103
|
+
case options[:resolution_mode]
|
|
104
|
+
when "resolved"
|
|
105
|
+
add_serialized_repository(zip, repository,
|
|
106
|
+
options[:serialization_format])
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Add EXPRESS files if include_all mode
|
|
110
|
+
if options[:express_mode] == "include_all"
|
|
111
|
+
add_express_files(zip, repository)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Add serialized repository to package
|
|
116
|
+
# @param zip [Zip::File] ZIP archive
|
|
117
|
+
# @param repository [Model::Repository] Repository instance
|
|
118
|
+
# @param format [String] Serialization format
|
|
119
|
+
# @return [void]
|
|
120
|
+
def add_serialized_repository(zip, repository, format)
|
|
121
|
+
# Normalize repository - ensure all schemas are in files for serialization
|
|
122
|
+
normalized_repo = normalize_repository(repository)
|
|
123
|
+
|
|
124
|
+
case format
|
|
125
|
+
when "marshal"
|
|
126
|
+
zip.get_output_stream("repository.marshal") do |stream|
|
|
127
|
+
stream.write(Marshal.dump(normalized_repo))
|
|
128
|
+
end
|
|
129
|
+
when "json"
|
|
130
|
+
zip.get_output_stream("repository.json") do |stream|
|
|
131
|
+
stream.write(normalized_repo.to_json)
|
|
132
|
+
end
|
|
133
|
+
when "yaml"
|
|
134
|
+
zip.get_output_stream("repository.yaml") do |stream|
|
|
135
|
+
stream.write(normalized_repo.to_yaml)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Normalize repository for serialization
|
|
141
|
+
# Ensures all schemas are in files (not in @_schemas)
|
|
142
|
+
# @param repository [Model::Repository] Repository to normalize
|
|
143
|
+
# @return [Model::Repository] Normalized repository
|
|
144
|
+
def normalize_repository(repository)
|
|
145
|
+
# Create a new repository with proper file structure
|
|
146
|
+
normalized = Model::Repository.new(base_dir: repository.base_dir)
|
|
147
|
+
|
|
148
|
+
# Copy existing files
|
|
149
|
+
repository.files&.each do |file|
|
|
150
|
+
normalized.files << file
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Get schemas that are not already in files
|
|
154
|
+
file_schema_ids = normalized.files.flat_map(&:schemas).compact.map(&:id)
|
|
155
|
+
direct_schemas = repository.schemas.reject do |s|
|
|
156
|
+
file_schema_ids.include?(s.id)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Create an ExpFile for direct schemas
|
|
160
|
+
if direct_schemas.any?
|
|
161
|
+
exp_file = Model::ExpFile.new(path: "direct_schemas.exp")
|
|
162
|
+
exp_file.schemas = direct_schemas
|
|
163
|
+
normalized.files << exp_file
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
normalized
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Add EXPRESS files to package
|
|
170
|
+
# @param zip [Zip::File] ZIP archive
|
|
171
|
+
# @param repository [Model::Repository] Repository instance
|
|
172
|
+
# @return [void]
|
|
173
|
+
def add_express_files(zip, repository)
|
|
174
|
+
repository.schemas.each do |schema|
|
|
175
|
+
next unless schema.file && File.exist?(schema.file)
|
|
176
|
+
|
|
177
|
+
# Use schema id as filename
|
|
178
|
+
filename = "express_files/#{schema.id}.exp"
|
|
179
|
+
zip.get_output_stream(filename) do |stream|
|
|
180
|
+
stream.write(File.read(schema.file))
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Add indexes to package
|
|
186
|
+
# @param zip [Zip::File] ZIP archive
|
|
187
|
+
# @param repository [Model::Repository] Repository instance
|
|
188
|
+
# @return [void]
|
|
189
|
+
def add_indexes(zip, repository)
|
|
190
|
+
# Ensure indexes are built
|
|
191
|
+
repository.build_indexes if repository.entity_index.nil?
|
|
192
|
+
|
|
193
|
+
# Serialize indexes using Marshal for performance
|
|
194
|
+
zip.get_output_stream("entity_index.marshal") do |stream|
|
|
195
|
+
stream.write(Marshal.dump(repository.entity_index))
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
zip.get_output_stream("type_index.marshal") do |stream|
|
|
199
|
+
stream.write(Marshal.dump(repository.type_index))
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
zip.get_output_stream("reference_index.marshal") do |stream|
|
|
203
|
+
stream.write(Marshal.dump(repository.reference_index))
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Add manifest to package with rewritten paths
|
|
208
|
+
# @param zip [Zip::File] ZIP archive
|
|
209
|
+
# @param repository [Model::Repository] Repository instance
|
|
210
|
+
# @return [void]
|
|
211
|
+
def add_manifest(zip, repository)
|
|
212
|
+
# Create manifest with package-internal paths
|
|
213
|
+
manifest = Expressir::SchemaManifest.new
|
|
214
|
+
|
|
215
|
+
repository.schemas.each do |schema|
|
|
216
|
+
manifest.schemas << Expressir::SchemaManifestEntry.new(
|
|
217
|
+
id: schema.id,
|
|
218
|
+
path: "express_files/#{schema.id}.exp", # Package-internal path
|
|
219
|
+
)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Set output_path to suppress relative path calculation
|
|
223
|
+
manifest.output_path = "manifest.yaml"
|
|
224
|
+
|
|
225
|
+
zip.get_output_stream("manifest.yaml") do |stream|
|
|
226
|
+
stream.write(manifest.to_yaml)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Expressir
|
|
4
|
+
module Package
|
|
5
|
+
# Package metadata with serialization support
|
|
6
|
+
# Stores configuration and statistics for LER packages
|
|
7
|
+
class Metadata < Lutaml::Model::Serializable
|
|
8
|
+
attribute :name, :string
|
|
9
|
+
attribute :version, :string
|
|
10
|
+
attribute :description, :string
|
|
11
|
+
attribute :created_at, :string
|
|
12
|
+
attribute :created_by, :string, default: -> { "expressir" }
|
|
13
|
+
attribute :expressir_version, :string
|
|
14
|
+
attribute :express_mode, :string, default: -> { "include_all" }
|
|
15
|
+
attribute :resolution_mode, :string, default: -> { "resolved" }
|
|
16
|
+
attribute :serialization_format, :string, default: -> { "marshal" }
|
|
17
|
+
attribute :files, :integer
|
|
18
|
+
attribute :schemas, :integer
|
|
19
|
+
|
|
20
|
+
yaml do
|
|
21
|
+
map "name", to: :name
|
|
22
|
+
map "version", to: :version
|
|
23
|
+
map "description", to: :description
|
|
24
|
+
map "created_at", to: :created_at
|
|
25
|
+
map "created_by", to: :created_by
|
|
26
|
+
map "expressir_version", to: :expressir_version
|
|
27
|
+
map "express_mode", to: :express_mode
|
|
28
|
+
map "resolution_mode", to: :resolution_mode
|
|
29
|
+
map "serialization_format", to: :serialization_format
|
|
30
|
+
map "files", to: :files
|
|
31
|
+
map "schemas", to: :schemas
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Validate metadata configuration
|
|
35
|
+
# @return [Hash] Validation result with :valid? and :errors
|
|
36
|
+
def validate
|
|
37
|
+
errors = []
|
|
38
|
+
|
|
39
|
+
errors << "name is required" if name.nil? || name.empty?
|
|
40
|
+
errors << "version is required" if version.nil? || version.empty?
|
|
41
|
+
|
|
42
|
+
unless %w[include_all allow_external].include?(express_mode)
|
|
43
|
+
errors << "express_mode must be 'include_all' or 'allow_external'"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
unless %w[resolved bare].include?(resolution_mode)
|
|
47
|
+
errors << "resolution_mode must be 'resolved' or 'bare'"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
unless %w[marshal json yaml].include?(serialization_format)
|
|
51
|
+
errors << "serialization_format must be 'marshal', 'json', or 'yaml'"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
{
|
|
55
|
+
valid?: errors.empty?,
|
|
56
|
+
errors: errors,
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Convert metadata to hash
|
|
61
|
+
# @return [Hash] Metadata as hash
|
|
62
|
+
def to_h
|
|
63
|
+
{
|
|
64
|
+
"name" => name,
|
|
65
|
+
"version" => version,
|
|
66
|
+
"description" => description,
|
|
67
|
+
"created_at" => created_at,
|
|
68
|
+
"created_by" => created_by,
|
|
69
|
+
"expressir_version" => expressir_version,
|
|
70
|
+
"express_mode" => express_mode,
|
|
71
|
+
"resolution_mode" => resolution_mode,
|
|
72
|
+
"serialization_format" => serialization_format,
|
|
73
|
+
"files" => files,
|
|
74
|
+
"schemas" => schemas,
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|