graph 2.9.1 → 2.11.0

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: af64b3f26006744d244cdbca2121b4becd02ba3d0d35cde23ad6cc7375f65b21
4
- data.tar.gz: 8a98b539f86515ad7c0501b3fdc8e2b6dc853a2c95995a24a0ac1d8ebf8ddd37
3
+ metadata.gz: 9e3e77a037eb6a1d0590ecc38940bc5f043562af70e1cdf0f3ed1ab8c3c24634
4
+ data.tar.gz: a5682ec5e678f9330afc4c853132746398991118043ec295269ab724f32c30cf
5
5
  SHA512:
6
- metadata.gz: 46061f9853636f3706242e18967085eb31763774fd7e00e5c43238e9e98c75c416797f1c8337cf984e3498e095824e4b1f24860abc7262064a354944689a4e27
7
- data.tar.gz: 7f7b5c2aa74b1d8dbd1d1d690ac4ceb26102d358a1767490308e0d370067310bfb75d352887e01b648c7df41a43a3d3cf46ed18fa6156fbab03cf2d1f627d7c4
6
+ metadata.gz: 6a6736ea7c648eb10201c0c89ec7f5921a99c44e2efc142caf8bbe58ea2494ec5b71dc87c72aef39f572639693415b63590f36231d94a801d893206c012bda22
7
+ data.tar.gz: 573fd706cca92c52a0580fec4f18f0033bc17dbe9a6b223f0f00598fb2bc735781d6731492473dceafd379da6260bff740d86b6ae86662ceebe3f7d512d129dd
checksums.yaml.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,22 @@
1
+ === 2.11.0 / 2022-09-29
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added -r to bin/graph to rotate the image 90 degrees.
6
+ * Trying to improve the output of dep_analyzer (rects + better coloring).
7
+
8
+ * 1 bug fix:
9
+
10
+ * Fixes for homebrew_analyzer to deal with homebrew changes / yet-more-bugs.
11
+
12
+ === 2.10.0 / 2020-02-09
13
+
14
+ * 3 minor enhancements:
15
+
16
+ * Added compact! shortcut (rotate + boxes--good for code/text graphs).
17
+ * Added fontcolor shortcut.
18
+ * Improved homebrew analyzer to include outdated casks & added caching.
19
+
1
20
  === 2.9.1 / 2019-12-14
2
21
 
3
22
  * 1 bug fix:
data/bin/graph CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby -ws
2
2
 
3
- $o ||= false
4
- $d ||= false
3
+ $o ||= false # open after creating
4
+ $d ||= false # dot file only
5
+ $r ||= false # rotate 90°
5
6
 
6
7
  type = ARGV.shift
7
8
  unless type then
@@ -21,6 +22,8 @@ klass = Object.const_get name
21
22
  analyzer = klass.new
22
23
  graph = analyzer.run
23
24
 
25
+ graph.rotate if $r
26
+
24
27
  huge = graph.nodes.size + graph.edges.size > 500
25
28
  ext = $d ? nil : huge ? "pdf" : "png"
26
29
 
@@ -3,8 +3,7 @@
3
3
  require "graph"
4
4
 
5
5
  digraph do
6
- rotate
7
- boxes
6
+ compact!
8
7
 
9
8
  ObjectSpace.each_object Class do |mod|
10
9
  next if mod.name =~ /Errno/
data/lib/dep_analyzer.rb CHANGED
@@ -170,16 +170,20 @@ class DepAnalyzer < Cache
170
170
  ports[port] = deps
171
171
  end
172
172
 
173
+ rect = g.rect
173
174
  blue = g.color "blue"
174
175
  purple = g.color "purple4"
175
176
  red = g.color "red"
177
+ pink = g.fill_lightpink
176
178
 
177
179
  indies = ports.keys - ports.minvert.keys
178
180
  indies.each do |k|
181
+ rect << g[k]
179
182
  blue << g[k]
180
183
  end
181
184
 
182
185
  old.each do |k,v|
186
+ pink << g[k]
183
187
  if indies.include? k then
184
188
  purple << g[k]
185
189
  else
