lutaml 0.4.1.pre.alpha.2 → 0.6.0
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/Gemfile +2 -0
- data/README.adoc +3 -1
- data/lib/lutaml/express/lutaml_path/document_wrapper.rb +2 -2
- data/lib/lutaml/express/lutaml_path/formatter.rb +14 -0
- data/lib/lutaml/lutaml_path/document_wrapper.rb +4 -3
- data/lib/lutaml/parser.rb +10 -2
- data/lib/lutaml/version.rb +1 -1
- data/lutaml.gemspec +3 -2
- metadata +27 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '02909e34c428277e9b0e79733bcb3162da4a149c4880d96d0890131f8f12115c'
|
|
4
|
+
data.tar.gz: d56d9a964b34c111493c7ffa0888dd2260d3d197e60bb92f4ee4aad1c236a87f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 869303f2d2cac53f2abe735f8fe1511f7cdf0443c57d8235f1e14520425b3ac3cbc5dd96d09d423a5c81d85a6539970010d880e518e4f3e48d4795a4737154a1
|
|
7
|
+
data.tar.gz: 1f02d2681e529d6adef066a863b0656ceb9a4c1157d094a41f3d87db04aa4edc30c984093ed5ef4b81bbbdf9fd74f09ac95a4391c039b63c72397f53e3758415
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
|
@@ -37,7 +37,9 @@ In order to parse files supported by lutaml extensions, use Lutaml::Parser.parse
|
|
|
37
37
|
[source,ruby]
|
|
38
38
|
----
|
|
39
39
|
# example.exp is an EXPRESS repository file
|
|
40
|
-
Lutaml::Parser.parse(File.new("example.exp")) # will produce Lutaml::LutamlPath::DocumentWrapper object with serialized express repository
|
|
40
|
+
Lutaml::Parser.parse([File.new("example.exp")]) # will produce Lutaml::LutamlPath::DocumentWrapper object with serialized express repository
|
|
41
|
+
# example.yaml is an EXPRESS cache file
|
|
42
|
+
Lutaml::Parser.parse([File.new("example.yaml")], ::Lutaml::Parser::EXPRESS_CACHE_PARSE_TYPE)
|
|
41
43
|
----
|
|
42
44
|
|
|
43
45
|
== With cli tool
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "lutaml/lutaml_path/document_wrapper"
|
|
2
|
-
require "
|
|
2
|
+
require "lutaml/express/lutaml_path/formatter"
|
|
3
3
|
|
|
4
4
|
module Lutaml
|
|
5
5
|
module Express
|
|
@@ -9,7 +9,7 @@ module Lutaml
|
|
|
9
9
|
|
|
10
10
|
def serialize_document(repository)
|
|
11
11
|
repository
|
|
12
|
-
.to_hash(formatter:
|
|
12
|
+
.to_hash(formatter: Formatter)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "expressir/express_exp/formatter"
|
|
2
|
+
require "expressir/express_exp/schema_head_formatter"
|
|
3
|
+
require "expressir/express_exp/hyperlink_formatter"
|
|
4
|
+
|
|
5
|
+
module Lutaml
|
|
6
|
+
module Express
|
|
7
|
+
module LutamlPath
|
|
8
|
+
class Formatter < Expressir::ExpressExp::Formatter
|
|
9
|
+
include Expressir::ExpressExp::SchemaHeadFormatter
|
|
10
|
+
include Expressir::ExpressExp::HyperlinkFormatter
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module Lutaml
|
|
2
2
|
module LutamlPath
|
|
3
3
|
class DocumentWrapper
|
|
4
|
-
attr_reader :serialized_document
|
|
4
|
+
attr_reader :serialized_document, :original_document
|
|
5
5
|
|
|
6
6
|
def initialize(document)
|
|
7
|
+
@original_document = document
|
|
7
8
|
@serialized_document = serialize_document(document)
|
|
8
9
|
end
|
|
9
10
|
|
|
@@ -26,7 +27,7 @@ module Lutaml
|
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def serialize_to_hash(object)
|
|
29
|
-
return object if [String, Integer, Float, FalseClass, TrueClass, Symbol, NilClass].include?(object.class)
|
|
30
|
+
return object if [String, Integer, Float, FalseClass, TrueClass, Symbol, NilClass, Hash].include?(object.class)
|
|
30
31
|
|
|
31
32
|
object.instance_variables.each_with_object({}) do |var, res|
|
|
32
33
|
variable = object.instance_variable_get(var)
|
|
@@ -35,7 +36,7 @@ module Lutaml
|
|
|
35
36
|
serialize_to_hash(n)
|
|
36
37
|
end
|
|
37
38
|
else
|
|
38
|
-
if [String, Integer, Float, FalseClass, TrueClass, Symbol, NilClass].include?(variable.class) || var == :@parent
|
|
39
|
+
if [String, Integer, Float, FalseClass, TrueClass, Symbol, NilClass, Hash].include?(variable.class) || var == :@parent
|
|
39
40
|
variable
|
|
40
41
|
else
|
|
41
42
|
serialize_to_hash(variable)
|
data/lib/lutaml/parser.rb
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
require "lutaml/express"
|
|
2
2
|
require "lutaml/uml"
|
|
3
|
+
require "lutaml/xmi"
|
|
3
4
|
require "lutaml/uml/lutaml_path/document_wrapper"
|
|
4
5
|
require "lutaml/express/lutaml_path/document_wrapper"
|
|
6
|
+
require "expressir/express_exp/cache"
|
|
5
7
|
|
|
6
8
|
module Lutaml
|
|
7
9
|
class Parser
|
|
10
|
+
EXPRESS_CACHE_PARSE_TYPE = "exp.cache".freeze
|
|
11
|
+
|
|
8
12
|
attr_reader :parse_type, :file_list
|
|
9
13
|
|
|
10
14
|
class << self
|
|
@@ -26,7 +30,7 @@ module Lutaml
|
|
|
26
30
|
|
|
27
31
|
def parse
|
|
28
32
|
documents = parse_into_document
|
|
29
|
-
return
|
|
33
|
+
return document_wrapper(documents) if ["exp", EXPRESS_CACHE_PARSE_TYPE].include?(parse_type)
|
|
30
34
|
|
|
31
35
|
documents.map { |doc| document_wrapper(doc) }
|
|
32
36
|
end
|
|
@@ -35,6 +39,10 @@ module Lutaml
|
|
|
35
39
|
case parse_type
|
|
36
40
|
when "exp"
|
|
37
41
|
Expressir::ExpressExp::Parser.from_files(file_list.map(&:path))
|
|
42
|
+
when EXPRESS_CACHE_PARSE_TYPE
|
|
43
|
+
Expressir::ExpressExp::Cache.from_file(file_list.first.path)
|
|
44
|
+
when 'xmi'
|
|
45
|
+
file_list.map { |file| Lutaml::XMI::Parsers::XML.parse(file) }
|
|
38
46
|
when "lutaml"
|
|
39
47
|
file_list.map { |file| Lutaml::Uml::Parsers::Dsl.parse(file) }
|
|
40
48
|
when "yml"
|
|
@@ -47,7 +55,7 @@ module Lutaml
|
|
|
47
55
|
private
|
|
48
56
|
|
|
49
57
|
def document_wrapper(document)
|
|
50
|
-
if
|
|
58
|
+
if ["exp", EXPRESS_CACHE_PARSE_TYPE].include?(parse_type)
|
|
51
59
|
return Lutaml::Express::LutamlPath::DocumentWrapper.new(document)
|
|
52
60
|
end
|
|
53
61
|
|
data/lib/lutaml/version.rb
CHANGED
data/lutaml.gemspec
CHANGED
|
@@ -27,8 +27,9 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
28
|
spec.require_paths = ["lib"]
|
|
29
29
|
|
|
30
|
-
spec.add_runtime_dependency "lutaml-express"
|
|
31
|
-
spec.add_runtime_dependency "lutaml-uml"
|
|
30
|
+
spec.add_runtime_dependency "lutaml-express"
|
|
31
|
+
spec.add_runtime_dependency "lutaml-uml"
|
|
32
|
+
spec.add_runtime_dependency "lutaml-xmi"
|
|
32
33
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
|
33
34
|
spec.add_development_dependency "nokogiri", "~> 1.10"
|
|
34
35
|
|
metadata
CHANGED
|
@@ -1,43 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-express
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0
|
|
19
|
+
version: '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: 0
|
|
26
|
+
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: lutaml-uml
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0
|
|
33
|
+
version: '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: 0
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: lutaml-xmi
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: thor
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -174,6 +188,7 @@ files:
|
|
|
174
188
|
- lib/lutaml.rb
|
|
175
189
|
- lib/lutaml/command_line.rb
|
|
176
190
|
- lib/lutaml/express/lutaml_path/document_wrapper.rb
|
|
191
|
+
- lib/lutaml/express/lutaml_path/formatter.rb
|
|
177
192
|
- lib/lutaml/formatter.rb
|
|
178
193
|
- lib/lutaml/formatter/base.rb
|
|
179
194
|
- lib/lutaml/formatter/graphviz.rb
|
|
@@ -202,9 +217,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
202
217
|
version: '0'
|
|
203
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
219
|
requirements:
|
|
205
|
-
- - "
|
|
220
|
+
- - ">="
|
|
206
221
|
- !ruby/object:Gem::Version
|
|
207
|
-
version:
|
|
222
|
+
version: '0'
|
|
208
223
|
requirements: []
|
|
209
224
|
rubygems_version: 3.0.3
|
|
210
225
|
signing_key:
|