lutaml-uml 0.2.1 → 0.2.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: 988b726887b8bd5f85e4cff7f56bfac405c6ea287f80d0a2222adf994ced4f70
4
- data.tar.gz: 2d2aa85fcc8c25fc64ecd2a4cecbe028e54eeebe79f78e6615298ef095de667e
3
+ metadata.gz: b549fe48dc2957bc3f44d69d32f0727af97ec27755e35f47a2580a307e01edb6
4
+ data.tar.gz: f9ce93042ba36d940323413f03ffc952b1c174beedc81441a2cd7e7b37a4fa5d
5
5
  SHA512:
6
- metadata.gz: 6d068ec140b4a284c0a1f0f7762c86b03bdaa1ad667c96a614f1009007e9fb064a8b5df787bf0d06185169ca0b0b8afebda70d82ae62bfd52fcb01c4f79f012f
7
- data.tar.gz: bdebc9b1068f9f98eb2fc2da7b03d3d389231440064964e518169e1acd4c73d1f5e509ed53aad92d734afa58bddd0882cbc63802d6280068d400784e773105f3
6
+ metadata.gz: e3070e60d69100ce2696ab9e4e9efb89ad6331fcf962da7b16222107a18b681faddae48cad66ea2b0d6a03c5871583a299d6d5ab9a41ea8f4451844cfa5d9023
7
+ data.tar.gz: f09245563a2441c7a3714763e820998341d949d6c2c51b4e12599109c3583513cbe1a85c0d3fca3407fe6b5c2c2bd743e679e39a1755c565b7fd1b4b6bd58df7
@@ -31,6 +31,8 @@ jobs:
31
31
  run: |
32
32
  sudo gem install bundler --force
33
33
  bundle install --jobs 4 --retry 3
34
+ - name: Install Grpahviz macOS
35
+ run: brew install graphviz
34
36
  - name: Run specs
35
37
  run: |
36
38
  bundle exec rake
@@ -33,6 +33,8 @@ jobs:
33
33
  run: |
34
34
  gem install bundler
35
35
  bundle install --jobs 4 --retry 3
36
+ - name: Install Grpahviz Ubuntu
37
+ run: sudo apt-get install graphviz
36
38
  - name: Run specs
37
39
  run: |
38
40
  bundle exec rake
@@ -36,6 +36,9 @@ jobs:
36
36
  gem install bundler
37
37
  bundle config --local path vendor/bundle
38
38
  bundle install --jobs 4 --retry 3
39
+ - name: Install Grpahviz Windows
40
+ run: |
41
+ cinst -y graphviz
39
42
  - name: Run specs
40
43
  run: |
41
44
  bundle exec rake
@@ -7,21 +7,12 @@ module Lutaml
7
7
  module Layout
8
8
  class GraphVizEngine < Engine
9
9
  def render(type)
10
- parse_graphviz_string
11
- .output(type => String)
12
- end
13
-
14
- private
15
-
16
- # GraphViz#parse_string and GraphViz#parse crush with no reason
17
- # with seg fault, this lead to nil return value.
18
- # Try to recall method several time
19
- def parse_graphviz_string(attempts = 10)
20
- raise('Cannot parse input string, `gvpr` segmentation fault?') if attempts == 0
21
- res = GraphViz.parse_string(input)
22
- return res if res
23
-
24
- parse_graphviz_string(attempts - 1)
10
+ Open3.popen3("dot -T#{type}") do |stdin, stdout, _stderr, _wait|
11
+ stdin.puts(input)
12
+ stdin.close
13
+ # unless (err = stderr.read).empty? then raise err end
14
+ stdout.read
15
+ end
25
16
  end
26
17
  end
27
18
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Uml
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.2"
6
6
  end
7
7
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ RSpec.describe Lutaml::Layout::GraphVizEngine do
6
+ describe "#render" do
7
+ subject(:render) do
8
+ described_class.new(input: input).render(type)
9
+ end
10
+ let(:input) do
11
+ File.read(fixtures_path("generated_dot/AddressClassProfile.dot"))
12
+ end
13
+
14
+ context "when png output type" do
15
+ let(:type) { "png" }
16
+ let(:png_header) { "\x89PNG" }
17
+
18
+ it "renders input as png binary string" do
19
+ expect(render[0..3]).to(eq(png_header))
20
+ end
21
+ end
22
+
23
+ context "when dot output type" do
24
+ let(:type) { "dot" }
25
+
26
+ it "renders input as dot string" do
27
+ expect(render).to(match("digraph G {"))
28
+ end
29
+ end
30
+ end
31
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml-uml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.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-14 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -303,6 +303,7 @@ files:
303
303
  - spec/fixtures/dsl/shared1.lutaml
304
304
  - spec/fixtures/generated_dot/AddressClassProfile.dot
305
305
  - spec/fixtures/generated_dot/AddressProfile.dot
306
+ - spec/lutaml/layout/graph_viz_engine_spec.rb
306
307
  - spec/lutaml/uml/formatter/graphviz_spec.rb
307
308
  - spec/lutaml/uml/parsers/dsl_spec.rb
308
309
  - spec/lutaml/uml/parsers/yaml_spec.rb