graph 2.8.1 → 2.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 945fcc7c3bb48cd8b29c4d0256fb8ac8da6019c0
4
- data.tar.gz: 4b4b4198c09670a896e3b0e207505622b565a3b1
3
+ metadata.gz: 574ca778f479293c4fb24c185b89154f57704c82
4
+ data.tar.gz: e33fba3e10c00412b59b70f28bb35176bda1200c
5
5
  SHA512:
6
- metadata.gz: c87418ac8521f4d3f00ea09d3a7a28a6859bc7b2bdc3b2f4a8d7ab01a9a3ed7e6998788db292b48c33317c33fac0e4fe137b7e234599326b07406ea51677a891
7
- data.tar.gz: f38de70e44669917a624bb4735fe2d78258691f0241c30130f2936fc9e2196f6f6a620cd5966a3e1b86e843089c44696406de729759720f725c1f418a0dea75f
6
+ metadata.gz: 3b6f02a139e1b6d7b587800d2f49901175f05fcdf83ddbbf365d7e0564160d4ffeed72dedcf4ce063f66b4e1222dd03cb47f1d8730bd802c16c1b98bc1761ae6
7
+ data.tar.gz: a4a6a9c7762e7f70f7a5a932765f52a52b54b79f532e6f6991fd0395ca6a2b647104e59757d6dc94f0bf972a114a3b3b8d299770ace10b8d9c517099a2031315
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  require 'autotest/restart'
4
- require 'autotest/rcov'
4
+ # require 'autotest/rcov'
5
5
 
6
6
  Autotest.add_hook :initialize do |at|
7
7
  at.testlib = "minitest/autorun"
@@ -1,3 +1,10 @@
1
+ === 2.8.2 / 2016-10-09
2
+
3
+ * 2 bug fixes:
4
+
5
+ * delete_node cleans up edges and edges_order.
6
+ * escape_label better deals with symbols.
7
+
1
8
  === 2.8.1 / 2016-01-21
2
9
 
3
10
  * 1 bug fix:
data/Rakefile CHANGED
@@ -8,6 +8,7 @@ Hoe.plugin :seattlerb
8
8
 
9
9
  Hoe.spec 'graph' do
10
10
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
11
+ license "MIT"
11
12
  end
12
13
 
13
14
  gallery = Dir["gallery/*.rb"]
@@ -7,7 +7,7 @@ require "enumerator"
7
7
  # dot format.
8
8
 
9
9
  class Graph
10
- VERSION = "2.8.1" # :nodoc:
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
  ##
@@ -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
- g = digraph do
132
+ @graph = digraph do
114
133
  node "a"
115
134
  node "b"
116
135
  end
117
136
 
118
- assert_equal 2, g.nodes.length
119
- assert_equal 2, g.nodes_order.length
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
- assert_equal 1, g.nodes.length
125
- assert_equal 1, g.nodes_order.length
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
- util_save "png"
204
+ assert_save "png"
187
205
  end
188
206
 
189
207
  def test_save_nil
190
- util_save nil
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 util_save type
290
+ def assert_save type
273
291
  path = File.join(Dir.tmpdir, "blah.#{$$}")
274
292
 
275
- $x = nil
293
+ actual = expected = false
276
294
 
277
- def graph.system(*args)
278
- $x = args
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, $x
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.1
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
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -20,31 +20,18 @@ cert_chain:
20
20
  oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
21
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
- gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQB+Hx8xUgrpZa4P8H8gR8zme5kISwQrG80MbpqJV6/G3/ZicRFhN5sjwu0uHGue
26
- bd9Cymf6oIRwHVarJux2M32T6bL07Hmi07w2QaPc3MnMKB/D46SRZ2JSSGPFRBTc
27
- SilobMRoGs/7B15uGFUEnNrCB/ltMqhwwSx1r++UQPfeySHEV9uqu03E5Vb7J37O
28
- 2Er6PLXHRiYsIycD1LkMi6YnixdITRHmrqJYE2rsjaIfpIehiusVAPHkNf7qbpHq
29
- qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
- NLq5jm1fq6Y9Uolu3RJbmycf
23
+ gBEfoTEGr7Zii72cx+sCAwEAAaOBhDCBgTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
24
+ sDAdBgNVHQ4EFgQUR8V72Z3+v+2P9abCnL4wjx32T+EwIwYDVR0RBBwwGoEYcnlh
25
+ bmQtcnVieUB6ZW5zcGlkZXIuY29tMCMGA1UdEgQcMBqBGHJ5YW5kLXJ1YnlAemVu
26
+ c3BpZGVyLmNvbTANBgkqhkiG9w0BAQUFAAOCAQEAIGzgp0aZ2W9+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-01-21 00:00:00.000000000 Z
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.14'
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.14'
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