data/lib/graph.rb CHANGED
@@ -7,7 +7,7 @@ require "enumerator"
7
7
  # dot format.
8
8
 
9
9
  class Graph
10
- VERSION = "2.9.1" # :nodoc:
10
+ VERSION = "2.11.0" # :nodoc:
11
11
 
12
12
  # :stopdoc:
13
13
 
@@ -292,6 +292,13 @@ class Graph
292
292
  Attribute.new "fontname = %p" % [name]
293
293
  end
294
294
 
295
+ ##
296
+ # Shortcut method to create a new fontcolor Attribute instance.
297
+
298
+ def fontcolor name
299
+ Attribute.new "fontcolor = %p" % [name]
300
+ end
301
+
295
302
  ##
296
303
  # Shortcut method to create a new fontsize Attribute instance.
297
304
 
@@ -339,6 +346,15 @@ class Graph
339
346
  orient dir
340
347
  end
341
348
 
349
+ ##
350
+ # Shortcut method to rotate and use boxes. Helps compact when there
351
+ # is lots of long text nodes.
352
+
353
+ def compact!
354
+ rotate
355
+ boxes
356
+ end
357
+
342
358
  ##
343
359
  # Saves out both a dot file to path and an image for the specified type.
344
360
  # Specify type as nil to skip exporting an image.
@@ -3,19 +3,56 @@ require 'dep_analyzer'
3
3
  # :stopdoc:
4
4
 
5
5
  class HomebrewAnalyzer < DepAnalyzer
6
+ SHH = "2> /dev/null"
7
+
8
+ attr_accessor :casks
9
+
6
10
  def installed
7
11
  # don't cache so it updates every delete
8
12
  puts "scanning installed ports"
9
- `brew list`.scan(/\S+/).map { |s| s.split.first }
13
+ ports = normal `brew list #{SHH}`
14
+ puts "scanning installed casks"
15
+ self.casks = normal `brew list --cask #{SHH}`
16
+ ports + casks
10
17
  end
11
18
 
12
19
  def outdated
13
20
  # don't cache so it updates every delete
14
21
  puts "scanning outdated ports"
15
- `brew outdated`.split(/\n/).map { |s| s.split.first }
22
+ ports = normal `brew outdated #{SHH}`
23
+ puts "scanning outdated casks"
24
+ casks = normal `brew outdated --cask #{SHH}`
25
+ ports + casks
26
+ end
27
+
28
+ def alldeps
29
+ # there's YET ANOTHER bug in homebrew whereby `brew deps -1
30
+ # --installed` output is painfully different from all other output:
31
+ #
32
+ # % brew deps -1 --for-each pango
33
+ # pango: cairo fontconfig freetype fribidi glib harfbuzz
34
+ # % brew deps -1 --installed | grep pango
35
+ # pango: cairo
36
+
37
+ @alldeps ||= begin
38
+ full_names = `brew list --full-name`.split
39
+ `brew deps -n1 --for-each #{full_names.join " "}`
40
+ .lines
41
+ .map { |l| k, *v = l.delete(":").split; [clean(k), v] }
42
+ .to_h
43
+ end
16
44
  end
17
45
 
18
46
  def deps port
19
- `brew deps #{port}`.scan(/\S+/)
47
+ return [] if @casks.include? port
48
+ alldeps[port] ||= `brew deps #{port}`.scan(/\S+/)
49
+ end
50
+
51
+ def normal lines
52
+ lines.split(/\n/).map { |s| clean s }
53
+ end
54
+
55
+ def clean name
56
+ name.split("/").last
20
57
  end
21
58
  end
data/lib/rake_analyzer.rb CHANGED
@@ -6,8 +6,7 @@ require 'dep_analyzer'
6
6
  class RakeAnalyzer < DepAnalyzer
7
7
  def run
8
8
  digraph do
9
- rotate
10
- boxes
9
+ compact!
11
10
 
12
11
  current = nil
13
12
  rake = Gem.bin_path('rake', 'rake') rescue 'rake'
data/test/test_graph.rb CHANGED
@@ -69,6 +69,10 @@ class TestGraph < Minitest::Test
69
69
  assert_attribute "fontsize", 12, graph.fontsize(12)
