lutaml-uml 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +36 -0
  3. data/.github/workflows/ubuntu.yml +38 -0
  4. data/.github/workflows/windows.yml +41 -0
  5. data/.gitignore +1 -0
  6. data/Gemfile +2 -1
  7. data/LUTAML.adoc +314 -0
  8. data/{README.md → README.adoc} +15 -16
  9. data/Rakefile +3 -1
  10. data/bin/console +1 -0
  11. data/bin/lutaml2dotpng +23 -0
  12. data/bin/yaml2lutaml +108 -0
  13. data/exe/lutaml-uml +4 -3
  14. data/lib/lutaml/layout/engine.rb +15 -0
  15. data/lib/lutaml/layout/graph_viz_engine.rb +16 -0
  16. data/lib/lutaml/uml.rb +3 -0
  17. data/lib/lutaml/uml/abstraction.rb +7 -5
  18. data/lib/lutaml/uml/activity.rb +7 -5
  19. data/lib/lutaml/uml/actor.rb +14 -12
  20. data/lib/lutaml/uml/association.rb +40 -14
  21. data/lib/lutaml/uml/behavior.rb +7 -5
  22. data/lib/lutaml/uml/class.rb +56 -16
  23. data/lib/lutaml/uml/classifier.rb +9 -6
  24. data/lib/lutaml/uml/connector.rb +16 -12
  25. data/lib/lutaml/uml/constraint.rb +8 -7
  26. data/lib/lutaml/uml/constructor_end.rb +11 -8
  27. data/lib/lutaml/uml/data_type.rb +9 -4
  28. data/lib/lutaml/uml/dependency.rb +16 -13
  29. data/lib/lutaml/uml/document.rb +71 -0
  30. data/lib/lutaml/uml/enum.rb +33 -0
  31. data/lib/lutaml/uml/event.rb +7 -5
  32. data/lib/lutaml/uml/final_state.rb +7 -5
  33. data/lib/lutaml/uml/formatter.rb +21 -0
  34. data/lib/lutaml/uml/formatter/base.rb +67 -0
  35. data/lib/lutaml/uml/formatter/graphviz.rb +335 -0
  36. data/lib/lutaml/uml/has_attributes.rb +14 -0
  37. data/lib/lutaml/uml/has_members.rb +30 -0
  38. data/lib/lutaml/uml/instance.rb +15 -10
  39. data/lib/lutaml/uml/interface/base.rb +28 -0
  40. data/lib/lutaml/uml/interface/command_line.rb +265 -0
  41. data/lib/lutaml/uml/model.rb +11 -8
  42. data/lib/lutaml/uml/node/base.rb +21 -0
  43. data/lib/lutaml/uml/node/class_node.rb +57 -0
  44. data/lib/lutaml/uml/node/class_relationship.rb +14 -0
  45. data/lib/lutaml/uml/node/document.rb +18 -0
  46. data/lib/lutaml/uml/node/field.rb +34 -0
  47. data/lib/lutaml/uml/node/has_name.rb +15 -0
  48. data/lib/lutaml/uml/node/has_type.rb +15 -0
  49. data/lib/lutaml/uml/node/method.rb +29 -0
  50. data/lib/lutaml/uml/node/method_argument.rb +16 -0
  51. data/lib/lutaml/uml/node/relationship.rb +28 -0
  52. data/lib/lutaml/uml/opaque_behavior.rb +7 -6
  53. data/lib/lutaml/uml/package.rb +16 -13
  54. data/lib/lutaml/uml/parsers/attribute.rb +70 -0
  55. data/lib/lutaml/uml/parsers/dsl.rb +375 -0
  56. data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +44 -0
  57. data/lib/lutaml/uml/parsers/dsl_transform.rb +27 -0
  58. data/lib/lutaml/uml/parsers/yaml.rb +46 -0
  59. data/lib/lutaml/uml/port.rb +6 -4
  60. data/lib/lutaml/uml/primitive_type.rb +9 -4
  61. data/lib/lutaml/uml/property.rb +25 -15
  62. data/lib/lutaml/uml/pseudostate.rb +7 -6
  63. data/lib/lutaml/uml/realization.rb +7 -5
  64. data/lib/lutaml/uml/region.rb +7 -6
  65. data/lib/lutaml/uml/serializers/association.rb +58 -0
  66. data/lib/lutaml/uml/serializers/base.rb +16 -0
  67. data/lib/lutaml/uml/serializers/class.rb +29 -0
  68. data/lib/lutaml/uml/serializers/top_element_attribute.rb +14 -0
  69. data/lib/lutaml/uml/serializers/yaml_view.rb +18 -0
  70. data/lib/lutaml/uml/state.rb +8 -6
  71. data/lib/lutaml/uml/state_machine.rb +7 -5
  72. data/lib/lutaml/uml/top_element.rb +45 -35
  73. data/lib/lutaml/uml/top_element_attribute.rb +25 -0
  74. data/lib/lutaml/uml/transition.rb +8 -6
  75. data/lib/lutaml/uml/trigger.rb +8 -6
  76. data/lib/lutaml/uml/version.rb +3 -1
  77. data/lib/lutaml/uml/vertex.rb +7 -5
  78. data/lutaml-uml.gemspec +9 -2
  79. data/spec/fixtures/datamodel/models/AddressClassProfile.yml +90 -0
  80. data/spec/fixtures/datamodel/models/AddressComponentProfile.yml +63 -0
  81. data/spec/fixtures/datamodel/models/AddressComponentSpecification.yml +15 -0
  82. data/spec/fixtures/datamodel/models/AddressProfile.yml +36 -0
  83. data/spec/fixtures/datamodel/models/AttributeProfile.yml +32 -0
  84. data/spec/fixtures/datamodel/models/InterchangeAddressClassProfile.yml +79 -0
  85. data/spec/fixtures/datamodel/models/Localization copy.yml +23 -0
  86. data/spec/fixtures/datamodel/models/Localization.yml +23 -0
  87. data/spec/fixtures/datamodel/models/ProfileCompliantAddress.yml +36 -0
  88. data/spec/fixtures/datamodel/models/ProfileCompliantAddressComponent.yml +15 -0
  89. data/spec/fixtures/datamodel/models/Signature.yml +20 -0
  90. data/spec/fixtures/datamodel/models/SignatureBlankDefinition.yml +20 -0
  91. data/spec/fixtures/datamodel/models/TextDirectionCode copy.yml +16 -0
  92. data/spec/fixtures/datamodel/models/TextDirectionCode.yml +16 -0
  93. data/spec/fixtures/datamodel/models/Validity.yml +14 -0
  94. data/spec/fixtures/datamodel/models/iso19160-1/Address.yml +22 -0
  95. data/spec/fixtures/datamodel/models/iso19160-1/AddressComponent.yml +2 -0
  96. data/spec/fixtures/datamodel/style.uml.inc +37 -0
  97. data/spec/fixtures/datamodel/views/AddressClassProfile.yml +12 -0
  98. data/spec/fixtures/datamodel/views/AddressProfile.yml +3 -0
  99. data/spec/fixtures/datamodel/views/CommonModels.yml +9 -0
  100. data/spec/fixtures/datamodel/views/TopDown.yml +62 -0
  101. data/spec/fixtures/dsl/diagram.lutaml +3 -0
  102. data/spec/fixtures/dsl/diagram_attributes.lutaml +5 -0
  103. data/spec/fixtures/dsl/diagram_class_assocation.lutaml +29 -0
  104. data/spec/fixtures/dsl/diagram_class_fields.lutaml +19 -0
  105. data/spec/fixtures/dsl/diagram_comments.lutaml +28 -0
  106. data/spec/fixtures/dsl/diagram_concept_model.lutaml +132 -0
  107. data/spec/fixtures/dsl/diagram_data_types.lutaml +24 -0
  108. data/spec/fixtures/dsl/diagram_includes.lutaml +6 -0
  109. data/spec/fixtures/dsl/diagram_multiply_classes.lutaml +7 -0
  110. data/spec/fixtures/dsl/shared.lutaml +3 -0
  111. data/spec/fixtures/dsl/shared1.lutaml +4 -0
  112. data/spec/fixtures/generated_dot/AddressClassProfile.dot +170 -0
  113. data/spec/fixtures/generated_dot/AddressProfile.dot +34 -0
  114. data/spec/lutaml/uml/formatter/graphviz_spec.rb +41 -0
  115. data/spec/lutaml/uml/parsers/dsl_spec.rb +252 -0
  116. data/spec/lutaml/uml/parsers/yaml_spec.rb +18 -0
  117. data/spec/lutaml/uml/serializers/yaml_view_spec.rb +20 -0
  118. data/spec/lutaml/uml_spec.rb +2 -4
  119. data/spec/spec_helper.rb +11 -0
  120. metadata +161 -13
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Lutaml::Uml::Parsers::Yaml do
6
+ describe ".parse" do
7
+ subject(:parse) { described_class.parse(yaml_conent) }
8
+
9
+ let(:yaml_conent) do
10
+ fixtures_path("datamodel/views/TopDown.yml")
11
+ end
12
+
13
+ it "creates Lutaml::Uml::Document object from yaml" do
14
+ expect(parse).to be_instance_of(Lutaml::Uml::Document)
15
+ expect(parse.classes.first).to be_instance_of(Lutaml::Uml::Class)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+ require "lutaml/uml/serializers/yaml_view"
5
+
6
+ RSpec.describe Lutaml::Uml::Serializers::YamlView do
7
+ describe "#new" do
8
+ subject(:serialize) { described_class.new(yaml_content) }
9
+
10
+ let(:yaml_content) do
11
+ YAML.safe_load(File.read(fixtures_path("datamodel/views/TopDown.yml")))
12
+ end
13
+
14
+ it "Correctly parses passed yaml file" do
15
+ expect(serialize.name).to eq(yaml_content["name"])
16
+ expect(serialize.title).to eq(yaml_content["title"])
17
+ expect(serialize.caption).to eq(yaml_content["caption"])
18
+ end
19
+ end
20
+ end
@@ -1,9 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Lutaml::Uml do
2
4
  it "has a version number" do
