lutaml 0.10.4 → 0.10.6
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/.gitignore +8 -0
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +218 -94
- data/TODO.cleanups/01-resolve-production-todos.md +65 -0
- data/TODO.cleanups/02-reduce-metrics-offenses.md +37 -0
- data/TODO.cleanups/03-reduce-rspec-multiple-expectations.md +54 -0
- data/TODO.cleanups/04-reduce-rspec-example-length.md +45 -0
- data/TODO.cleanups/05-replace-marshal-load.md +37 -0
- data/TODO.cleanups/06-replace-eval-in-tests.md +41 -0
- data/TODO.cleanups/07-fix-lint-offenses.md +74 -0
- data/TODO.cleanups/08-reduce-memoized-helpers-and-nesting.md +43 -0
- data/TODO.cleanups/09-reduce-verified-doubles-and-rspec-style.md +57 -0
- data/TODO.cleanups/10-split-large-files.md +47 -0
- data/bin/console +0 -1
- data/exe/lutaml +1 -0
- data/lib/lutaml/cli/element_identifier.rb +3 -6
- data/lib/lutaml/cli/interactive_shell/bookmark_commands.rb +88 -0
- data/lib/lutaml/cli/interactive_shell/command_base.rb +32 -0
- data/lib/lutaml/cli/interactive_shell/export_handler.rb +67 -0
- data/lib/lutaml/cli/interactive_shell/help_display.rb +114 -0
- data/lib/lutaml/cli/interactive_shell/navigation_commands.rb +135 -0
- data/lib/lutaml/cli/interactive_shell/query_commands.rb +185 -0
- data/lib/lutaml/cli/interactive_shell.rb +116 -802
- data/lib/lutaml/cli/uml/build_command.rb +5 -5
- data/lib/lutaml/cli/uml/verify_command.rb +0 -1
- data/lib/lutaml/converter/xmi_to_uml.rb +3 -153
- data/lib/lutaml/converter/xmi_to_uml_generalization.rb +193 -0
- data/lib/lutaml/formatter/graphviz.rb +1 -2
- data/lib/lutaml/qea/database.rb +1 -47
- data/lib/lutaml/qea/factory/association_builder.rb +188 -0
- data/lib/lutaml/qea/factory/base_transformer.rb +0 -1
- data/lib/lutaml/qea/factory/class_transformer.rb +40 -590
- data/lib/lutaml/qea/factory/diagram_transformer.rb +0 -3
- data/lib/lutaml/qea/factory/generalization_builder.rb +211 -0
- data/lib/lutaml/qea/factory/package_transformer.rb +1 -2
- data/lib/lutaml/qea/factory/stereotype_loader.rb +34 -0
- data/lib/lutaml/qea/lookup_indexes.rb +54 -0
- data/lib/lutaml/qea/models/ea_datatype.rb +0 -2
- data/lib/lutaml/qea/validation/validation_engine.rb +0 -2
- data/lib/lutaml/uml/has_members.rb +0 -1
- data/lib/lutaml/uml/inheritance_walker.rb +92 -0
- data/lib/lutaml/uml/model_helpers.rb +129 -0
- data/lib/lutaml/uml/node/attribute.rb +3 -1
- data/lib/lutaml/uml/node/class_node.rb +3 -3
- data/lib/lutaml/uml/operation.rb +2 -0
- data/lib/lutaml/uml_repository/class_lookup_index.rb +40 -0
- data/lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb +179 -0
- data/lib/lutaml/uml_repository/exporters/markdown/formatting.rb +36 -0
- data/lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb +73 -0
- data/lib/lutaml/uml_repository/exporters/markdown/link_resolver.rb +40 -0
- data/lib/lutaml/uml_repository/exporters/markdown/package_page_builder.rb +107 -0
- data/lib/lutaml/uml_repository/exporters/markdown_exporter.rb +26 -538
- data/lib/lutaml/uml_repository/index_builder.rb +3 -271
- data/lib/lutaml/uml_repository/index_builders/association_index.rb +141 -0
- data/lib/lutaml/uml_repository/index_builders/class_index.rb +94 -0
- data/lib/lutaml/uml_repository/index_builders/package_index.rb +57 -0
- data/lib/lutaml/uml_repository/package_exporter.rb +10 -20
- data/lib/lutaml/uml_repository/package_loader.rb +37 -17
- data/lib/lutaml/uml_repository/repository/deprecated.rb +39 -0
- data/lib/lutaml/uml_repository/repository/loader.rb +112 -0
- data/lib/lutaml/uml_repository/repository.rb +7 -57
- data/lib/lutaml/uml_repository/static_site/association_serialization.rb +142 -0
- data/lib/lutaml/uml_repository/static_site/configuration.rb +0 -2
- data/lib/lutaml/uml_repository/static_site/data_transformer.rb +52 -873
- data/lib/lutaml/uml_repository/static_site/generator.rb +29 -8
- data/lib/lutaml/uml_repository/static_site/search_index_builder.rb +1 -4
- data/lib/lutaml/uml_repository/static_site/serializers/attribute_serializer.rb +78 -0
- data/lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb +124 -0
- data/lib/lutaml/uml_repository/static_site/serializers/diagram_serializer.rb +60 -0
- data/lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb +258 -0
- data/lib/lutaml/uml_repository/static_site/serializers/metadata_builder.rb +48 -0
- data/lib/lutaml/uml_repository/static_site/serializers/operation_serializer.rb +57 -0
- data/lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb +94 -0
- data/lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb +93 -0
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/association_drop.rb +13 -35
- data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +12 -18
- data/lib/lutaml/xmi/liquid_drops/cardinality_drop.rb +14 -6
- data/lib/lutaml/xmi/liquid_drops/connector_drop.rb +0 -3
- data/lib/lutaml/xmi/liquid_drops/constraint_drop.rb +1 -3
- data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +13 -70
- data/lib/lutaml/xmi/liquid_drops/dependency_drop.rb +2 -5
- data/lib/lutaml/xmi/liquid_drops/diagram_drop.rb +5 -11
- data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +8 -16
- data/lib/lutaml/xmi/liquid_drops/enum_owned_literal_drop.rb +3 -9
- data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +11 -13
- data/lib/lutaml/xmi/liquid_drops/generalization_drop.rb +27 -85
- data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +39 -91
- data/lib/lutaml/xmi/liquid_drops/operation_drop.rb +3 -9
- data/lib/lutaml/xmi/liquid_drops/package_drop.rb +16 -44
- data/lib/lutaml/xmi/liquid_drops/root_drop.rb +3 -11
- data/lib/lutaml/xmi/liquid_drops/source_target_drop.rb +2 -5
- data/lib/lutaml/xmi/parsers/xmi_base.rb +2 -749
- data/lib/lutaml/xmi/parsers/xmi_class_members.rb +45 -0
- data/lib/lutaml/xmi/parsers/xmi_connector.rb +251 -0
- data/lib/lutaml/xmi/parsers/xml.rb +7 -120
- data/lib/lutaml/xmi/xmi_lookup_service.rb +42 -0
- data/lib/lutaml.rb +0 -1
- metadata +48 -21
- data/lib/lutaml/cli/commands/base_command.rb +0 -118
- data/lib/lutaml/command_line.rb +0 -272
- data/lib/lutaml/sysml/allocate.rb +0 -9
- data/lib/lutaml/sysml/allocated.rb +0 -9
- data/lib/lutaml/sysml/binding_connector.rb +0 -9
- data/lib/lutaml/sysml/block.rb +0 -32
- data/lib/lutaml/sysml/constraint_block.rb +0 -14
- data/lib/lutaml/sysml/copy.rb +0 -8
- data/lib/lutaml/sysml/derive_requirement.rb +0 -9
- data/lib/lutaml/sysml/nested_connector_end.rb +0 -13
- data/lib/lutaml/sysml/refine.rb +0 -9
- data/lib/lutaml/sysml/requirement.rb +0 -44
- data/lib/lutaml/sysml/requirement_related.rb +0 -9
- data/lib/lutaml/sysml/satisfy.rb +0 -9
- data/lib/lutaml/sysml/test_case.rb +0 -25
- data/lib/lutaml/sysml/trace.rb +0 -9
- data/lib/lutaml/sysml/verify.rb +0 -8
- data/lib/lutaml/sysml/xmi_file.rb +0 -486
- data/lib/lutaml/sysml.rb +0 -11
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.6
|
|
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-
|
|
11
|
+
date: 2026-05-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: expressir
|
|
@@ -335,6 +335,16 @@ files:
|
|
|
335
335
|
- Makefile
|
|
336
336
|
- README.adoc
|
|
337
337
|
- Rakefile
|
|
338
|
+
- TODO.cleanups/01-resolve-production-todos.md
|
|
339
|
+
- TODO.cleanups/02-reduce-metrics-offenses.md
|
|
340
|
+
- TODO.cleanups/03-reduce-rspec-multiple-expectations.md
|
|
341
|
+
- TODO.cleanups/04-reduce-rspec-example-length.md
|
|
342
|
+
- TODO.cleanups/05-replace-marshal-load.md
|
|
343
|
+
- TODO.cleanups/06-replace-eval-in-tests.md
|
|
344
|
+
- TODO.cleanups/07-fix-lint-offenses.md
|
|
345
|
+
- TODO.cleanups/08-reduce-memoized-helpers-and-nesting.md
|
|
346
|
+
- TODO.cleanups/09-reduce-verified-doubles-and-rspec-style.md
|
|
347
|
+
- TODO.cleanups/10-split-large-files.md
|
|
338
348
|
- bin/console
|
|
339
349
|
- bin/folder_yaml2lutaml.sh
|
|
340
350
|
- bin/plantuml2lutaml
|
|
@@ -628,10 +638,15 @@ files:
|
|
|
628
638
|
- exe/lutaml-yaml2uml
|
|
629
639
|
- lib/lutaml.rb
|
|
630
640
|
- lib/lutaml/cli.rb
|
|
631
|
-
- lib/lutaml/cli/commands/base_command.rb
|
|
632
641
|
- lib/lutaml/cli/element_identifier.rb
|
|
633
642
|
- lib/lutaml/cli/enhanced_formatter.rb
|
|
634
643
|
- lib/lutaml/cli/interactive_shell.rb
|
|
644
|
+
- lib/lutaml/cli/interactive_shell/bookmark_commands.rb
|
|
645
|
+
- lib/lutaml/cli/interactive_shell/command_base.rb
|
|
646
|
+
- lib/lutaml/cli/interactive_shell/export_handler.rb
|
|
647
|
+
- lib/lutaml/cli/interactive_shell/help_display.rb
|
|
648
|
+
- lib/lutaml/cli/interactive_shell/navigation_commands.rb
|
|
649
|
+
- lib/lutaml/cli/interactive_shell/query_commands.rb
|
|
635
650
|
- lib/lutaml/cli/lml_commands.rb
|
|
636
651
|
- lib/lutaml/cli/output_formatter.rb
|
|
637
652
|
- lib/lutaml/cli/resource_registry.rb
|
|
@@ -653,9 +668,9 @@ files:
|
|
|
653
668
|
- lib/lutaml/cli/uml/validate_command.rb
|
|
654
669
|
- lib/lutaml/cli/uml/verify_command.rb
|
|
655
670
|
- lib/lutaml/cli/uml_commands.rb
|
|
656
|
-
- lib/lutaml/command_line.rb
|
|
657
671
|
- lib/lutaml/converter/dsl_to_uml.rb
|
|
658
672
|
- lib/lutaml/converter/xmi_to_uml.rb
|
|
673
|
+
- lib/lutaml/converter/xmi_to_uml_generalization.rb
|
|
659
674
|
- lib/lutaml/ea/diagram.rb
|
|
660
675
|
- lib/lutaml/ea/diagram/configuration.rb
|
|
661
676
|
- lib/lutaml/ea/diagram/element_renderers/base_renderer.rb
|
|
@@ -688,6 +703,7 @@ files:
|
|
|
688
703
|
- lib/lutaml/qea.rb
|
|
689
704
|
- lib/lutaml/qea/benchmark.rb
|
|
690
705
|
- lib/lutaml/qea/database.rb
|
|
706
|
+
- lib/lutaml/qea/factory/association_builder.rb
|
|
691
707
|
- lib/lutaml/qea/factory/association_transformer.rb
|
|
692
708
|
- lib/lutaml/qea/factory/attribute_tag_transformer.rb
|
|
693
709
|
- lib/lutaml/qea/factory/attribute_transformer.rb
|
|
@@ -699,18 +715,21 @@ files:
|
|
|
699
715
|
- lib/lutaml/qea/factory/document_builder.rb
|
|
700
716
|
- lib/lutaml/qea/factory/ea_to_uml_factory.rb
|
|
701
717
|
- lib/lutaml/qea/factory/enum_transformer.rb
|
|
718
|
+
- lib/lutaml/qea/factory/generalization_builder.rb
|
|
702
719
|
- lib/lutaml/qea/factory/generalization_transformer.rb
|
|
703
720
|
- lib/lutaml/qea/factory/instance_transformer.rb
|
|
704
721
|
- lib/lutaml/qea/factory/object_property_transformer.rb
|
|
705
722
|
- lib/lutaml/qea/factory/operation_transformer.rb
|
|
706
723
|
- lib/lutaml/qea/factory/package_transformer.rb
|
|
707
724
|
- lib/lutaml/qea/factory/reference_resolver.rb
|
|
725
|
+
- lib/lutaml/qea/factory/stereotype_loader.rb
|
|
708
726
|
- lib/lutaml/qea/factory/tagged_value_transformer.rb
|
|
709
727
|
- lib/lutaml/qea/factory/transformer_registry.rb
|
|
710
728
|
- lib/lutaml/qea/file_detector.rb
|
|
711
729
|
- lib/lutaml/qea/infrastructure/database_connection.rb
|
|
712
730
|
- lib/lutaml/qea/infrastructure/schema_reader.rb
|
|
713
731
|
- lib/lutaml/qea/infrastructure/table_reader.rb
|
|
732
|
+
- lib/lutaml/qea/lookup_indexes.rb
|
|
714
733
|
- lib/lutaml/qea/models/base_model.rb
|
|
715
734
|
- lib/lutaml/qea/models/ea_attribute.rb
|
|
716
735
|
- lib/lutaml/qea/models/ea_attribute_tag.rb
|
|
@@ -762,23 +781,6 @@ files:
|
|
|
762
781
|
- lib/lutaml/qea/verification/document_verifier.rb
|
|
763
782
|
- lib/lutaml/qea/verification/element_comparator.rb
|
|
764
783
|
- lib/lutaml/qea/verification/structure_matcher.rb
|
|
765
|
-
- lib/lutaml/sysml.rb
|
|
766
|
-
- lib/lutaml/sysml/allocate.rb
|
|
767
|
-
- lib/lutaml/sysml/allocated.rb
|
|
768
|
-
- lib/lutaml/sysml/binding_connector.rb
|
|
769
|
-
- lib/lutaml/sysml/block.rb
|
|
770
|
-
- lib/lutaml/sysml/constraint_block.rb
|
|
771
|
-
- lib/lutaml/sysml/copy.rb
|
|
772
|
-
- lib/lutaml/sysml/derive_requirement.rb
|
|
773
|
-
- lib/lutaml/sysml/nested_connector_end.rb
|
|
774
|
-
- lib/lutaml/sysml/refine.rb
|
|
775
|
-
- lib/lutaml/sysml/requirement.rb
|
|
776
|
-
- lib/lutaml/sysml/requirement_related.rb
|
|
777
|
-
- lib/lutaml/sysml/satisfy.rb
|
|
778
|
-
- lib/lutaml/sysml/test_case.rb
|
|
779
|
-
- lib/lutaml/sysml/trace.rb
|
|
780
|
-
- lib/lutaml/sysml/verify.rb
|
|
781
|
-
- lib/lutaml/sysml/xmi_file.rb
|
|
782
784
|
- lib/lutaml/uml.rb
|
|
783
785
|
- lib/lutaml/uml/abstraction.rb
|
|
784
786
|
- lib/lutaml/uml/action.rb
|
|
@@ -810,8 +812,10 @@ files:
|
|
|
810
812
|
- lib/lutaml/uml/group.rb
|
|
811
813
|
- lib/lutaml/uml/has_attributes.rb
|
|
812
814
|
- lib/lutaml/uml/has_members.rb
|
|
815
|
+
- lib/lutaml/uml/inheritance_walker.rb
|
|
813
816
|
- lib/lutaml/uml/instance.rb
|
|
814
817
|
- lib/lutaml/uml/model.rb
|
|
818
|
+
- lib/lutaml/uml/model_helpers.rb
|
|
815
819
|
- lib/lutaml/uml/namespace.rb
|
|
816
820
|
- lib/lutaml/uml/node/attribute.rb
|
|
817
821
|
- lib/lutaml/uml/node/base.rb
|
|
@@ -850,11 +854,20 @@ files:
|
|
|
850
854
|
- lib/lutaml/uml/value.rb
|
|
851
855
|
- lib/lutaml/uml/vertex.rb
|
|
852
856
|
- lib/lutaml/uml_repository.rb
|
|
857
|
+
- lib/lutaml/uml_repository/class_lookup_index.rb
|
|
853
858
|
- lib/lutaml/uml_repository/error_handler.rb
|
|
854
859
|
- lib/lutaml/uml_repository/exporters/base_exporter.rb
|
|
855
860
|
- lib/lutaml/uml_repository/exporters/json_exporter.rb
|
|
861
|
+
- lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb
|
|
862
|
+
- lib/lutaml/uml_repository/exporters/markdown/formatting.rb
|
|
863
|
+
- lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb
|
|
864
|
+
- lib/lutaml/uml_repository/exporters/markdown/link_resolver.rb
|
|
865
|
+
- lib/lutaml/uml_repository/exporters/markdown/package_page_builder.rb
|
|
856
866
|
- lib/lutaml/uml_repository/exporters/markdown_exporter.rb
|
|
857
867
|
- lib/lutaml/uml_repository/index_builder.rb
|
|
868
|
+
- lib/lutaml/uml_repository/index_builders/association_index.rb
|
|
869
|
+
- lib/lutaml/uml_repository/index_builders/class_index.rb
|
|
870
|
+
- lib/lutaml/uml_repository/index_builders/package_index.rb
|
|
858
871
|
- lib/lutaml/uml_repository/lazy_repository.rb
|
|
859
872
|
- lib/lutaml/uml_repository/package_exporter.rb
|
|
860
873
|
- lib/lutaml/uml_repository/package_loader.rb
|
|
@@ -882,14 +895,25 @@ files:
|
|
|
882
895
|
- lib/lutaml/uml_repository/query_dsl/order.rb
|
|
883
896
|
- lib/lutaml/uml_repository/query_dsl/query_builder.rb
|
|
884
897
|
- lib/lutaml/uml_repository/repository.rb
|
|
898
|
+
- lib/lutaml/uml_repository/repository/deprecated.rb
|
|
899
|
+
- lib/lutaml/uml_repository/repository/loader.rb
|
|
885
900
|
- lib/lutaml/uml_repository/repository_enhanced.rb
|
|
886
901
|
- lib/lutaml/uml_repository/search_result.rb
|
|
887
902
|
- lib/lutaml/uml_repository/static_site.rb
|
|
903
|
+
- lib/lutaml/uml_repository/static_site/association_serialization.rb
|
|
888
904
|
- lib/lutaml/uml_repository/static_site/configuration.rb
|
|
889
905
|
- lib/lutaml/uml_repository/static_site/data_transformer.rb
|
|
890
906
|
- lib/lutaml/uml_repository/static_site/generator.rb
|
|
891
907
|
- lib/lutaml/uml_repository/static_site/id_generator.rb
|
|
892
908
|
- lib/lutaml/uml_repository/static_site/search_index_builder.rb
|
|
909
|
+
- lib/lutaml/uml_repository/static_site/serializers/attribute_serializer.rb
|
|
910
|
+
- lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb
|
|
911
|
+
- lib/lutaml/uml_repository/static_site/serializers/diagram_serializer.rb
|
|
912
|
+
- lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb
|
|
913
|
+
- lib/lutaml/uml_repository/static_site/serializers/metadata_builder.rb
|
|
914
|
+
- lib/lutaml/uml_repository/static_site/serializers/operation_serializer.rb
|
|
915
|
+
- lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb
|
|
916
|
+
- lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb
|
|
893
917
|
- lib/lutaml/uml_repository/statistics_calculator.rb
|
|
894
918
|
- lib/lutaml/uml_repository/validators/repository_validator.rb
|
|
895
919
|
- lib/lutaml/uml_repository/web_ui/app.rb
|
|
@@ -916,7 +940,10 @@ files:
|
|
|
916
940
|
- lib/lutaml/xmi/liquid_drops/root_drop.rb
|
|
917
941
|
- lib/lutaml/xmi/liquid_drops/source_target_drop.rb
|
|
918
942
|
- lib/lutaml/xmi/parsers/xmi_base.rb
|
|
943
|
+
- lib/lutaml/xmi/parsers/xmi_class_members.rb
|
|
944
|
+
- lib/lutaml/xmi/parsers/xmi_connector.rb
|
|
919
945
|
- lib/lutaml/xmi/parsers/xml.rb
|
|
946
|
+
- lib/lutaml/xmi/xmi_lookup_service.rb
|
|
920
947
|
- lib/lutaml/xml.rb
|
|
921
948
|
- lib/lutaml/xml/parsers/xml.rb
|
|
922
949
|
- lutaml.gemspec
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../output_formatter"
|
|
4
|
-
|
|
5
|
-
module Lutaml
|
|
6
|
-
module Cli
|
|
7
|
-
module Commands
|
|
8
|
-
# BaseCommand provides common functionality for all command handlers
|
|
9
|
-
#
|
|
10
|
-
# All command classes should inherit from this base class to access
|
|
11
|
-
# common utilities like repository loading, error handling,
|
|
12
|
-
# and output formatting.
|
|
13
|
-
class BaseCommand
|
|
14
|
-
attr_reader :repository, :options
|
|
15
|
-
|
|
16
|
-
# Initialize command with repository and options
|
|
17
|
-
#
|
|
18
|
-
# @param repository [Lutaml::UmlRepository::Repository, nil]
|
|
19
|
-
# Repository instance
|
|
20
|
-
# @param options [Hash] Command options
|
|
21
|
-
def initialize(repository = nil, options = {})
|
|
22
|
-
@repository = repository
|
|
23
|
-
@options = options
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Execute the command (to be implemented by subclasses)
|
|
27
|
-
#
|
|
28
|
-
# @raise [NotImplementedError] If not overridden by subclass
|
|
29
|
-
def execute
|
|
30
|
-
raise NotImplementedError,
|
|
31
|
-
"#{self.class.name} must implement #execute"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
protected
|
|
35
|
-
|
|
36
|
-
# Load repository from LUR file
|
|
37
|
-
#
|
|
38
|
-
# @param lur_path [String] Path to LUR package file
|
|
39
|
-
# @param lazy [Boolean] Whether to use lazy loading
|
|
40
|
-
# @return [Lutaml::UmlRepository::Repository] Loaded repository
|
|
41
|
-
def load_repository(lur_path, lazy: false) # rubocop:disable Metrics/MethodLength
|
|
42
|
-
unless File.exist?(lur_path)
|
|
43
|
-
error_and_exit("Package file not found: #{lur_path}")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
OutputFormatter.progress("Loading repository from #{lur_path}")
|
|
47
|
-
require_relative "../../uml_repository/repository"
|
|
48
|
-
repo = if lazy
|
|
49
|
-
Lutaml::UmlRepository::Repository.from_package_lazy(lur_path)
|
|
50
|
-
else
|
|
51
|
-
Lutaml::UmlRepository::Repository.from_package(lur_path)
|
|
52
|
-
end
|
|
53
|
-
OutputFormatter.progress_done
|
|
54
|
-
repo
|
|
55
|
-
rescue StandardError => e
|
|
56
|
-
OutputFormatter.progress_done(success: false)
|
|
57
|
-
error_and_exit("Failed to load repository: #{e.message}")
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# Normalize path syntax
|
|
61
|
-
#
|
|
62
|
-
# Converts :: or <RepositoryRoot>:: to ModelRoot
|
|
63
|
-
#
|
|
64
|
-
# @param path [String, nil] Path to normalize
|
|
65
|
-
# @return [String] Normalized path
|
|
66
|
-
def normalize_path(path)
|
|
67
|
-
return "ModelRoot" if path.nil? || path.empty?
|
|
68
|
-
return "ModelRoot" if ["::", "<RepositoryRoot>"].include?(path)
|
|
69
|
-
|
|
70
|
-
# Convert leading :: to ModelRoot::
|
|
71
|
-
path = path.sub(/^::/, "ModelRoot::")
|
|
72
|
-
# Convert <RepositoryRoot>:: to ModelRoot::
|
|
73
|
-
path.sub(/^<RepositoryRoot>::/, "ModelRoot::")
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Print error message and exit
|
|
77
|
-
#
|
|
78
|
-
# @param message [String] Error message
|
|
79
|
-
# @param code [Integer] Exit code (default: 1)
|
|
80
|
-
def error_and_exit(message, code: 1)
|
|
81
|
-
puts OutputFormatter.error(message)
|
|
82
|
-
exit code
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
# Print warning message
|
|
86
|
-
#
|
|
87
|
-
# @param message [String] Warning message
|
|
88
|
-
def warn(message)
|
|
89
|
-
puts OutputFormatter.warning(message)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
# Print success message
|
|
93
|
-
#
|
|
94
|
-
# @param message [String] Success message
|
|
95
|
-
def success(message)
|
|
96
|
-
puts OutputFormatter.success(message)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# Print info message
|
|
100
|
-
#
|
|
101
|
-
# @param message [String] Info message
|
|
102
|
-
def info(message)
|
|
103
|
-
puts OutputFormatter.info(message)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
# Format and print output based on format option
|
|
107
|
-
#
|
|
108
|
-
# @param data [Object] Data to format
|
|
109
|
-
# @param format [String, nil] Output format
|
|
110
|
-
# (uses options[:format] if nil)
|
|
111
|
-
def print_formatted(data, format: nil)
|
|
112
|
-
format ||= options[:format] || "text"
|
|
113
|
-
puts OutputFormatter.format(data, format: format)
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
data/lib/lutaml/command_line.rb
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "optparse"
|
|
4
|
-
require "pathname"
|
|
5
|
-
require_relative "formatter"
|
|
6
|
-
require_relative "uml/has_attributes"
|
|
7
|
-
require_relative "uml/parsers/attribute"
|
|
8
|
-
require_relative "uml/parsers/dsl"
|
|
9
|
-
require_relative "uml/parsers/yaml"
|
|
10
|
-
|
|
11
|
-
module Lutaml
|
|
12
|
-
class CommandLine
|
|
13
|
-
class Error < Lutaml::Error; end
|
|
14
|
-
class FileError < Error; end
|
|
15
|
-
class NotSupportedInputFormat < Error; end
|
|
16
|
-
|
|
17
|
-
include ::Lutaml::Uml::HasAttributes
|
|
18
|
-
|
|
19
|
-
SUPPORTED_FORMATS = %w[yaml lutaml exp].freeze
|
|
20
|
-
DEFAULT_INPUT_FORMAT = "lutaml"
|
|
21
|
-
|
|
22
|
-
def self.run(args, out_object, attributes = {})
|
|
23
|
-
new(attributes, out_object).run(args)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def initialize(attributes = {}, out_object = $stdout)
|
|
27
|
-
@formatter = ::Lutaml::Formatter::Graphviz.new
|
|
28
|
-
@verbose = false
|
|
29
|
-
@option_parser = OptionParser.new
|
|
30
|
-
@out_object = out_object
|
|
31
|
-
|
|
32
|
-
setup_parser_options
|
|
33
|
-
|
|
34
|
-
# rubocop:disable Rails/ActiveRecordAliases
|
|
35
|
-
update_attributes(attributes)
|
|
36
|
-
# rubocop:enable Rails/ActiveRecordAliases
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def output_path=(value)
|
|
40
|
-
@output_path = determine_output_path_value(value)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def determine_output_path_value(value)
|
|
44
|
-
unless value.nil? || @output_path = value.is_a?(Pathname)
|
|
45
|
-
return Pathname.new(value.to_s)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
value
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def paths=(values)
|
|
52
|
-
@paths = values.to_a.map { |path| Pathname.new(path) }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def formatter=(value)
|
|
56
|
-
value = value.to_s.strip.downcase.to_sym
|
|
57
|
-
value = Lutaml::Formatter.find_by(name: value)
|
|
58
|
-
raise Error, "Formatter not found: #{value}" if value.nil?
|
|
59
|
-
|
|
60
|
-
@formatter = value
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def input_format=(value)
|
|
64
|
-
if value.nil?
|
|
65
|
-
@input_format = DEFAULT_INPUT_FORMAT
|
|
66
|
-
return
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
@input_format = SUPPORTED_FORMATS.detect { |n| n == value }
|
|
70
|
-
raise(NotSupportedInputFormat, value) if @input_format.nil?
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def run(original_args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
74
|
-
args = original_args.dup
|
|
75
|
-
if args.empty? || args.first.strip == "help"
|
|
76
|
-
print_help
|
|
77
|
-
exit
|
|
78
|
-
end
|
|
79
|
-
begin
|
|
80
|
-
@option_parser.parse!(args)
|
|
81
|
-
rescue StandardError
|
|
82
|
-
nil
|
|
83
|
-
end
|
|
84
|
-
@paths = args
|
|
85
|
-
@formatter.type = @type
|
|
86
|
-
|
|
87
|
-
if @output_path&.file? && @paths.length > 1
|
|
88
|
-
raise Error,
|
|
89
|
-
'Output path must be a directory \
|
|
90
|
-
if multiple input files are given'
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
@paths.each do |input_path_string|
|
|
94
|
-
input_path = Pathname.new(input_path_string)
|
|
95
|
-
unless input_path.exist?
|
|
96
|
-
raise FileError, "File does not exist: #{input_path}"
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
document = Lutaml::Parser
|
|
100
|
-
.parse_into_document(File.new(input_path), @input_format)
|
|
101
|
-
.first
|
|
102
|
-
result = @formatter.format(document)
|
|
103
|
-
|
|
104
|
-
if @output_path
|
|
105
|
-
output_path = @output_path
|
|
106
|
-
if output_path.directory?
|
|
107
|
-
output_path = output_path.join(input_path
|
|
108
|
-
.basename(".*").to_s +
|
|
109
|
-
".#{@formatter.type}")
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
output_path.open("w+") { |file| file.write(result) }
|
|
113
|
-
else
|
|
114
|
-
@out_object.puts(result)
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
protected
|
|
120
|
-
|
|
121
|
-
def text_bold(body = nil)
|
|
122
|
-
text_effect(1, body)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
def text_italic(body = nil)
|
|
126
|
-
text_effect(3, body)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def text_bold_italic(body = nil)
|
|
130
|
-
text_bold(text_italic(body))
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def text_underline(body = nil)
|
|
134
|
-
text_effect(4, body)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def text_effect(num, body = nil)
|
|
138
|
-
result = "\e[#{num}m"
|
|
139
|
-
result << "#{body}#{text_reset}" unless body.nil?
|
|
140
|
-
|
|
141
|
-
result
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
def text_reset
|
|
145
|
-
"\e[0m"
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
def setup_parser_options # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
149
|
-
@option_parser.banner = ""
|
|
150
|
-
format_desc = "The output formatter (Default: '#{@formatter.name}')"
|
|
151
|
-
@option_parser
|
|
152
|
-
.on("-f",
|
|
153
|
-
"--formatter VALUE",
|
|
154
|
-
format_desc) do |value|
|
|
155
|
-
@formatter = value
|
|
156
|
-
end
|
|
157
|
-
@option_parser
|
|
158
|
-
.on("-t", "--type VALUE", "The output format type") do |value|
|
|
159
|
-
@type = value
|
|
160
|
-
end
|
|
161
|
-
@option_parser
|
|
162
|
-
.on("-o", "--output VALUE", "The output path") do |value|
|
|
163
|
-
@output_path = Pathname.new(value)
|
|
164
|
-
end
|
|
165
|
-
@option_parser
|
|
166
|
-
.on("-i", "--input-format VALUE", "The input format") do |value|
|
|
167
|
-
@input_format = value
|
|
168
|
-
end
|
|
169
|
-
@option_parser
|
|
170
|
-
.on("-h", "--help", "Prints this help") do
|
|
171
|
-
print_help
|
|
172
|
-
exit
|
|
173
|
-
end
|
|
174
|
-
@option_parser.on("-g", "--graph VALUE") do |value|
|
|
175
|
-
Parsers::Attribute.parse(value).each do |key, attr_value|
|
|
176
|
-
@formatter.graph[key] = attr_value
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
@option_parser.on("-e", "--edge VALUE") do |value|
|
|
181
|
-
Parsers::Attribute.parse(value).each do |key, attr_value|
|
|
182
|
-
@formatter.edge[key] = attr_value
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
@option_parser.on("-n", "--node VALUE") do |value|
|
|
187
|
-
Parsers::Attribute.parse(value).each do |key, attr_value|
|
|
188
|
-
@formatter.node[key] = attr_value
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
@option_parser.on("-a", "--all VALUE") do |value|
|
|
193
|
-
Parsers::Attribute.parse(value).each do |key, attr_value|
|
|
194
|
-
@formatter.graph[key] = attr_value
|
|
195
|
-
@formatter.edge[key] = attr_value
|
|
196
|
-
@formatter.node[key] = attr_value
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def print_help # rubocop:disable Metrics/AbcSize
|
|
202
|
-
@out_object.puts <<~HELP
|
|
203
|
-
#{text_bold('Usage:')} lutaml [options] PATHS
|
|
204
|
-
|
|
205
|
-
#{text_bold('Overview:')} Generate output from Supplied language files if supported
|
|
206
|
-
|
|
207
|
-
#{text_bold('Options:')}
|
|
208
|
-
#{@option_parser}
|
|
209
|
-
#{text_bold('Paths:')}
|
|
210
|
-
|
|
211
|
-
LUTAML can accept multiple paths for parsing for easier batch processing.
|
|
212
|
-
|
|
213
|
-
The location of the output by default is standard output.
|
|
214
|
-
|
|
215
|
-
The output can be directed to a path with #{text_bold_italic('--output')}, which can be a file or a directory.
|
|
216
|
-
If the output path is a directory, then the filename will be the same as the input filename,
|
|
217
|
-
with it's file extension substituted with the #{text_bold_italic('--type')}.
|
|
218
|
-
|
|
219
|
-
#{text_underline('Examples')}
|
|
220
|
-
|
|
221
|
-
`lutaml project.lutaml`
|
|
222
|
-
|
|
223
|
-
Produces DOT notation, sent to standard output
|
|
224
|
-
|
|
225
|
-
`lutaml -o . project.lutaml`
|
|
226
|
-
|
|
227
|
-
Produces DOT notation, written to #{text_italic('./project.dot')}
|
|
228
|
-
|
|
229
|
-
`lutaml -o ./diagram.dot project.lutaml`
|
|
230
|
-
|
|
231
|
-
Produces DOT notation, written to #{text_italic('./diagram.dot')}
|
|
232
|
-
|
|
233
|
-
`lutaml -o ./diagram.png project.lutaml`
|
|
234
|
-
|
|
235
|
-
Produces PNG image, written to #{text_italic('./diagram.png')}
|
|
236
|
-
|
|
237
|
-
`lutaml -t png -o . project.lutaml`
|
|
238
|
-
|
|
239
|
-
Produces PNG image, written to #{text_italic('./project.png')}
|
|
240
|
-
|
|
241
|
-
`lutaml -t png -o . project.lutaml core_ext.lutaml`
|
|
242
|
-
|
|
243
|
-
Produces PNG images, written to #{text_italic('./project.png')} and #{text_italic('./core_ext.png')}
|
|
244
|
-
|
|
245
|
-
#{text_bold('Inputs:')}
|
|
246
|
-
|
|
247
|
-
#{text_underline('Lutaml')}
|
|
248
|
-
|
|
249
|
-
Lutaml dsl syntax files, supports diagram generation(image or dot files) with Graphviz
|
|
250
|
-
|
|
251
|
-
#{text_bold('Formatters:')}
|
|
252
|
-
|
|
253
|
-
#{text_underline('Graphviz')}
|
|
254
|
-
|
|
255
|
-
Generates DOT notation and can use the DOT notation to generate any format Graphviz can produce.
|
|
256
|
-
|
|
257
|
-
The output format is based on #{text_bold_italic('--type')}, which by default is "dot".
|
|
258
|
-
If #{text_bold_italic('--type')} is not given and #{text_bold_italic('--output')} is, the file extension of the #{text_bold_italic('--output')} path will be used.
|
|
259
|
-
|
|
260
|
-
Valid types/extensions are: #{Lutaml::Formatter::Graphviz::VALID_TYPES.join(', ')}
|
|
261
|
-
|
|
262
|
-
#{text_bold('Options:')}
|
|
263
|
-
|
|
264
|
-
-g, --graph VALUE The graph attributes
|
|
265
|
-
-e, --edge VALUE The edge attributes
|
|
266
|
-
-n, --node VALUE The node attributes
|
|
267
|
-
-a, --all VALUE Set attributes for graph, edge, and node
|
|
268
|
-
|
|
269
|
-
HELP
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
end
|
data/lib/lutaml/sysml/block.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Sysml
|
|
5
|
-
class Block < Lutaml::Uml::Class
|
|
6
|
-
attr_accessor :base_class
|
|
7
|
-
|
|
8
|
-
def initialize # rubocop:disable Lint/MissingSuper
|
|
9
|
-
@xmi_id = nil
|
|
10
|
-
@nested_classifier = []
|
|
11
|
-
@stereotype = []
|
|
12
|
-
@namespace = nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def name
|
|
16
|
-
if !base_class.nil? && !base_class.name.nil?
|
|
17
|
-
return base_class.name
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
nil
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def full_name
|
|
24
|
-
if !base_class.nil? && !base_class.name.nil?
|
|
25
|
-
return base_class.full_name
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
nil
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Sysml
|
|
5
|
-
class ConstraintBlock < Block
|
|
6
|
-
def initialize # rubocop:disable Lint/MissingSuper
|
|
7
|
-
@xmi_id = nil
|
|
8
|
-
@nested_classifier = []
|
|
9
|
-
@stereotype = []
|
|
10
|
-
@namespace = nil
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
data/lib/lutaml/sysml/copy.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lutaml
|
|
4
|
-
module Sysml
|
|
5
|
-
class NestedConnectorEnd < Lutaml::Uml::ConnectorEnd
|
|
6
|
-
attr_accessor :base_connectorend, :property_path
|
|
7
|
-
|
|
8
|
-
def initialize # rubocop:disable Lint/MissingSuper
|
|
9
|
-
@property_path = []
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|