graph 2.8.1 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +1 -1
- data/History.txt +7 -0
- data/Rakefile +1 -0
- data/lib/graph.rb +10 -2
- data/test/test_graph.rb +35 -16
- metadata +15 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574ca778f479293c4fb24c185b89154f57704c82
|
4
|
+
data.tar.gz: e33fba3e10c00412b59b70f28bb35176bda1200c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b6f02a139e1b6d7b587800d2f49901175f05fcdf83ddbbf365d7e0564160d4ffeed72dedcf4ce063f66b4e1222dd03cb47f1d8730bd802c16c1b98bc1761ae6
|
7
|
+
data.tar.gz: a4a6a9c7762e7f70f7a5a932765f52a52b54b79f532e6f6991fd0395ca6a2b647104e59757d6dc94f0bf972a114a3b3b8d299770ace10b8d9c517099a2031315
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.autotest
CHANGED
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/lib/graph.rb
CHANGED
@@ -7,7 +7,7 @@ require "enumerator"
|
|
7
7
|
# dot format.
|
8
8
|
|
9
9
|
class Graph
|
10
|
-
VERSION = "2.8.
|
10
|
+
VERSION = "2.8.2" # :nodoc:
|
11
11
|
|
12
12
|
# :stopdoc:
|
13
13
|
|
@@ -291,7 +291,7 @@ class Graph
|
|
291
291
|
end
|
292
292
|
|
293
293
|
def self.escape_label s
|
294
|
-
s = s.gsub(/\n/, '\n').gsub(/\"/, '\\\"')
|
294
|
+
s = s.to_s.gsub(/\n/, '\n').gsub(/\"/, '\\\"')
|
295
295
|
if s[0] == ?< and s[-1] == ?> then
|
296
296
|
s
|
297
297
|
else
|
@@ -377,6 +377,14 @@ class Graph
|
|
377
377
|
def delete_node node_name
|
378
378
|
nodes.delete node_name
|
379
379
|
nodes_order.delete node_name
|
380
|
+
|
381
|
+
edges_order.each do |(a, b)|
|
382
|
+
edges[a].delete b if b == node_name
|
383
|
+
edges.delete a if a == node_name
|
384
|
+
edges.delete a if edges[a].empty?
|
385
|
+
end
|
386
|
+
|
387
|
+
edges_order.delete_if { |ary| ary.include? node_name }
|
380
388
|
end
|
381
389
|
|
382
390
|
##
|
data/test/test_graph.rb
CHANGED
@@ -109,23 +109,41 @@ class TestGraph < Minitest::Test
|
|
109
109
|
assert_graph graph, 'label = "blah"', '"a" -> "b"'
|
110
110
|
end
|
111
111
|
|
112
|
+
def assert_delete_node name, exp, edges=true
|
113
|
+
assert_equal 2, graph.nodes.length
|
114
|
+
assert_equal 2, graph.nodes_order.length
|
115
|
+
assert_equal %w[a b], graph.nodes.keys.sort
|
116
|
+
|
117
|
+
if edges then
|
118
|
+
assert_equal 1, graph.edges.length
|
119
|
+
assert_equal 1, graph.edges_order.length
|
120
|
+
end
|
121
|
+
|
122
|
+
graph.delete_node name
|
123
|
+
|
124
|
+
assert_equal 1, graph.nodes.length
|
125
|
+
assert_equal 1, graph.nodes_order.length
|
126
|
+
assert_equal exp, graph.nodes.keys.sort
|
127
|
+
assert_equal 0, graph.edges.length
|
128
|
+
assert_equal 0, graph.edges_order.length
|
129
|
+
end
|
130
|
+
|
112
131
|
def test_delete_node
|
113
|
-
|
132
|
+
@graph = digraph do
|
114
133
|
node "a"
|
115
134
|
node "b"
|
116
135
|
end
|
117
136
|
|
118
|
-
|
119
|
-
|
120
|
-
assert_equal %w[a b], g.nodes.keys.sort
|
121
|
-
|
122
|
-
g.delete_node "a"
|
137
|
+
assert_delete_node "a", %w[b], false
|
138
|
+
end
|
123
139
|
|
124
|
-
|
125
|
-
|
126
|
-
assert_equal %w[b], g.nodes.keys.sort
|
140
|
+
def test_delete_node_edges_front
|
141
|
+
assert_delete_node "a", %w[b]
|
127
142
|
end
|
128
143
|
|
144
|
+
def test_delete_node_edges_back
|
145
|
+
assert_delete_node "b", %w[a]
|
146
|
+
end
|
129
147
|
|
130
148
|
def test_label_html
|
131
149
|
graph.label "<<B>blah</B>>"
|
@@ -183,11 +201,11 @@ class TestGraph < Minitest::Test
|
|
183
201
|
end
|
184
202
|
|
185
203
|
def test_save
|
186
|
-
|
204
|
+
assert_save "png"
|
187
205
|
end
|
188
206
|
|
189
207
|
def test_save_nil
|
190
|
-
|
208
|
+
assert_save nil
|
191
209
|
end
|
192
210
|
|
193
211
|
def test_shape
|
@@ -269,20 +287,21 @@ g_s = "subgraph \"subgraph\"
|
|
269
287
|
'"a" -> "b"')
|
270
288
|
end
|
271
289
|
|
272
|
-
def
|
290
|
+
def assert_save type
|
273
291
|
path = File.join(Dir.tmpdir, "blah.#{$$}")
|
274
292
|
|
275
|
-
|
293
|
+
actual = expected = false
|
276
294
|
|
277
|
-
|
278
|
-
|
295
|
+
mc = (class << graph; self; end)
|
296
|
+
mc.send :define_method, :system do |*args|
|
297
|
+
actual = args
|
279
298
|
end
|
280
299
|
|
281
300
|
graph.save(path, type)
|
282
301
|
|
283
302
|
assert_equal graph.to_s + "\n", File.read("#{path}.dot")
|
284
303
|
expected = ["dot -T#{type} #{path}.dot > #{path}.png"] if type
|
285
|
-
assert_equal expected,
|
304
|
+
assert_equal expected, actual
|
286
305
|
ensure
|
287
306
|
File.unlink path rescue nil
|
288
307
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|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IGzgp0aZ2W9+v96ujmBcQHoC
|
27
|
+
buy0iU68MVj2VlxMyfr1KPZIh1OyhU4UO4zrkREcH8ML70v9cYHNvOd9oynRHnvC
|
28
|
+
l2tj/fD3YJ0AEkJxGrYwRWQmvMfC4bJ02bC1+rVOUIXXKp3+cUmiN4sTniof8VFo
|
29
|
+
bo/YYP4c7erpERa+9hrqygg6WQbJlk2YRlH3JXPFjmu869i2dcbR5ZLOAeEy+axH
|
30
|
+
E4oJcnPkJAr0rw504JGtlZtONZQblwmRJOIdXzolaE3NRGUzGVOUSptZppAKiavY
|
31
|
+
fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
|
31
32
|
-----END CERTIFICATE-----
|
32
|
-
date: 2016-
|
33
|
+
date: 2016-10-09 00:00:00.000000000 Z
|
33
34
|
dependencies:
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: minitest
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5.8'
|
41
|
-
type: :development
|
42
|
-
prerelease: false
|
43
|
-
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5.8'
|
48
35
|
- !ruby/object:Gem::Dependency
|
49
36
|
name: rdoc
|
50
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,14 +52,14 @@ dependencies:
|
|
65
52
|
requirements:
|
66
53
|
- - ~>
|
67
54
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
55
|
+
version: '3.15'
|
69
56
|
type: :development
|
70
57
|
prerelease: false
|
71
58
|
version_requirements: !ruby/object:Gem::Requirement
|
72
59
|
requirements:
|
73
60
|
- - ~>
|
74
61
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
62
|
+
version: '3.15'
|
76
63
|
description: "Graph is a type of hash that outputs in graphviz's dot format. It\ncomes
|
77
64
|
with a command-line interface that is easily pluggable.\n\nIt ships with plugins
|
78
65
|
to graph dependencies and status of installed\nrubygems, rake tasks, homebrew ports,
|
metadata.gz.sig
CHANGED
Binary file
|