lutaml 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bffadc6b3f176ed29fe3d8c001afc02c2f29cb848874af353235d17f7c8657a
4
- data.tar.gz: b424788eca466bb15faa49ea4802c2a32b7d6d6986833e523a47ed821d9b7307
3
+ metadata.gz: 1d1809b80de4e3e3d8ed081e31f19008e3fcb30559a8e95b6156a03bfca36aa6
4
+ data.tar.gz: be6fd904458828f232294f03d0cdb1fec2dbc349301449ebb3f9a1a77b375195
5
5
  SHA512:
6
- metadata.gz: e6dcff09dc1a2d4560ddea2c2d0f58255769e1ab9c55e75f1641f942c608fb04c1716efc3006bbd015a02a8d2fb383da3c8e1c59068009ea635eb813bf68647c
7
- data.tar.gz: ead2205b1cc1887b8ec73e0dad6cc5a72cae141f21f725b32433af3b2a12061e2c9b701c94323e978cf4e8727485f500733ad2d5c4c1b305a800c3bcfa96f65c
6
+ metadata.gz: b58852c0e45b0ebe4bd27f7c782ee605abe4e448107c8371ddd98d5fb9f731053ec3f46565d34f43d9b6ca2363c09d7db55c6adba282db934c01a543f117b97e
7
+ data.tar.gz: 47326b6b3301018542b4764161e931df57e582c4e4d22d0f94961caf4fbe9a495b76fe65337fe22dd3c1e71b2c909da52e93caa000040566c36d145ae8733a63
@@ -16,13 +16,16 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.6', '2.5' ]
20
20
  experimental: [false]
21
21
  include:
22
22
  - ruby: '2.7'
23
23
  experimental: true
24
24
  steps:
25
25
  - uses: actions/checkout@master
26
+ - name: Install build tools
27
+ run: |
28
+ brew install automake libtool
26
29
  - name: Use Ruby
27
30
  uses: actions/setup-ruby@v1
28
31
  with:
@@ -18,7 +18,7 @@ jobs:
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
21
+ ruby: [ '2.6', '2.5' ]
22
22
  experimental: [false]
23
23
  include:
24
24
  - ruby: '2.7'
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.6', '2.5' ]
20
20
  experimental: [false]
21
21
  # Does not supported yet:
22
22
  # Ruby (< 2.7.dev, >= 2.3), which is required by gem 'nokogiri (~> 1.10)', is not
@@ -1,4 +1,5 @@
1
1
  require "lutaml/lutaml_path/document_wrapper"
2
+ require "expressir/express_exp/formatter"
2
3
 
3
4
  module Lutaml
4
5
  module Express
@@ -12,25 +13,46 @@ module Lutaml
12
13
  functions
13
14
  interfaces
14
15
  procedures
16
+ remarks
15
17
  rules
16
18
  subtype_constraints
17
19
  types
18
20
  version
19
21
  ].freeze
22
+ SOURCE_CODE_ATTRIBUTE_NAME = "sourcecode".freeze
20
23
 
21
24
  protected
22
25
 
23
26
  def serialize_document(repository)
24
27
  repository.schemas.each_with_object({}) do |schema, res|
25
28
  res["schemas"] ||= []
26
- serialized_schema = SCHEMA_ATTRIBUTES.each_with_object({}) do |name, nested_res|
29
+ serialized_schema = SCHEMA_ATTRIBUTES
30
+ .each_with_object({}) do |name, nested_res|
27
31
  attr_value = schema.send(name)
28
32
  nested_res[name] = serialize_value(attr_value)
33
+ if name == "entities"
34
+ nested_res[name] = merge_source_code_attr(nested_res[name],
35
+ attr_value)
36
+ end
29
37
  end
30
38
  res[schema.id] = serialized_schema
39
+ serialized_schema = serialized_schema
40
+ .merge(SOURCE_CODE_ATTRIBUTE_NAME =>
41
+ entity_source_code(schema))
31
42
  res["schemas"].push(serialized_schema)
32
43
  end
33
44
  end
45
+
46
+ def merge_source_code_attr(serialized_entries, entities)
47
+ serialized_entries.map do |serialized|
48
+ entity = entities.detect { |n| n.id == serialized["id"] }
49
+ serialized.merge(SOURCE_CODE_ATTRIBUTE_NAME => entity_source_code(entity))
50
+ end
51
+ end
52
+
53
+ def entity_source_code(entity)
54
+ Expressir::ExpressExp::Formatter.format(entity)
55
+ end
34
56
  end
35
57
  end
36
58
  end
@@ -26,6 +26,8 @@ module Lutaml
26
26
  end
27
27
 
28
28
  def serialize_to_hash(object)
29
+ return object if [String, Integer, Float].include?(object.class)
30
+
29
31
  object.instance_variables.each_with_object({}) do |var, res|
30
32
  variable = object.instance_variable_get(var)
31
33
  res[var.to_s.gsub("@", "")] = if variable.is_a?(Array)
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.3.1".freeze
2
+ VERSION = "0.3.2".freeze
3
3
  end
@@ -24,12 +24,9 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_runtime_dependency "thor", "~> 1.0"
28
- # spec.add_runtime_dependency "activesupport", "~> 5.0"
29
- spec.add_runtime_dependency "lutaml-uml", "~> 0.2.5"
30
- # spec.add_runtime_dependency "lutaml-sysml"
31
27
  spec.add_runtime_dependency "lutaml-express", "~> 0.1.3"
32
- spec.add_development_dependency "jmespath", "~> 1.4"
28
+ spec.add_runtime_dependency "lutaml-uml", "~> 0.2.5"
29
+ spec.add_runtime_dependency "thor", "~> 1.0"
33
30
  spec.add_development_dependency "nokogiri", "~> 1.10"
34
31
 
35
32
  spec.add_development_dependency "bundler", "~> 2.0"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: thor
14
+ name: lutaml-express
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: 0.1.3
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: 0.1.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: lutaml-uml
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,33 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.2.5
41
41
  - !ruby/object:Gem::Dependency
42
- name: lutaml-express
42
+ name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.3
47
+ version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.3
55
- - !ruby/object:Gem::Dependency
56
- name: jmespath
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.4'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.4'
54
+ version: '1.0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: nokogiri
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -212,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
198
  - !ruby/object:Gem::Version
213
199
  version: '0'
214
200
  requirements: []
215
- rubygems_version: 3.0.6
201
+ rubygems_version: 3.0.3
216
202
  signing_key:
217
203
  specification_version: 4
218
204
  summary: 'LutaML: data models in textual form'