graph 2.0.1 → 2.1.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.
- data.tar.gz.sig +0 -0
- data/History.txt +13 -0
- data/bin/graph +16 -4
- data/lib/dep_analyzer.rb +1 -1
- data/lib/graph.rb +3 -3
- data/lib/rake_analyzer.rb +3 -3
- data/lib/rubygems/commands/graph_command.rb +2 -1
- data/lib/rubygems_analyzer.rb +6 -5
- data/test/test_graph.rb +18 -0
- metadata +10 -12
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 2.1.0 / 2011-05-26
|
2
|
+
|
3
|
+
* 3 minor enhancements:
|
4
|
+
|
5
|
+
* If bin/graph isn't given a type, list them and exit.
|
6
|
+
* Updated RubygemsAnalyzer to work with new API.
|
7
|
+
* `graph` command no longer defaults to any analyzer.
|
8
|
+
|
9
|
+
* 2 bug fixes:
|
10
|
+
|
11
|
+
* Escape newlines in labels. (rohitn)
|
12
|
+
* Refactored all saving code to bin/graph for clarity.
|
13
|
+
|
1
14
|
=== 2.0.1 / 2011-02-18
|
2
15
|
|
3
16
|
* 2 minor enhancements:
|
data/bin/graph
CHANGED
@@ -3,12 +3,24 @@
|
|
3
3
|
$o ||= false
|
4
4
|
$d ||= false
|
5
5
|
|
6
|
-
type
|
6
|
+
type = ARGV.shift
|
7
|
+
unless type then
|
8
|
+
require "rubygems"
|
9
|
+
|
10
|
+
hits = Gem.find_files("*_analyzer.rb").map { |s|
|
11
|
+
File.basename s, "_analyzer.rb"
|
12
|
+
} - %w(dep)
|
13
|
+
|
14
|
+
abort "#{File.basename $0}: Need a type: #{hits.join(", ")}"
|
15
|
+
end
|
7
16
|
|
8
17
|
require "#{type}_analyzer"
|
9
18
|
|
10
|
-
|
19
|
+
name = "#{type.capitalize}Analyzer"
|
20
|
+
klass = Object.const_get name
|
11
21
|
analyzer = klass.new
|
12
|
-
analyzer.run
|
22
|
+
graph = analyzer.run
|
23
|
+
|
24
|
+
graph.save name, $d ? nil : "png"
|
13
25
|
|
14
|
-
system "open #{
|
26
|
+
system "open #{name}.#{$d ? "dot" : "png"}" if $o
|
data/lib/dep_analyzer.rb
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.0
|
10
|
+
VERSION = "2.1.0" # :nodoc:
|
11
11
|
|
12
12
|
LIGHT_COLORS = %w(gray lightblue lightcyan lightgray lightpink
|
13
13
|
lightslategray lightsteelblue white)
|
@@ -197,7 +197,7 @@ class Graph
|
|
197
197
|
# Shortcut method to set the graph's label. Usually used with subgraphs.
|
198
198
|
|
199
199
|
def label name
|
200
|
-
graph_attribs << "label = \"#{name}\""
|
200
|
+
graph_attribs << "label = \"#{name.gsub(/\n/, '\n')}\""
|
201
201
|
end
|
202
202
|
|
203
203
|
##
|
@@ -349,7 +349,7 @@ class Graph
|
|
349
349
|
|
350
350
|
def label name
|
351
351
|
attributes.reject! { |s| s =~ /^label =/ }
|
352
|
-
attributes << "label = \"#{name}\""
|
352
|
+
attributes << "label = \"#{name.gsub(/\n/, '\n')}\""
|
353
353
|
self
|
354
354
|
end
|
355
355
|
|
data/lib/rake_analyzer.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "rubygems"
|
1
2
|
require 'dep_analyzer'
|
2
3
|
|
3
4
|
class RakeAnalyzer < DepAnalyzer
|
@@ -8,8 +9,9 @@ class RakeAnalyzer < DepAnalyzer
|
|
8
9
|
|
9
10
|
current = nil
|
10
11
|
rake = Gem.bin_path('rake', 'rake') rescue 'rake'
|
12
|
+
path = $:.join File::PATH_SEPARATOR
|
11
13
|
|
12
|
-
`#{Gem.ruby} -I#{
|
14
|
+
`#{Gem.ruby} -I#{path} -S #{rake} -P -s`.each_line do |line|
|
13
15
|
case line
|
14
16
|
when /^rake (.+)/
|
15
17
|
name = $1
|
@@ -23,8 +25,6 @@ class RakeAnalyzer < DepAnalyzer
|
|
23
25
|
warn "unparsed: #{line.chomp}"
|
24
26
|
end
|
25
27
|
end
|
26
|
-
|
27
|
-
save "RakeAnalyzer", "png"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/rubygems_analyzer.rb
CHANGED
@@ -12,17 +12,18 @@ class RubygemsAnalyzer < DepAnalyzer
|
|
12
12
|
def installed
|
13
13
|
# don't cache so it updates every delete
|
14
14
|
puts "scanning installed rubygems"
|
15
|
-
Gem.
|
15
|
+
Gem::Specification.map(&:name).sort
|
16
16
|
end
|
17
17
|
|
18
18
|
def outdated
|
19
19
|
# don't cache so it updates every delete
|
20
20
|
puts "scanning outdated rubygems"
|
21
|
-
Gem.
|
21
|
+
Gem::Specification.outdated.sort
|
22
22
|
end
|
23
23
|
|
24
|
-
def deps
|
25
|
-
|
24
|
+
def deps gem_name
|
25
|
+
gem = Gem::Specification.find_by_name gem_name
|
26
|
+
gem.dependencies
|
26
27
|
end
|
27
28
|
|
28
29
|
def decorate
|
@@ -31,7 +32,7 @@ class RubygemsAnalyzer < DepAnalyzer
|
|
31
32
|
installed = self.installed
|
32
33
|
|
33
34
|
installed.each do |gem|
|
34
|
-
deps =
|
35
|
+
deps = self.deps gem
|
35
36
|
|
36
37
|
deps.each do |dep|
|
37
38
|
next if dep.type == :runtime
|
data/test/test_graph.rb
CHANGED
@@ -82,6 +82,12 @@ class TestGraph < MiniTest::Unit::TestCase
|
|
82
82
|
assert_graph graph, 'label = "blah"', '"a" -> "b"'
|
83
83
|
end
|
84
84
|
|
85
|
+
def test_label_newline
|
86
|
+
graph.label "blah\nblah"
|
87
|
+
|
88
|
+
assert_graph graph, 'label = "blah\\nblah"', '"a" -> "b"'
|
89
|
+
end
|
90
|
+
|
85
91
|
def test_left_shift
|
86
92
|
subgraph = Graph.new "blah"
|
87
93
|
|
@@ -283,6 +289,12 @@ class TestNode < MiniTest::Unit::TestCase
|
|
283
289
|
assert_equal ["label = \"blah\""], n.attributes
|
284
290
|
end
|
285
291
|
|
292
|
+
def test_label_newline
|
293
|
+
n.label "blah\nblah"
|
294
|
+
|
295
|
+
assert_equal ["label = \"blah\\nblah\""], n.attributes
|
296
|
+
end
|
297
|
+
|
286
298
|
def test_to_s
|
287
299
|
assert_equal '"n"', n.to_s
|
288
300
|
end
|
@@ -309,6 +321,12 @@ class TestEdge < MiniTest::Unit::TestCase
|
|
309
321
|
assert_equal ["label = \"blah\""], e.attributes
|
310
322
|
end
|
311
323
|
|
324
|
+
def test_label_newline
|
325
|
+
e.label "blah\nblah"
|
326
|
+
|
327
|
+
assert_equal ["label = \"blah\\nblah\""], e.attributes
|
328
|
+
end
|
329
|
+
|
312
330
|
def test_to_s
|
313
331
|
assert_equal '"a" -> "b"', e.to_s
|
314
332
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,8 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2011-
|
40
|
-
default_executable:
|
39
|
+
date: 2011-05-27 00:00:00 Z
|
41
40
|
dependencies:
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: minitest
|
@@ -50,9 +49,9 @@ dependencies:
|
|
50
49
|
hash: 11
|
51
50
|
segments:
|
52
51
|
- 2
|
52
|
+
- 1
|
53
53
|
- 0
|
54
|
-
|
55
|
-
version: 2.0.2
|
54
|
+
version: 2.1.0
|
56
55
|
type: :development
|
57
56
|
version_requirements: *id001
|
58
57
|
- !ruby/object:Gem::Dependency
|
@@ -63,12 +62,12 @@ dependencies:
|
|
63
62
|
requirements:
|
64
63
|
- - ">="
|
65
64
|
- !ruby/object:Gem::Version
|
66
|
-
hash:
|
65
|
+
hash: 35
|
67
66
|
segments:
|
68
67
|
- 2
|
69
68
|
- 9
|
70
|
-
-
|
71
|
-
version: 2.9.
|
69
|
+
- 4
|
70
|
+
version: 2.9.4
|
72
71
|
type: :development
|
73
72
|
version_requirements: *id002
|
74
73
|
description: |-
|
@@ -121,7 +120,6 @@ files:
|
|
121
120
|
- lib/rubygems_plugin.rb
|
122
121
|
- test/test_graph.rb
|
123
122
|
- .gemtest
|
124
|
-
has_rdoc: true
|
125
123
|
homepage: http://rubyforge.org/projects/seattlerb
|
126
124
|
licenses: []
|
127
125
|
|
@@ -152,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
150
|
requirements: []
|
153
151
|
|
154
152
|
rubyforge_project: seattlerb
|
155
|
-
rubygems_version: 1.
|
153
|
+
rubygems_version: 1.8.3
|
156
154
|
signing_key:
|
157
155
|
specification_version: 3
|
158
156
|
summary: Graph is a type of hash that outputs in graphviz's dot format
|
metadata.gz.sig
CHANGED
Binary file
|