3
5
  expect(Lutaml::Uml::VERSION).not_to be nil
4
6
  end
5
-
6
- it "does something useful" do
7
- expect(false).to eq(true)
8
- end
9
7
  end
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/setup"
2
4
  require "lutaml/uml"
5
+ require "byebug"
3
6
 
4
7
  RSpec.configure do |config|
5
8
  # Enable flags like --only-failures and --next-failure
@@ -12,3 +15,11 @@ RSpec.configure do |config|
12
15
  c.syntax = :expect
13
16
  end
14
17
  end
18
+
19
+ def fixtures_path(path)
20
+ File.join(File.expand_path("./fixtures", __dir__), path)
21
+ end
22
+
23
+ def by_name(entries, name)
24
+ entries.detect { |n| n.name == name }
25
+ end
metadata CHANGED
@@ -1,43 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-uml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-19 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: thor
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: 4.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: 4.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: parslet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.7.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.7.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-graphviz
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
41
97
  - !ruby/object:Gem::Dependency
42
98
  name: nokogiri
43
99
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +108,20 @@ dependencies:
52
108
  - - "~>"
53
109
  - !ruby/object:Gem::Version
54
110
  version: '1.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.54.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.54.0
55
125
  - !ruby/object:Gem::Dependency
56
126
  name: bundler
