lutaml 0.4.1.pre.alpha.1 → 0.4.1.pre.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/command_line.rb +1 -0
- data/lib/lutaml/express/lutaml_path/document_wrapper.rb +3 -8
- data/lib/lutaml/parser.rb +17 -13
- 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: 0e2accd48e5932fbf111f54429604e7709a98418d6b9c97af40f29c8547a7238
|
4
|
+
data.tar.gz: 6561a16f4d783ddc50812af99e3da854dc2a8673be5e2cc9e7adcffa1678099f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3006890a278d837602f7c3149c46b7810a7f5e367100862eac17ac7e54ef2bf18623b9bb8a98483b12cec3fe52bfbef1e3f3c40b7231b7d669c31b0b5e3548f1
|
7
|
+
data.tar.gz: c509f969284fc89e5a4d3293426a71ff861aa8283f33193114887d55d2173427a988998db906d18ea94e1a821db07147a213f892052241dd383c6e36556fa2b0
|
data/lib/lutaml/command_line.rb
CHANGED
@@ -1,20 +1,15 @@
|
|
1
1
|
require "lutaml/lutaml_path/document_wrapper"
|
2
|
-
require "expressir/express_exp/
|
2
|
+
require "expressir/express_exp/hyperlink_formatter"
|
3
3
|
|
4
4
|
module Lutaml
|
5
5
|
module Express
|
6
6
|
module LutamlPath
|
7
7
|
class DocumentWrapper < ::Lutaml::LutamlPath::DocumentWrapper
|
8
|
-
SOURCE_CODE_ATTRIBUTE_NAME = "sourcecode".freeze
|
9
|
-
|
10
8
|
protected
|
11
9
|
|
12
10
|
def serialize_document(repository)
|
13
|
-
repository
|
14
|
-
|
15
|
-
res[schema.id] = schema.to_hash(formatter: Expressir::ExpressExp::Formatter)
|
16
|
-
res["schemas"].push(res[schema.id])
|
17
|
-
end
|
11
|
+
repository
|
12
|
+
.to_hash(formatter: Expressir::ExpressExp::HyperlinkFormatter)['schemas']
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
data/lib/lutaml/parser.rb
CHANGED
@@ -5,36 +5,40 @@ require "lutaml/express/lutaml_path/document_wrapper"
|
|
5
5
|
|
6
6
|
module Lutaml
|
7
7
|
class Parser
|
8
|
-
attr_reader :parse_type, :
|
8
|
+
attr_reader :parse_type, :file_list
|
9
9
|
|
10
10
|
class << self
|
11
|
-
def parse(
|
12
|
-
|
11
|
+
def parse(file_list, input_type = nil)
|
12
|
+
file_list = file_list.is_a?(Array) ? file_list : [file_list]
|
13
|
+
new(Array(file_list), input_type).parse
|
13
14
|
end
|
14
15
|
|
15
|
-
def parse_into_document(
|
16
|
-
|
16
|
+
def parse_into_document(file_list, input_type = nil)
|
17
|
+
file_list = file_list.is_a?(Array) ? file_list : [file_list]
|
18
|
+
new(Array(file_list), input_type).parse_into_document
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
def initialize(
|
21
|
-
@parse_type = input_type ? input_type : File.extname(
|
22
|
-
@
|
22
|
+
def initialize(file_list, input_type)
|
23
|
+
@parse_type = input_type ? input_type : File.extname(file_list.first.path)[1..-1]
|
24
|
+
@file_list = file_list
|
23
25
|
end
|
24
26
|
|
25
27
|
def parse
|
26
|
-
|
27
|
-
document_wrapper(
|
28
|
+
documents = parse_into_document
|
29
|
+
return [document_wrapper(documents)] if parse_type == "exp"
|
30
|
+
|
31
|
+
documents.map { |doc| document_wrapper(doc) }
|
28
32
|
end
|
29
33
|
|
30
34
|
def parse_into_document
|
31
35
|
case parse_type
|
32
36
|
when "exp"
|
33
|
-
|
37
|
+
Expressir::ExpressExp::Parser.from_files(file_list.map(&:path))
|
34
38
|
when "lutaml"
|
35
|
-
Lutaml::Uml::Parsers::Dsl.parse(file)
|
39
|
+
file_list.map { |file| Lutaml::Uml::Parsers::Dsl.parse(file) }
|
36
40
|
when "yml"
|
37
|
-
Lutaml::Uml::Parsers::Yaml.parse(file.path)
|
41
|
+
file_list.map { |file| Lutaml::Uml::Parsers::Yaml.parse(file.path) }
|
38
42
|
else
|
39
43
|
raise ArgumentError, "Unsupported file format"
|
40
44
|
end
|
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.4.1.pre.alpha.
|
4
|
+
version: 0.4.1.pre.alpha.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: 2021-02-
|
11
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lutaml-express
|