graph 2.8.2 → 2.9.0
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -3
- data/History.txt +12 -0
- data/lib/graph.rb +18 -8
- data/test/test_graph.rb +14 -7
- metadata +29 -25
- metadata.gz.sig +2 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1055526ebd41492464e5cdb5693539baceb8874bb1e3ad4905bc63c3fe7e5495
|
4
|
+
data.tar.gz: 2475dbbf5c778e9a907d1e7aabd3acb6166207200331b2607367f9f83e59a56b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab1262055c9050c8316b80d72f8d725152f89d7fe343bfa46b99f9c09b00d358f3b0566e18c7fae71d6fc8e660e8c6a8355067671d72ed34ac7b6f00111c376d
|
7
|
+
data.tar.gz: 7cbcc998dbce3f28551f407b10b06411f437d6bbf5f352b4a0bfc93b2414a3aebdb0ec3f06dc0bbb4afe769cb56c98e6a6b32f771bf853f5e713cb089ba7d562
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
M�
|
2
|
-
U�5X8��(�qgs{2�?+?3��n�5�_���
|
3
|
-
�����+�'�~�^�9��fhn�r7�h&��[b����`�q/�Dy�j�x�\}ȩ�7���fP��(0�<��b]\e�H�
|
1
|
+
7!��ܕea��GrnYw��M%Hğ��f�f����g���8��.�=V�qB)�/*źA`�W/2f���u��B�����i�ڮ%j��Y�e�T!S%�G��[�u�4�Wi�N���V�9ֱT���#@��ߞ�6�H|i}~:`_��gԀ��;���a��Ѳ�,�p�����/8v8��4�0dk����wT<�T�l�\�)%� Y1���6'j��J��lT*/�"Ǫ������C�H�[�nT1D �����
|
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 2.9.0 / 2019-09-24
|
2
|
+
|
3
|
+
* 3 minor enhancements:
|
4
|
+
|
5
|
+
* Added ability to specify command to run on save. (tanalab2)
|
6
|
+
* Added bg_<name> and fill_<name> methods for all colors.
|
7
|
+
* Added bgcolor shortcut method.
|
8
|
+
|
9
|
+
* 1 bug fix:
|
10
|
+
|
11
|
+
* Normalized all attribute value quoting.
|
12
|
+
|
1
13
|
=== 2.8.2 / 2016-10-09
|
2
14
|
|
3
15
|
* 2 bug fixes:
|
data/lib/graph.rb
CHANGED
@@ -7,7 +7,7 @@ require "enumerator"
|
|
7
7
|
# dot format.
|
8
8
|
|
9
9
|
class Graph
|
10
|
-
VERSION = "2.
|
10
|
+
VERSION = "2.9.0" # :nodoc:
|
11
11
|
|
12
12
|
# :stopdoc:
|
13
13
|
|
@@ -66,6 +66,8 @@ class Graph
|
|
66
66
|
|
67
67
|
(BOLD_COLORS + LIGHT_COLORS).each do |name|
|
68
68
|
define_method(name) { color name }
|
69
|
+
define_method("bg_#{name}") { bgcolor name }
|
70
|
+
define_method("fill_#{name}") { fillcolor name }
|
69
71
|
end
|
70
72
|
|
71
73
|
SHAPES.each do |name|
|
@@ -222,7 +224,7 @@ class Graph
|
|
222
224
|
# Shortcut method to create and set the graph to use a colorscheme.
|
223
225
|
|
224
226
|
def colorscheme name, n = nil
|
225
|
-
self.scheme = Attribute.new "colorscheme = #{name}#{n}"
|
227
|
+
self.scheme = Attribute.new "colorscheme = %p" % ["#{name}#{n}"]
|
226
228
|
max = COLOR_SCHEME_MAX[name.to_sym]
|
227
229
|
|
228
230
|
node_attribs << scheme if max
|
@@ -272,7 +274,14 @@ class Graph
|
|
272
274
|
# Shortcut method to create a new fillcolor Attribute instance.
|
273
275
|
|
274
276
|
def fillcolor n
|
275
|
-
Attribute.new "fillcolor =
|
277
|
+
Attribute.new "fillcolor = %p" % [n]
|
278
|
+
end
|
279
|
+
|
280
|
+
##
|
281
|
+
# Shortcut method to create a new fillcolor Attribute instance.
|
282
|
+
|
283
|
+
def bgcolor n
|
284
|
+
Attribute.new "bgcolor = %p" % [n]
|
276
285
|
end
|
277
286
|
|
278
287
|
##
|
@@ -280,7 +289,7 @@ class Graph
|
|
280
289
|
# pass in both the name and an optional font size.
|
281
290
|
|
282
291
|
def font name
|
283
|
-
Attribute.new "fontname =
|
292
|
+
Attribute.new "fontname = %p" % [name]
|
284
293
|
end
|
285
294
|
|
286
295
|
##
|
@@ -333,26 +342,27 @@ class Graph
|
|
333
342
|
##
|
334
343
|
# Saves out both a dot file to path and an image for the specified type.
|
335
344
|
# Specify type as nil to skip exporting an image.
|
345
|
+
# Specify cmd as the command name like "neato" to use a command other than "dot".
|
336
346
|
|
337
|
-
def save path, type = nil
|
347
|
+
def save path, type = nil, cmd = "dot"
|
338
348
|
File.open "#{path}.dot", "w" do |f|
|
339
349
|
f.puts self.to_s
|
340
350
|
end
|
341
|
-
system "
|
351
|
+
system "#{cmd} -T#{type} #{path}.dot > #{path}.#{type}" if type
|
342
352
|
end
|
343
353
|
|
344
354
|
##
|
345
355
|
# Shortcut method to create a new shape Attribute instance.
|
346
356
|
|
347
357
|
def shape shape
|
348
|
-
Attribute.new "shape =
|
358
|
+
Attribute.new "shape = %p" % [shape]
|
349
359
|
end
|
350
360
|
|
351
361
|
##
|
352
362
|
# Shortcut method to create a new style Attribute instance.
|
353
363
|
|
354
364
|
def style name
|
355
|
-
Attribute.new "style =
|
365
|
+
Attribute.new "style = %p" % [name]
|
356
366
|
end
|
357
367
|
|
358
368
|
##
|
data/test/test_graph.rb
CHANGED
@@ -14,6 +14,9 @@ class TestGraph < Minitest::Test
|
|
14
14
|
|
15
15
|
def assert_attribute k, v, a
|
16
16
|
assert_kind_of Graph::Attribute, a
|
17
|
+
|
18
|
+
v = v.dump if String === v
|
19
|
+
|
17
20
|
assert_equal "#{k} = #{v}", a.attr
|
18
21
|
end
|
19
22
|
|
@@ -33,7 +36,7 @@ class TestGraph < Minitest::Test
|
|
33
36
|
|
34
37
|
graph.boxes
|
35
38
|
|
36
|
-
assert_graph graph, 'node [ shape = box ]', '"a" -> "b"'
|
39
|
+
assert_graph graph, 'node [ shape = "box" ]', '"a" -> "b"'
|
37
40
|
end
|
38
41
|
|
39
42
|
def test_colorscheme
|
@@ -57,13 +60,13 @@ class TestGraph < Minitest::Test
|
|
57
60
|
end
|
58
61
|
|
59
62
|
def test_font
|
60
|
-
assert_attribute "fontname",
|
63
|
+
assert_attribute "fontname", "blah", graph.font("blah")
|
61
64
|
end
|
62
65
|
|
63
66
|
def test_font_size
|
64
67
|
# cheating... but I didn't want to write a more complex assertion
|
65
|
-
assert_attribute "fontname",
|
66
|
-
assert_attribute "fontsize",
|
68
|
+
assert_attribute "fontname", "blah", graph.font("blah")
|
69
|
+
assert_attribute "fontsize", 12, graph.fontsize(12)
|
67
70
|
end
|
68
71
|
|
69
72
|
def test_digraph
|
@@ -208,6 +211,10 @@ class TestGraph < Minitest::Test
|
|
208
211
|
assert_save nil
|
209
212
|
end
|
210
213
|
|
214
|
+
def test_save_cmd
|
215
|
+
assert_save "png", "neato"
|
216
|
+
end
|
217
|
+
|
211
218
|
def test_shape
|
212
219
|
assert_attribute "shape", "blah", graph.shape("blah")
|
213
220
|
end
|
@@ -287,7 +294,7 @@ g_s = "subgraph \"subgraph\"
|
|
287
294
|
'"a" -> "b"')
|
288
295
|
end
|
289
296
|
|
290
|
-
def assert_save type
|
297
|
+
def assert_save type, cmd = "dot"
|
291
298
|
path = File.join(Dir.tmpdir, "blah.#{$$}")
|
292
299
|
|
293
300
|
actual = expected = false
|
@@ -297,10 +304,10 @@ g_s = "subgraph \"subgraph\"
|
|
297
304
|
actual = args
|
298
305
|
end
|
299
306
|
|
300
|
-
graph.save(path, type)
|
307
|
+
graph.save(path, type, cmd)
|
301
308
|
|
302
309
|
assert_equal graph.to_s + "\n", File.read("#{path}.dot")
|
303
|
-
expected = ["
|
310
|
+
expected = ["#{cmd} -T#{type} #{path}.dot > #{path}.png"] if type
|
304
311
|
assert_equal expected, actual
|
305
312
|
ensure
|
306
313
|
File.unlink path rescue nil
|
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.
|
4
|
+
version: 2.9.0
|
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
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTE4MTIwNDIxMzAxNFoXDTE5MTIwNDIxMzAxNFowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -20,46 +20,51 @@ cert_chain:
|
|
20
20
|
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
21
21
|
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
|
-
gBEfoTEGr7Zii72cx+
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
|
23
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
+
AQCbJwLmpJR2PomLU+Zzw3KRzH/hbyUWc/ftru71AopZ1fy4iY9J/BW5QYKVYwbP
|
26
|
+
V0FSBWtvfI/RdwfKGtuGhPKECZgmLieGuZ3XCc09qPu1bdg7i/tu1p0t0c6163ku
|
27
|
+
nDMDIC/t/DAFK0TY9I3HswuyZGbLW7rgF0DmiuZdN/RPhHq2pOLMLXJmFclCb/im
|
28
|
+
9yToml/06TJdUJ5p64mkBs0TzaK66DIB1Smd3PdtfZqoRV+EwaXMdx0Hb3zdR1JR
|
29
|
+
Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
|
30
|
+
UfBugfLD19bu3nvL+zTAGx/U
|
32
31
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
32
|
+
date: 2019-09-25 00:00:00.000000000 Z
|
34
33
|
dependencies:
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
35
|
name: rdoc
|
37
36
|
requirement: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
|
-
- -
|
38
|
+
- - ">="
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
version: '4.0'
|
41
|
+
- - "<"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '7'
|
42
44
|
type: :development
|
43
45
|
prerelease: false
|
44
46
|
version_requirements: !ruby/object:Gem::Requirement
|
45
47
|
requirements:
|
46
|
-
- -
|
48
|
+
- - ">="
|
47
49
|
- !ruby/object:Gem::Version
|
48
50
|
version: '4.0'
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '7'
|
49
54
|
- !ruby/object:Gem::Dependency
|
50
55
|
name: hoe
|
51
56
|
requirement: !ruby/object:Gem::Requirement
|
52
57
|
requirements:
|
53
|
-
- - ~>
|
58
|
+
- - "~>"
|
54
59
|
- !ruby/object:Gem::Version
|
55
|
-
version: '3.
|
60
|
+
version: '3.18'
|
56
61
|
type: :development
|
57
62
|
prerelease: false
|
58
63
|
version_requirements: !ruby/object:Gem::Requirement
|
59
64
|
requirements:
|
60
|
-
- - ~>
|
65
|
+
- - "~>"
|
61
66
|
- !ruby/object:Gem::Version
|
62
|
-
version: '3.
|
67
|
+
version: '3.18'
|
63
68
|
description: "Graph is a type of hash that outputs in graphviz's dot format. It\ncomes
|
64
69
|
with a command-line interface that is easily pluggable.\n\nIt ships with plugins
|
65
70
|
to graph dependencies and status of installed\nrubygems, rake tasks, homebrew ports,
|
@@ -77,7 +82,7 @@ extra_rdoc_files:
|
|
77
82
|
- Manifest.txt
|
78
83
|
- README.txt
|
79
84
|
files:
|
80
|
-
- .autotest
|
85
|
+
- ".autotest"
|
81
86
|
- History.txt
|
82
87
|
- Manifest.txt
|
83
88
|
- README.txt
|
@@ -105,23 +110,22 @@ licenses:
|
|
105
110
|
metadata: {}
|
106
111
|
post_install_message:
|
107
112
|
rdoc_options:
|
108
|
-
- --main
|
113
|
+
- "--main"
|
109
114
|
- README.txt
|
110
115
|
require_paths:
|
111
116
|
- lib
|
112
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
118
|
requirements:
|
114
|
-
- -
|
119
|
+
- - ">="
|
115
120
|
- !ruby/object:Gem::Version
|
116
121
|
version: '0'
|
117
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
123
|
requirements:
|
119
|
-
- -
|
124
|
+
- - ">="
|
120
125
|
- !ruby/object:Gem::Version
|
121
126
|
version: '0'
|
122
127
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.4.5
|
128
|
+
rubygems_version: 3.0.6
|
125
129
|
signing_key:
|
126
130
|
specification_version: 4
|
127
131
|
summary: Graph is a type of hash that outputs in graphviz's dot format
|
metadata.gz.sig
CHANGED
@@ -1,5 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
��2�
|
4
|
-
o�p1Ǒj;T�wKh?mY�q2i���jX�Օ
|
5
|
-
at�I�-�{��Ld�w�}c�j"��Ao=�H��K/����Ѳ�9�$�,2O��ӂ��o�HKLթB;Nxa;�M��ȷA�{��J��{�&�0#v�)����F� .��7ՆW��
|
1
|
+
�5RQ0u~�S�m��Cֹ�k{,��.ƍ���C�5�H�$�ߨKT<V2Z��mT ��!ҹ㷺�/H����I��i'��Lb�ir��� �ji�LQ̺fL��F�/��={�I��!t\0R
|
2
|
+
p�u�OMS��
|