57
127
  requirement: !ruby/object:Gem::Requirement
@@ -116,16 +186,25 @@ executables:
116
186
  extensions: []
117
187
  extra_rdoc_files: []
118
188
  files:
189
+ - ".github/workflows/macos.yml"
190
+ - ".github/workflows/ubuntu.yml"
191
+ - ".github/workflows/windows.yml"
119
192
  - ".gitignore"
120
193
  - ".rspec"
121
194
  - ".travis.yml"
122
195
  - CODE_OF_CONDUCT.md
123
196
  - Gemfile
124
- - README.md
197
+ - Gemfile.lock
198
+ - LUTAML.adoc
199
+ - README.adoc
125
200
  - Rakefile
126
201
  - bin/console
202
+ - bin/lutaml2dotpng
127
203
  - bin/setup
204
+ - bin/yaml2lutaml
128
205
  - exe/lutaml-uml
206
+ - lib/lutaml/layout/engine.rb
207
+ - lib/lutaml/layout/graph_viz_engine.rb
129
208
  - lib/lutaml/uml.rb
130
209
  - lib/lutaml/uml/abstraction.rb
131
210
  - lib/lutaml/uml/activity.rb
@@ -139,26 +218,95 @@ files:
139
218
  - lib/lutaml/uml/constructor_end.rb
