lutaml 0.10.5 → 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_todo.yml +140 -6
- data/exe/lutaml +1 -0
- data/lib/lutaml/cli/interactive_shell/command_base.rb +4 -0
- data/lib/lutaml/cli/interactive_shell.rb +3 -3
- data/lib/lutaml/qea/factory/association_builder.rb +1 -0
- data/lib/lutaml/qea/factory/class_transformer.rb +4 -2
- data/lib/lutaml/qea/factory/generalization_builder.rb +2 -2
- data/lib/lutaml/uml/inheritance_walker.rb +1 -0
- data/lib/lutaml/uml/model_helpers.rb +1 -1
- data/lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb +3 -1
- data/lib/lutaml/uml_repository/exporters/markdown_exporter.rb +2 -1
- data/lib/lutaml/uml_repository/repository.rb +1 -0
- data/lib/lutaml/uml_repository/static_site/data_transformer.rb +22 -6
- data/lib/lutaml/uml_repository/static_site/generator.rb +29 -8
- data/lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb +7 -2
- data/lib/lutaml/uml_repository/static_site/serializers/diagram_serializer.rb +1 -0
- data/lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb +12 -4
- data/lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb +10 -3
- data/lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb +6 -2
- data/lib/lutaml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d14c7a5bae3898f5e06b776dd0ccd99585a31dc8e64b46399f5b72300723b74
|
|
4
|
+
data.tar.gz: 589966db805d8628b18553b40422d87897953733b39afcecbe575068f00328dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9d7775ce3d857dcc2aade2b031b290d25ed836a403b523144529504432b6c70329a7f1afcedbfbf8993456ede5503d2285e17faf43a5e56a85d7675a302ca92
|
|
7
|
+
data.tar.gz: 02aad1765ea02693cfe909e0bded8c0b39fe7590a8476ffd0afce505d3fd5757834b7fdf725bea739f7a8898a4f4d50560c3e5f7a84a241f2b0e532d4be18706
|
data/.gitignore
CHANGED
|
@@ -8,9 +8,17 @@ Gemfile.lock
|
|
|
8
8
|
# rspec failure tracking
|
|
9
9
|
.rspec_status
|
|
10
10
|
/spec/reports/
|
|
11
|
+
/spec/tmp/
|
|
11
12
|
/tmp/
|
|
12
13
|
/.yardoc
|
|
13
14
|
/_yardoc/
|
|
14
15
|
|
|
15
16
|
_site/
|
|
16
17
|
old-docs
|
|
18
|
+
|
|
19
|
+
# Editor / OS
|
|
20
|
+
.DS_Store
|
|
21
|
+
|
|
22
|
+
# Transient planning files
|
|
23
|
+
TODO.*/
|
|
24
|
+
.rubocop_todo.yml.tmp
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,11 +1,60 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-
|
|
3
|
+
# on 2026-05-06 18:53:03 UTC using RuboCop version 1.86.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
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
+
# Offense count: 8
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
12
|
+
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
13
|
+
Layout/ArgumentAlignment:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'lib/lutaml/qea/factory/generalization_builder.rb'
|
|
16
|
+
- 'lib/lutaml/uml_repository/exporters/markdown_exporter.rb'
|
|
17
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
18
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
|
|
19
|
+
|
|
20
|
+
# Offense count: 11
|
|
21
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
22
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
23
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
24
|
+
Layout/BlockAlignment:
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'lib/lutaml/qea/factory/class_transformer.rb'
|
|
27
|
+
- 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb'
|
|
28
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
|
|
29
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb'
|
|
30
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb'
|
|
31
|
+
- 'spec/lutaml/uml_repository/package_exporter_spec.rb'
|
|
32
|
+
- 'spec/lutaml/uml_repository/static_site/template_file_system_spec.rb'
|
|
33
|
+
|
|
34
|
+
# Offense count: 11
|
|
35
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
36
|
+
Layout/BlockEndNewline:
|
|
37
|
+
Exclude:
|
|
38
|
+
- 'lib/lutaml/qea/factory/class_transformer.rb'
|
|
39
|
+
- 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb'
|
|
40
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
|
|
41
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb'
|
|
42
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb'
|
|
43
|
+
- 'spec/lutaml/uml_repository/package_exporter_spec.rb'
|
|
44
|
+
- 'spec/lutaml/uml_repository/static_site/template_file_system_spec.rb'
|
|
45
|
+
|
|
46
|
+
# Offense count: 2
|
|
47
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
48
|
+
Layout/ClosingParenthesisIndentation:
|
|
49
|
+
Exclude:
|
|
50
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
51
|
+
|
|
52
|
+
# Offense count: 1
|
|
53
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
54
|
+
Layout/ElseAlignment:
|
|
55
|
+
Exclude:
|
|
56
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
57
|
+
|
|
9
58
|
# Offense count: 16
|
|
10
59
|
# This cop supports safe autocorrection (--autocorrect).
|
|
11
60
|
Layout/EmptyLineAfterGuardClause:
|
|
@@ -31,13 +80,63 @@ Layout/EmptyLinesAfterModuleInclusion:
|
|
|
31
80
|
Exclude:
|
|
32
81
|
- 'lib/lutaml/uml_repository/repository.rb'
|
|
33
82
|
|
|
34
|
-
# Offense count:
|
|
83
|
+
# Offense count: 1
|
|
84
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
85
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
86
|
+
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
|
87
|
+
Layout/EndAlignment:
|
|
88
|
+
Exclude:
|
|
89
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
90
|
+
|
|
91
|
+
# Offense count: 2
|
|
92
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
93
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
94
|
+
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
95
|
+
Layout/FirstArgumentIndentation:
|
|
96
|
+
Exclude:
|
|
97
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
98
|
+
|
|
99
|
+
# Offense count: 2
|
|
100
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
101
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
102
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
103
|
+
# SupportedColonStyles: key, separator, table
|
|
104
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
105
|
+
Layout/HashAlignment:
|
|
106
|
+
Exclude:
|
|
107
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
|
|
108
|
+
- 'spec/lutaml/uml_repository/package_exporter_spec.rb'
|
|
109
|
+
|
|
110
|
+
# Offense count: 24
|
|
111
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
112
|
+
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
113
|
+
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
114
|
+
Layout/IndentationWidth:
|
|
115
|
+
Exclude:
|
|
116
|
+
- 'lib/lutaml/qea/factory/class_transformer.rb'
|
|
117
|
+
- 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb'
|
|
118
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
119
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
|
|
120
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb'
|
|
121
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb'
|
|
122
|
+
- 'spec/lutaml/uml_repository/package_exporter_spec.rb'
|
|
123
|
+
- 'spec/lutaml/uml_repository/static_site/template_file_system_spec.rb'
|
|
124
|
+
|
|
125
|
+
# Offense count: 192
|
|
35
126
|
# This cop supports safe autocorrection (--autocorrect).
|
|
36
127
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
37
128
|
# URISchemes: http, https
|
|
38
129
|
Layout/LineLength:
|
|
39
130
|
Enabled: false
|
|
40
131
|
|
|
132
|
+
# Offense count: 1
|
|
133
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
134
|
+
# Configuration parameters: EnforcedStyle.
|
|
135
|
+
# SupportedStyles: symmetrical, new_line, same_line
|
|
136
|
+
Layout/MultilineMethodCallBraceLayout:
|
|
137
|
+
Exclude:
|
|
138
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
139
|
+
|
|
41
140
|
# Offense count: 2
|
|
42
141
|
# This cop supports safe autocorrection (--autocorrect).
|
|
43
142
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
|
@@ -47,6 +146,18 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
|
47
146
|
Exclude:
|
|
48
147
|
- 'lib/lutaml/uml/model_helpers.rb'
|
|
49
148
|
|
|
149
|
+
# Offense count: 11
|
|
150
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
151
|
+
# Configuration parameters: AllowInHeredoc.
|
|
152
|
+
Layout/TrailingWhitespace:
|
|
153
|
+
Exclude:
|
|
154
|
+
- 'lib/lutaml/qea/factory/generalization_builder.rb'
|
|
155
|
+
- 'lib/lutaml/uml_repository/exporters/markdown_exporter.rb'
|
|
156
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
157
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb'
|
|
158
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
|
|
159
|
+
- 'spec/lutaml/uml_repository/package_exporter_spec.rb'
|
|
160
|
+
|
|
50
161
|
# Offense count: 1
|
|
51
162
|
Lint/BinaryOperatorWithIdenticalOperands:
|
|
52
163
|
Exclude:
|
|
@@ -118,7 +229,7 @@ Lint/UselessConstantScoping:
|
|
|
118
229
|
Exclude:
|
|
119
230
|
- 'lib/lutaml/cli/interactive_shell.rb'
|
|
120
231
|
|
|
121
|
-
# Offense count:
|
|
232
|
+
# Offense count: 51
|
|
122
233
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
123
234
|
Metrics/AbcSize:
|
|
124
235
|
Enabled: false
|
|
@@ -134,7 +245,7 @@ Metrics/BlockLength:
|
|
|
134
245
|
Metrics/CyclomaticComplexity:
|
|
135
246
|
Enabled: false
|
|
136
247
|
|
|
137
|
-
# Offense count:
|
|
248
|
+
# Offense count: 66
|
|
138
249
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
139
250
|
Metrics/MethodLength:
|
|
140
251
|
Max: 62
|
|
@@ -209,7 +320,7 @@ RSpec/ContextWording:
|
|
|
209
320
|
RSpec/DescribeClass:
|
|
210
321
|
Enabled: false
|
|
211
322
|
|
|
212
|
-
# Offense count:
|
|
323
|
+
# Offense count: 651
|
|
213
324
|
# Configuration parameters: CountAsOne.
|
|
214
325
|
RSpec/ExampleLength:
|
|
215
326
|
Max: 30
|
|
@@ -263,7 +374,7 @@ RSpec/MessageSpies:
|
|
|
263
374
|
- 'spec/lutaml/uml_repository/presenters/diagram_presenter_spec.rb'
|
|
264
375
|
- 'spec/lutaml/uml_repository/repository_spec.rb'
|
|
265
376
|
|
|
266
|
-
# Offense count:
|
|
377
|
+
# Offense count: 37
|
|
267
378
|
RSpec/MultipleExpectations:
|
|
268
379
|
Max: 6
|
|
269
380
|
|
|
@@ -319,6 +430,23 @@ Security/MarshalLoad:
|
|
|
319
430
|
Exclude:
|
|
320
431
|
- 'lib/lutaml/uml_repository/package_loader.rb'
|
|
321
432
|
|
|
433
|
+
# Offense count: 15
|
|
434
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
435
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
436
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
437
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
438
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
439
|
+
# AllowedMethods: lambda, proc, it
|
|
440
|
+
Style/BlockDelimiters:
|
|
441
|
+
Exclude:
|
|
442
|
+
- 'lib/lutaml/qea/factory/class_transformer.rb'
|
|
443
|
+
- 'lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb'
|
|
444
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb'
|
|
445
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb'
|
|
446
|
+
- 'lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb'
|
|
447
|
+
- 'spec/lutaml/uml_repository/package_exporter_spec.rb'
|
|
448
|
+
- 'spec/lutaml/uml_repository/static_site/template_file_system_spec.rb'
|
|
449
|
+
|
|
322
450
|
# Offense count: 2
|
|
323
451
|
# This cop supports safe autocorrection (--autocorrect).
|
|
324
452
|
Style/ComparableClamp:
|
|
@@ -336,6 +464,12 @@ Style/EvalWithLocation:
|
|
|
336
464
|
Exclude:
|
|
337
465
|
- 'spec/lutaml/cli/uml/search_command_spec.rb'
|
|
338
466
|
|
|
467
|
+
# Offense count: 1
|
|
468
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
469
|
+
Style/MultilineTernaryOperator:
|
|
470
|
+
Exclude:
|
|
471
|
+
- 'lib/lutaml/uml_repository/static_site/data_transformer.rb'
|
|
472
|
+
|
|
339
473
|
# Offense count: 1
|
|
340
474
|
# This cop supports safe autocorrection (--autocorrect).
|
|
341
475
|
# Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
|
data/exe/lutaml
CHANGED
|
@@ -12,15 +12,19 @@ module Lutaml
|
|
|
12
12
|
|
|
13
13
|
def repository = shell.repository
|
|
14
14
|
def current_path = shell.current_path
|
|
15
|
+
|
|
15
16
|
def current_path=(path)
|
|
16
17
|
shell.instance_variable_set(:@current_path, path)
|
|
17
18
|
end
|
|
19
|
+
|
|
18
20
|
def config = shell.config
|
|
19
21
|
def bookmarks = shell.bookmarks
|
|
20
22
|
def last_results = shell.last_results
|
|
23
|
+
|
|
21
24
|
def last_results=(results)
|
|
22
25
|
shell.instance_variable_set(:@last_results, results)
|
|
23
26
|
end
|
|
27
|
+
|
|
24
28
|
def path_history = shell.path_history
|
|
25
29
|
end
|
|
26
30
|
end
|
|
@@ -101,7 +101,7 @@ module Lutaml
|
|
|
101
101
|
"history" => :@help,
|
|
102
102
|
"clear" => :@help, "cls" => :@help,
|
|
103
103
|
"config" => :@help,
|
|
104
|
-
"stats" => :@help
|
|
104
|
+
"stats" => :@help
|
|
105
105
|
}.freeze
|
|
106
106
|
|
|
107
107
|
METHOD_MAP = {
|
|
@@ -119,7 +119,7 @@ module Lutaml
|
|
|
119
119
|
"history" => :cmd_history,
|
|
120
120
|
"clear" => :cmd_clear, "cls" => :cmd_clear,
|
|
121
121
|
"config" => :cmd_config,
|
|
122
|
-
"stats" => :cmd_stats
|
|
122
|
+
"stats" => :cmd_stats
|
|
123
123
|
}.freeze
|
|
124
124
|
|
|
125
125
|
def execute_command(input)
|
|
@@ -127,7 +127,7 @@ module Lutaml
|
|
|
127
127
|
command = parts[0].downcase
|
|
128
128
|
args = parts[1..]
|
|
129
129
|
|
|
130
|
-
if
|
|
130
|
+
if ["exit", "quit", "q"].include?(command)
|
|
131
131
|
@running = false
|
|
132
132
|
return
|
|
133
133
|
end
|
|
@@ -60,7 +60,7 @@ module Lutaml
|
|
|
60
60
|
.load_association_generalizations(ea_object.ea_object_id)
|
|
61
61
|
|
|
62
62
|
klass.associations = assoc_builder.load_class_associations(
|
|
63
|
-
ea_object.ea_object_id, ea_object.ea_guid
|
|
63
|
+
ea_object.ea_object_id, ea_object.ea_guid
|
|
64
64
|
)
|
|
65
65
|
end
|
|
66
66
|
end
|
|
@@ -116,7 +116,9 @@ module Lutaml
|
|
|
116
116
|
return [] if ea_guid.nil?
|
|
117
117
|
return [] unless database.tagged_values
|
|
118
118
|
|
|
119
|
-
ea_tags = database.tagged_values.select
|
|
119
|
+
ea_tags = database.tagged_values.select do |tag|
|
|
120
|
+
tag.element_id == ea_guid
|
|
121
|
+
end
|
|
120
122
|
TaggedValueTransformer.new(database).transform_collection(ea_tags)
|
|
121
123
|
end
|
|
122
124
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "set"
|
|
4
3
|
require_relative "base_transformer"
|
|
5
4
|
require_relative "attribute_transformer"
|
|
6
5
|
require_relative "generalization_transformer"
|
|
@@ -31,7 +30,8 @@ module Lutaml
|
|
|
31
30
|
generalization = if ea_connector.nil?
|
|
32
31
|
gen_transformer.transform(nil, current_obj)
|
|
33
32
|
else
|
|
34
|
-
gen_transformer.transform(ea_connector,
|
|
33
|
+
gen_transformer.transform(ea_connector,
|
|
34
|
+
current_obj)
|
|
35
35
|
end
|
|
36
36
|
return nil unless generalization
|
|
37
37
|
|
|
@@ -49,7 +49,9 @@ module Lutaml
|
|
|
49
49
|
stereotypes_array = normalize_stereotypes(klass.stereotype)
|
|
50
50
|
return "" if stereotypes_array.empty?
|
|
51
51
|
|
|
52
|
-
"**Stereotypes**: #{stereotypes_array.map
|
|
52
|
+
"**Stereotypes**: #{stereotypes_array.map do |s|
|
|
53
|
+
"`#{s}`"
|
|
54
|
+
end.join(', ')}\n\n"
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
def build_definition_section(klass)
|
|
@@ -41,7 +41,8 @@ module Lutaml
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def generate_index_page
|
|
44
|
-
content = Markdown::IndexPageBuilder.new(repository, options,
|
|
44
|
+
content = Markdown::IndexPageBuilder.new(repository, options,
|
|
45
|
+
link_resolver).build
|
|
45
46
|
File.write(File.join(output_dir, "index.md"), content)
|
|
46
47
|
end
|
|
47
48
|
|
|
@@ -32,13 +32,24 @@ module Lutaml
|
|
|
32
32
|
def transform
|
|
33
33
|
{
|
|
34
34
|
metadata: Serializers::MetadataBuilder.new(repository).build,
|
|
35
|
-
packageTree: Serializers::PackageTreeBuilder.new(repository,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
packageTree: Serializers::PackageTreeBuilder.new(repository,
|
|
36
|
+
id_generator).build,
|
|
37
|
+
packages: Serializers::PackageSerializer.new(repository,
|
|
38
|
+
id_generator, options).build_map,
|
|
39
|
+
classes: Serializers::ClassSerializer.new(repository, id_generator,
|
|
40
|
+
options, inheritance_resolver).build_map,
|
|
41
|
+
attributes: Serializers::AttributeSerializer.new(repository,
|
|
42
|
+
id_generator, options).build_map,
|
|
39
43
|
associations: build_associations_map,
|
|
40
|
-
operations: Serializers::OperationSerializer.new(repository,
|
|
41
|
-
|
|
44
|
+
operations: Serializers::OperationSerializer.new(repository,
|
|
45
|
+
id_generator).build_map,
|
|
46
|
+
diagrams: (if options[:include_diagrams]
|
|
47
|
+
Serializers::DiagramSerializer.new(
|
|
48
|
+
repository, id_generator, options
|
|
49
|
+
).build_map
|
|
50
|
+
else
|
|
51
|
+
{}
|
|
52
|
+
end),
|
|
42
53
|
}
|
|
43
54
|
end
|
|
44
55
|
|
|
@@ -69,12 +80,14 @@ module Lutaml
|
|
|
69
80
|
|
|
70
81
|
klass.association_generalization.each do |assoc_gen|
|
|
71
82
|
next unless assoc_gen.respond_to?(:parent_object_id)
|
|
83
|
+
|
|
72
84
|
parent_object_id = assoc_gen.parent_object_id
|
|
73
85
|
next unless parent_object_id
|
|
74
86
|
|
|
75
87
|
parent_class = class_lookup.by_object_id(parent_object_id)
|
|
76
88
|
if parent_class&.xmi_id
|
|
77
89
|
next if parent_class.xmi_id == klass.xmi_id
|
|
90
|
+
|
|
78
91
|
unless map[klass.xmi_id].include?(parent_class.xmi_id)
|
|
79
92
|
map[klass.xmi_id] << parent_class.xmi_id
|
|
80
93
|
end
|
|
@@ -91,6 +104,7 @@ module Lutaml
|
|
|
91
104
|
|
|
92
105
|
def find_class_by_xmi_id(xmi_id)
|
|
93
106
|
return nil unless xmi_id
|
|
107
|
+
|
|
94
108
|
class_lookup.by_xmi_id(xmi_id)
|
|
95
109
|
rescue StandardError
|
|
96
110
|
nil
|
|
@@ -98,6 +112,7 @@ module Lutaml
|
|
|
98
112
|
|
|
99
113
|
def find_class_by_object_id(object_id)
|
|
100
114
|
return nil unless object_id
|
|
115
|
+
|
|
101
116
|
class_lookup.by_object_id(object_id)
|
|
102
117
|
rescue StandardError
|
|
103
118
|
nil
|
|
@@ -114,6 +129,7 @@ module Lutaml
|
|
|
114
129
|
|
|
115
130
|
def format_definition(definition)
|
|
116
131
|
return nil if definition.nil? || definition.empty?
|
|
132
|
+
|
|
117
133
|
formatted = definition.strip
|
|
118
134
|
if @options[:max_definition_length] &&
|
|
119
135
|
formatted.length > @options[:max_definition_length]
|
|
@@ -11,6 +11,27 @@ require_relative "id_generator"
|
|
|
11
11
|
module Lutaml
|
|
12
12
|
module UmlRepository
|
|
13
13
|
module StaticSite
|
|
14
|
+
# Resolves Liquid {% include %} paths to template files on disk.
|
|
15
|
+
# Unlike LocalFileSystem (which adds a "_" prefix), this resolves
|
|
16
|
+
# paths directly: "components/header" → "<root>/components/header.liquid"
|
|
17
|
+
class TemplateFileSystem
|
|
18
|
+
attr_reader :root
|
|
19
|
+
|
|
20
|
+
def initialize(root)
|
|
21
|
+
@root = root
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def read_template_file(template_path)
|
|
25
|
+
full = File.expand_path("#{template_path}.liquid", @root)
|
|
26
|
+
unless full.start_with?(@root)
|
|
27
|
+
raise Liquid::FileSystemError,
|
|
28
|
+
"Illegal template path: #{template_path}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
File.read(full)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
14
35
|
# Main static site generator for LutaML UML Browser.
|
|
15
36
|
#
|
|
16
37
|
# Follows Dependency Inversion Principle by injecting dependencies
|
|
@@ -163,12 +184,9 @@ module Lutaml
|
|
|
163
184
|
end
|
|
164
185
|
|
|
165
186
|
def setup_liquid
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# Changed from :strict to handle missing includes
|
|
170
|
-
environment.error_mode = :lax
|
|
171
|
-
@liquid_environment = environment
|
|
187
|
+
@liquid_environment = Liquid::Environment.new
|
|
188
|
+
@liquid_environment.file_system = TemplateFileSystem.new(@options[:template_path])
|
|
189
|
+
@liquid_environment.error_mode = :lax
|
|
172
190
|
end
|
|
173
191
|
|
|
174
192
|
# Generate single-file SPA
|
|
@@ -226,7 +244,7 @@ module Lutaml
|
|
|
226
244
|
|
|
227
245
|
def render_components # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
228
246
|
# Set up Liquid file system for recursive includes
|
|
229
|
-
temp_file_system =
|
|
247
|
+
temp_file_system = TemplateFileSystem.new(@options[:template_path])
|
|
230
248
|
|
|
231
249
|
component_names = ["header", "sidebar", "content", "package_details",
|
|
232
250
|
"class_details"]
|
|
@@ -274,7 +292,10 @@ module Lutaml
|
|
|
274
292
|
# Render and write index.html
|
|
275
293
|
template_content = File.read(File.join(@options[:template_path],
|
|
276
294
|
"multi_file.liquid"))
|
|
277
|
-
|
|
295
|
+
file_system = TemplateFileSystem.new(@options[:template_path])
|
|
296
|
+
template = Liquid::Template.parse(template_content,
|
|
297
|
+
error_mode: :lax)
|
|
298
|
+
template.registers[:file_system] = file_system
|
|
278
299
|
html = template.render(context)
|
|
279
300
|
html = minify_html(html) if @options[:minify]
|
|
280
301
|
File.write(File.join(output_dir, "index.html"), html)
|
|
@@ -9,7 +9,8 @@ module Lutaml
|
|
|
9
9
|
class ClassSerializer
|
|
10
10
|
include Lutaml::Uml::ModelHelpers
|
|
11
11
|
|
|
12
|
-
def initialize(repository, id_generator, options,
|
|
12
|
+
def initialize(repository, id_generator, options,
|
|
13
|
+
inheritance_resolver)
|
|
13
14
|
@repository = repository
|
|
14
15
|
@id_generator = id_generator
|
|
15
16
|
@options = options
|
|
@@ -81,6 +82,7 @@ module Lutaml
|
|
|
81
82
|
|
|
82
83
|
def serialize_class_operations(klass)
|
|
83
84
|
return [] unless klass.respond_to?(:operations) && klass.operations
|
|
85
|
+
|
|
84
86
|
klass.operations.map { |op| @id_generator.operation_id(op, klass) }
|
|
85
87
|
end
|
|
86
88
|
|
|
@@ -88,7 +90,8 @@ module Lutaml
|
|
|
88
90
|
return [] unless klass.is_a?(Lutaml::Uml::Enum) && klass.owned_literal
|
|
89
91
|
|
|
90
92
|
klass.owned_literal.map do |literal|
|
|
91
|
-
{ name: literal.name,
|
|
93
|
+
{ name: literal.name,
|
|
94
|
+
definition: format_definition(literal.definition) }
|
|
92
95
|
end
|
|
93
96
|
rescue StandardError
|
|
94
97
|
[]
|
|
@@ -97,11 +100,13 @@ module Lutaml
|
|
|
97
100
|
def package_id_for_class(klass)
|
|
98
101
|
ns = klass.respond_to?(:namespace) ? klass.namespace : nil
|
|
99
102
|
return nil unless ns.is_a?(Lutaml::Uml::Package)
|
|
103
|
+
|
|
100
104
|
@id_generator.package_id(ns)
|
|
101
105
|
end
|
|
102
106
|
|
|
103
107
|
def format_definition(definition)
|
|
104
108
|
return nil if definition.nil? || definition.empty?
|
|
109
|
+
|
|
105
110
|
formatted = definition.strip
|
|
106
111
|
if @options[:max_definition_length] &&
|
|
107
112
|
formatted.length > @options[:max_definition_length]
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "set"
|
|
4
3
|
require_relative "../../../uml/model_helpers"
|
|
5
4
|
require_relative "../../class_lookup_index"
|
|
6
5
|
|
|
@@ -24,6 +23,7 @@ module Lutaml
|
|
|
24
23
|
if parent_xmi_ids && !parent_xmi_ids.empty?
|
|
25
24
|
parents = parent_xmi_ids.filter_map do |parent_xmi_id|
|
|
26
25
|
next if parent_xmi_id == klass.xmi_id
|
|
26
|
+
|
|
27
27
|
parent = class_lookup.by_xmi_id(parent_xmi_id)
|
|
28
28
|
parent ? @id_generator.class_id(parent) : nil
|
|
29
29
|
end
|
|
@@ -32,6 +32,7 @@ module Lutaml
|
|
|
32
32
|
|
|
33
33
|
parent = @repository.supertype_of(klass)
|
|
34
34
|
return [] if parent && parent.xmi_id == klass.xmi_id
|
|
35
|
+
|
|
35
36
|
parent ? [@id_generator.class_id(parent)] : []
|
|
36
37
|
rescue StandardError => e
|
|
37
38
|
warn "Error finding generalizations for #{klass.name}: #{e.message}"
|
|
@@ -65,7 +66,9 @@ module Lutaml
|
|
|
65
66
|
visited.add(parent_class.xmi_id)
|
|
66
67
|
|
|
67
68
|
if parent_class.attributes
|
|
68
|
-
sorted_attrs = parent_class.attributes.sort_by
|
|
69
|
+
sorted_attrs = parent_class.attributes.sort_by do |a|
|
|
70
|
+
a.name || ""
|
|
71
|
+
end
|
|
69
72
|
sorted_attrs.each do |attr|
|
|
70
73
|
attr_id = @id_generator.attribute_id(attr, parent_class)
|
|
71
74
|
inherited << {
|
|
@@ -164,7 +167,8 @@ module Lutaml
|
|
|
164
167
|
ownedProps: serialize_general_attrs(gen, :owned_props),
|
|
165
168
|
assocProps: serialize_general_attrs(gen, :assoc_props),
|
|
166
169
|
inheritedProps: serialize_general_attrs(gen, :inherited_props),
|
|
167
|
-
inheritedAssocProps: serialize_general_attrs(gen,
|
|
170
|
+
inheritedAssocProps: serialize_general_attrs(gen,
|
|
171
|
+
:inherited_assoc_props),
|
|
168
172
|
}
|
|
169
173
|
rescue StandardError => e
|
|
170
174
|
warn "Error serializing generalization: #{e.message}"
|
|
@@ -219,7 +223,10 @@ module Lutaml
|
|
|
219
223
|
|
|
220
224
|
def serialize_general_attrs(gen, method)
|
|
221
225
|
return [] unless gen.respond_to?(method)
|
|
222
|
-
|
|
226
|
+
|
|
227
|
+
(gen.send(method) || []).map do |attr|
|
|
228
|
+
serialize_general_attribute(attr)
|
|
229
|
+
end
|
|
223
230
|
end
|
|
224
231
|
|
|
225
232
|
def serialize_cardinality(cardinality)
|
|
@@ -233,6 +240,7 @@ module Lutaml
|
|
|
233
240
|
|
|
234
241
|
def format_definition(definition)
|
|
235
242
|
return nil if definition.nil? || definition.empty?
|
|
243
|
+
|
|
236
244
|
formatted = definition.strip
|
|
237
245
|
if @options[:max_definition_length] &&
|
|
238
246
|
formatted.length > @options[:max_definition_length]
|
|
@@ -38,9 +38,15 @@ module Lutaml
|
|
|
38
38
|
stereotypes: normalize_stereotypes(
|
|
39
39
|
package.respond_to?(:stereotype) ? package.stereotype : nil,
|
|
40
40
|
),
|
|
41
|
-
classes: (package.classes || []).map
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
classes: (package.classes || []).map do |c|
|
|
42
|
+
@id_generator.class_id(c)
|
|
43
|
+
end,
|
|
44
|
+
subPackages: (package.packages || []).map do |p|
|
|
45
|
+
@id_generator.package_id(p)
|
|
46
|
+
end,
|
|
47
|
+
diagrams: package_diagrams(package).map do |d|
|
|
48
|
+
@id_generator.diagram_id(d)
|
|
49
|
+
end,
|
|
44
50
|
parent: if package.respond_to?(:namespace) &&
|
|
45
51
|
package.namespace.is_a?(Lutaml::Uml::Package)
|
|
46
52
|
@id_generator.package_id(package.namespace)
|
|
@@ -59,6 +65,7 @@ module Lutaml
|
|
|
59
65
|
|
|
60
66
|
def package_diagrams(package)
|
|
61
67
|
return [] unless @options[:include_diagrams]
|
|
68
|
+
|
|
62
69
|
package.diagrams || []
|
|
63
70
|
rescue StandardError => e
|
|
64
71
|
warn "Error getting diagrams for #{package.name}: #{e.message}"
|
|
@@ -44,14 +44,18 @@ module Lutaml
|
|
|
44
44
|
def build_tree_node(package) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
45
45
|
pkg_id = @id_generator.package_id(package)
|
|
46
46
|
|
|
47
|
-
sorted_children = (package.packages || []).sort_by
|
|
47
|
+
sorted_children = (package.packages || []).sort_by do |p|
|
|
48
|
+
p.name || ""
|
|
49
|
+
end
|
|
48
50
|
sorted_classes = (package.classes || [])
|
|
49
51
|
.reject { |c| c.name.nil? || c.name.empty? }
|
|
50
52
|
.sort_by(&:name)
|
|
51
53
|
|
|
52
54
|
child_nodes = sorted_children.map { |child| build_tree_node(child) }
|
|
53
55
|
|
|
54
|
-
total_class_count = sorted_classes.size + child_nodes.sum
|
|
56
|
+
total_class_count = sorted_classes.size + child_nodes.sum do |c|
|
|
57
|
+
c[:classCount] || 0
|
|
58
|
+
end
|
|
55
59
|
|
|
56
60
|
{
|
|
57
61
|
id: pkg_id,
|
data/lib/lutaml/version.rb
CHANGED
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
|