graph 2.9.1 → 2.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af64b3f26006744d244cdbca2121b4becd02ba3d0d35cde23ad6cc7375f65b21
4
- data.tar.gz: 8a98b539f86515ad7c0501b3fdc8e2b6dc853a2c95995a24a0ac1d8ebf8ddd37
3
+ metadata.gz: 6a2c55cdc8067ac15364fb4e15fa932fc9f5817df6312e16f429b2e608be5d11
4
+ data.tar.gz: b7b2f117ffe778de6b9a7e7b10b0ac9ef17e414ce47ab0bc2d134ee42e589e12
5
5
  SHA512:
6
- metadata.gz: 46061f9853636f3706242e18967085eb31763774fd7e00e5c43238e9e98c75c416797f1c8337cf984e3498e095824e4b1f24860abc7262064a354944689a4e27
7
- data.tar.gz: 7f7b5c2aa74b1d8dbd1d1d690ac4ceb26102d358a1767490308e0d370067310bfb75d352887e01b648c7df41a43a3d3cf46ed18fa6156fbab03cf2d1f627d7c4
6
+ metadata.gz: 582deb9ceb20d0aaba280a2fcde293a727bee802850f02da4678e8993c50586d8de3a9b21216b56cbe2774833c4a5cfc9a87118b5f989a918b6cfabfe2e61d67
7
+ data.tar.gz: 15b572f55a752e17bc01469ca24bf13ffb63a906aead7f653cd3bcb7135e51a9f2bb860e2d04fbcadcc783f830fb21dd1cf0eb1aae532bd13e883e5848774384
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,11 @@
1
+ === 2.10.0 / 2020-02-09
2
+
3
+ * 3 minor enhancements:
4
+
5
+ * Added compact! shortcut (rotate + boxes--good for code/text graphs).
6
+ * Added fontcolor shortcut.
7
+ * Improved homebrew analyzer to include outdated casks & added caching.
8
+
1
9
  === 2.9.1 / 2019-12-14
2
10
 
3
11
  * 1 bug fix:
@@ -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/
@@ -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.10.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,45 @@ 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 cask list #{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 cask outdated #{SHH}`
25
+ ports + casks
26
+ end
27
+
28
+ def alldeps
29
+ @alldeps ||= `brew deps --installed`
30
+ .lines
31
+ .map { |l| k, *v = l.delete(":").split; [clean(k), v] }
32
+ .to_h
16
33
  end
17
34
 
18
35
  def deps port
19
- `brew deps #{port}`.scan(/\S+/)
36
+ return [] if @casks.include? port
37
+ alldeps[port] ||= `brew deps #{port}`.scan(/\S+/)
38
+ end
39
+
40
+ def normal lines
41
+ lines.split(/\n/).map { |s| clean s }
42
+ end
43
+
44
+ def clean name
45
+ name.split("/").last
20
46
  end
21
47
  end
@@ -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'
@@ -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"
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.9.1
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  m5x9IDiApM+vCELNwDXXGNFEnQBBK+wAe4Pek8o1V1TTOxL1kGPewVOitX1p3xoN
30
30
  h7iEjga8iM1LbZUfiISZ+WrB
31
31
  -----END CERTIFICATE-----
32
- date: 2019-12-15 00:00:00.000000000 Z
32
+ date: 2020-02-10 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.22'
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.22'
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,
metadata.gz.sig CHANGED
Binary file