vispan 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vispan.rb +8 -5
- data/lib/vispan/config.rb +4 -4
- data/lib/vispan/graphwriter.rb +1 -1
- data/lib/vispan/relation.rb +10 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e04222200367b3b370b876384e67772cd4525e1
|
4
|
+
data.tar.gz: 15517ce6b826bfaaf4659584bbb68eeaaaf61eee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32f759ffbc7856f191d1a99fa0ae463718adde647e786f626ceaa4cfceb1292306768b4bf876d55289a0268ba6d0b7d7335f8ac3eb3f814dc9279498031c4eb1
|
7
|
+
data.tar.gz: 8df684fc2de6937c4df3053d6ba14d25ec62c7840cb8d27fd44ff4e4bfd070b5e720c110f8d7988d22185cd678b8961c420c1481c5e177b01c3bf3e4104c1a6c
|
data/lib/vispan.rb
CHANGED
@@ -9,18 +9,21 @@ module Vispan
|
|
9
9
|
|
10
10
|
class WebPreview
|
11
11
|
def call(env)
|
12
|
+
@szenarios = []
|
13
|
+
separate_szenarios(@input)
|
14
|
+
|
15
|
+
@szenarios.each do |szenario|
|
16
|
+
szenario.assign_ranks
|
17
|
+
end
|
18
|
+
|
12
19
|
self.visualize(@output)
|
13
20
|
file_ending = File.extname(@output).delete(".")
|
14
21
|
[200, {"Content-Type" => "image/#{file_ending}"}, [IO.read(@output)]]
|
15
22
|
end
|
16
23
|
|
17
24
|
def initialize(files)
|
25
|
+
@input = files[:input]
|
18
26
|
@output = files[:output]
|
19
|
-
@szenarios = []
|
20
|
-
separate_szenarios(files[:input])
|
21
|
-
@szenarios.each do |szenario|
|
22
|
-
szenario.assign_ranks
|
23
|
-
end
|
24
27
|
end
|
25
28
|
|
26
29
|
def separate_szenarios(input_file)
|
data/lib/vispan/config.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
NODE_WIDTH = 3.3
|
2
2
|
NODE_MARGIN = 0.2
|
3
3
|
|
4
|
-
GENERAL_SETTINGS = {graph:{rankdir:"LR", labeljust:"l", splines:"true", concentrate: "true", ranksep:"2"},
|
4
|
+
GENERAL_SETTINGS = {graph:{rankdir:"LR", labeljust:"l", splines:"true", concentrate: "true", ranksep:"2", nodesep:"0.1"},
|
5
5
|
node:{shape:"rect", color:"none", style:"rounded, filled", margin:"#{NODE_MARGIN}", width:"#{NODE_WIDTH}"},
|
6
6
|
edge:{}}
|
7
7
|
|
@@ -11,8 +11,8 @@ NODE = {screen:{fillcolor:"yellowgreen:lemonchiffon"},
|
|
11
11
|
email:{fillcolor:"grey:ghostwhite"},
|
12
12
|
pdf:{fillcolor:"gold:orange"},
|
13
13
|
command:{fillcolor:"lightblue:steelblue"},
|
14
|
-
helper:{shape:"plaintext", fillcolor:"none", width:"0
|
14
|
+
helper:{shape:"plaintext", fillcolor:"none", width:"0", height:"0", margin:"0.15"}
|
15
15
|
}
|
16
|
-
RELATION = {event:{color:"red"},
|
17
|
-
link:{
|
16
|
+
RELATION = {event:{color:"red", penwidth:"2"},
|
17
|
+
link:{arrowhead:"vee", style:"dashed"}
|
18
18
|
}
|
data/lib/vispan/graphwriter.rb
CHANGED
@@ -36,7 +36,7 @@ class GraphWriter
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def write_effects(relation)
|
39
|
-
"{rank = same; #{relation.
|
39
|
+
"subgraph cluster#{relation.start.name} {label = \"Side effects\"; labeljust = \"c\"; style=\"rounded\"; {rank = same; #{relation.helper.name}; #{relation.effects.map(&:name).join(';')};};}" unless relation.effects.empty?
|
40
40
|
end
|
41
41
|
|
42
42
|
def find_attributes(element)
|
data/lib/vispan/relation.rb
CHANGED
@@ -6,8 +6,7 @@ class Relation
|
|
6
6
|
@label = ""
|
7
7
|
|
8
8
|
extract(relation_array, index)
|
9
|
-
|
10
|
-
@helper.name = "helper_"+ @helper.name + @stop.name
|
9
|
+
set_helper(index)
|
11
10
|
end
|
12
11
|
|
13
12
|
def extract(relation_array, index)
|
@@ -19,15 +18,15 @@ class Relation
|
|
19
18
|
|
20
19
|
def set_connection(label_string)
|
21
20
|
label = label_string.split(":")
|
22
|
-
@
|
21
|
+
@type = label.shift.strip.downcase
|
22
|
+
@label = label.join(":").strip if @type.include? "event"
|
23
23
|
adjust_length(@label)
|
24
|
-
@type = label[0].strip.downcase
|
25
24
|
end
|
26
25
|
|
27
26
|
def set_node(node_string, index)
|
28
27
|
node_array = node_string.split(":")
|
29
|
-
type = node_array
|
30
|
-
label = node_array
|
28
|
+
type = node_array.shift.strip.downcase
|
29
|
+
label = node_array.join(":").strip
|
31
30
|
adjust_length(label)
|
32
31
|
Node.new(type, label, index)
|
33
32
|
end
|
@@ -48,4 +47,9 @@ class Relation
|
|
48
47
|
def get_direction
|
49
48
|
@stop.rank - @start.rank
|
50
49
|
end
|
50
|
+
|
51
|
+
def set_helper(index)
|
52
|
+
@helper = Node.new("helper", @label, index)
|
53
|
+
@helper.name = "helper_"+ @helper.name + @stop.name
|
54
|
+
end
|
51
55
|
end
|