70
70
  end
71
71
 
72
+ def test_font_color
73
+ assert_attribute "fontcolor", "white", graph.fontcolor("white")
74
+ end
75
+
72
76
  def test_digraph
73
77
  g = digraph do
74
78
  edge "a", "b", "c"
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- K�N� �2!��z(N�K�[}�
2
- ^"M #�����3��w�D�t��]�~�k`���ɿ5��J4�^�"�'�l)y����r!�~���Ûj�K��j��>�Zp🯣�Z���QCs@��9K��R��h�@��4�&z V hH���>I.f����WT��Dq��M�� ��9
1
+ 8d4;;����
2
+ 8Q8IR��I�#8˓���{�ch���ĝ�9%x�~�x$��2lG�<�#G�k$�q3 s���H�\l+K�j?Ǔ�O�ǖ:�JWj<ayI�!ֹB=Q�R��վʣ�ѝ<fҿ %� N�!����虝�yG�(v����v��(����Ӱ�'�|v> u:��5\��<6t����p {<E���rg<�wX���H�K7�M��4lj ��RЅ��:Q��)o�e�v
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBBDANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE5MTIxMzAwMDIwNFoXDTIwMTIxMjAwMDIwNFowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
- AQCkkcHqAa6IKLYGl93rn78J3L+LnqyxaA059n4IGMHWN5bv9KBQnIjOrpLadtYZ
26
- vhWkunWDKdfVapBEq5+T4HzqnsEXC3aCv6JEKJY6Zw7iSzl0M8hozuzRr+w46wvT
27
- fV2yTN6QTVxqbMsJJyjosks4ZdQYov2zdvQpt1HsLi+Qmckmg8SPZsd+T8uiiBCf
28
- b+1ORSM5eEfBQenPXy83LZcoQz8i6zVB4aAfTGGdhxjoMGUEmSZ6xpkOzmnGa9QK
29
- m5x9IDiApM+vCELNwDXXGNFEnQBBK+wAe4Pek8o1V1TTOxL1kGPewVOitX1p3xoN
30
- h7iEjga8iM1LbZUfiISZ+WrB
25
+ AQCKB5jfsuSnKb+t/Wrh3UpdkmX7TrEsjVmERC0pPqzQ5GQJgmEXDD7oMgaKXaAq
26
+ x2m+KSZDrqk7c8uho5OX6YMqg4KdxehfSLqqTZGoeV78qwf/jpPQZKTf+W9gUSJh
27
+ zsWpo4K50MP+QtdSbKXZwjAafpQ8hK0MnnZ/aeCsW9ov5vdXpYbf3dpg6ADXRGE7
28
+ lQY2y1tJ5/chqu6h7dQmnm2ABUqx9O+JcN9hbCYoA5i/EeubUEtFIh2w3SpO6YfB
29
+ JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
30
+ YsuyUzsMz6GQA4khyaMgKNSD
31
31
  -----END CERTIFICATE-----
32
- date: 2019-12-15 00:00:00.000000000 Z
32
+ date: 2022-09-29 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rdoc
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '3.20'
60
+ version: '3.25'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '3.20'
67
+ version: '3.25'
68
68
  description: "Graph is a type of hash that outputs in graphviz's dot format. It\ncomes
69
69
  with a command-line interface that is easily pluggable.\n\nIt ships with plugins
70
70
  to graph dependencies and status of installed\nrubygems, rake tasks, homebrew ports,
@@ -109,7 +109,7 @@ licenses:
109
109
  - MIT
110
110
  metadata:
111
111
  homepage_uri: https://github.com/seattlerb/graph
112
- post_install_message:
112
+ post_install_message:
113
113
  rdoc_options:
114
114
  - "--main"
115
115
  - README.txt
@@ -126,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.0.3
130
- signing_key:
129
+ rubygems_version: 3.3.12
130
+ signing_key:
131
131
  specification_version: 4
132
132
  summary: Graph is a type of hash that outputs in graphviz's dot format
133
133
  test_files: []
metadata.gz.sig CHANGED
Binary file