140
219
  - lib/lutaml/uml/data_type.rb
141
220
  - lib/lutaml/uml/dependency.rb
221
+ - lib/lutaml/uml/document.rb
222
+ - lib/lutaml/uml/enum.rb
142
223
  - lib/lutaml/uml/event.rb
143
224
  - lib/lutaml/uml/final_state.rb
225
+ - lib/lutaml/uml/formatter.rb
226
+ - lib/lutaml/uml/formatter/base.rb
227
+ - lib/lutaml/uml/formatter/graphviz.rb
228
+ - lib/lutaml/uml/has_attributes.rb
229
+ - lib/lutaml/uml/has_members.rb
144
230
  - lib/lutaml/uml/instance.rb
231
+ - lib/lutaml/uml/interface/base.rb
232
+ - lib/lutaml/uml/interface/command_line.rb
145
233
  - lib/lutaml/uml/model.rb
234
+ - lib/lutaml/uml/node/base.rb
235
+ - lib/lutaml/uml/node/class_node.rb
236
+ - lib/lutaml/uml/node/class_relationship.rb
237
+ - lib/lutaml/uml/node/document.rb
238
+ - lib/lutaml/uml/node/field.rb
239
+ - lib/lutaml/uml/node/has_name.rb
240
+ - lib/lutaml/uml/node/has_type.rb
241
+ - lib/lutaml/uml/node/method.rb
242
+ - lib/lutaml/uml/node/method_argument.rb
243
+ - lib/lutaml/uml/node/relationship.rb
146
244
  - lib/lutaml/uml/opaque_behavior.rb
147
245
  - lib/lutaml/uml/package.rb
246
+ - lib/lutaml/uml/parsers/attribute.rb
247
+ - lib/lutaml/uml/parsers/dsl.rb
248
+ - lib/lutaml/uml/parsers/dsl_preprocessor.rb
249
+ - lib/lutaml/uml/parsers/dsl_transform.rb
250
+ - lib/lutaml/uml/parsers/yaml.rb
148
251
  - lib/lutaml/uml/port.rb
149
252
  - lib/lutaml/uml/primitive_type.rb
150
253
  - lib/lutaml/uml/property.rb
151
254
  - lib/lutaml/uml/pseudostate.rb
152
255
  - lib/lutaml/uml/realization.rb
153
256
  - lib/lutaml/uml/region.rb
257
+ - lib/lutaml/uml/serializers/association.rb
258
+ - lib/lutaml/uml/serializers/base.rb
259
+ - lib/lutaml/uml/serializers/class.rb
260
+ - lib/lutaml/uml/serializers/top_element_attribute.rb
261
+ - lib/lutaml/uml/serializers/yaml_view.rb
154
262
  - lib/lutaml/uml/state.rb
155
263
  - lib/lutaml/uml/state_machine.rb
156
264
  - lib/lutaml/uml/top_element.rb
265
+ - lib/lutaml/uml/top_element_attribute.rb
157
266
  - lib/lutaml/uml/transition.rb
158
267
  - lib/lutaml/uml/trigger.rb
159
268
  - lib/lutaml/uml/version.rb
160
269
  - lib/lutaml/uml/vertex.rb
161
270
  - lutaml-uml.gemspec
271
+ - spec/fixtures/datamodel/models/AddressClassProfile.yml
272
+ - spec/fixtures/datamodel/models/AddressComponentProfile.yml
273
+ - spec/fixtures/datamodel/models/AddressComponentSpecification.yml
274
+ - spec/fixtures/datamodel/models/AddressProfile.yml
275
+ - spec/fixtures/datamodel/models/AttributeProfile.yml
276
+ - spec/fixtures/datamodel/models/InterchangeAddressClassProfile.yml
277
+ - spec/fixtures/datamodel/models/Localization copy.yml
278
+ - spec/fixtures/datamodel/models/Localization.yml
279
+ - spec/fixtures/datamodel/models/ProfileCompliantAddress.yml
280
+ - spec/fixtures/datamodel/models/ProfileCompliantAddressComponent.yml
281
+ - spec/fixtures/datamodel/models/Signature.yml
282
+ - spec/fixtures/datamodel/models/SignatureBlankDefinition.yml
283
+ - spec/fixtures/datamodel/models/TextDirectionCode copy.yml
284
+ - spec/fixtures/datamodel/models/TextDirectionCode.yml
285
+ - spec/fixtures/datamodel/models/Validity.yml
286
+ - spec/fixtures/datamodel/models/iso19160-1/Address.yml
287
+ - spec/fixtures/datamodel/models/iso19160-1/AddressComponent.yml
288
+ - spec/fixtures/datamodel/style.uml.inc
289
+ - spec/fixtures/datamodel/views/AddressClassProfile.yml
290
+ - spec/fixtures/datamodel/views/AddressProfile.yml
291
+ - spec/fixtures/datamodel/views/CommonModels.yml
292
+ - spec/fixtures/datamodel/views/TopDown.yml
293
+ - spec/fixtures/dsl/diagram.lutaml
294
+ - spec/fixtures/dsl/diagram_attributes.lutaml
295
+ - spec/fixtures/dsl/diagram_class_assocation.lutaml
296
+ - spec/fixtures/dsl/diagram_class_fields.lutaml
297
+ - spec/fixtures/dsl/diagram_comments.lutaml
298
+ - spec/fixtures/dsl/diagram_concept_model.lutaml
299
+ - spec/fixtures/dsl/diagram_data_types.lutaml
300
+ - spec/fixtures/dsl/diagram_includes.lutaml
301
+ - spec/fixtures/dsl/diagram_multiply_classes.lutaml
302
+ - spec/fixtures/dsl/shared.lutaml
303
+ - spec/fixtures/dsl/shared1.lutaml
304
+ - spec/fixtures/generated_dot/AddressClassProfile.dot
305
+ - spec/fixtures/generated_dot/AddressProfile.dot
306
+ - spec/lutaml/uml/formatter/graphviz_spec.rb
307
+ - spec/lutaml/uml/parsers/dsl_spec.rb
308
+ - spec/lutaml/uml/parsers/yaml_spec.rb
309
+ - spec/lutaml/uml/serializers/yaml_view_spec.rb
162
310
  - spec/lutaml/uml_spec.rb
163
311
  - spec/spec_helper.rb
164
312
  homepage: https://github.com/lutaml/lutaml-uml
@@ -168,7 +316,7 @@ metadata:
168
316
  homepage_uri: https://github.com/lutaml/lutaml-uml
169
317
  source_code_uri: https://github.com/lutaml/lutaml-uml
170
318
  changelog_uri: https://github.com/lutaml/lutaml-uml/releases
171
- post_install_message:
319
+ post_install_message:
172
320
  rdoc_options: []
173
321
  require_paths:
174
322
  - lib
@@ -183,8 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
331
  - !ruby/object:Gem::Version
184
332
  version: '0'
185
333
  requirements: []
186
- rubygems_version: 3.0.3
187
- signing_key:
334
+ rubygems_version: 3.0.6
335
+ signing_key:
188
336
  specification_version: 4
189
337
  summary: UML model module for LutaML.
190
338
  test_files: []