rdepend 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rdepend/printer.rb +16 -6
- data/lib/rdepend/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9fc1ec90204eb72f848a5c9bc973a61247c6831
|
4
|
+
data.tar.gz: 23a413f682e660bae85ab5177c7d475facec7b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e224b09004a6e518ff1afeea408afce2859827e7eb102ef34ec9b5b9da7318beec4896743c0063c2684d3a5430a0735fdb188ba045029c5e9d3965d1a5274b8
|
7
|
+
data.tar.gz: d1311d31a86ce31cf6d78897208dd98f6bdd6c4017ce5f359eb2ba2a91a2206772266a13f3d1d5d169fdd66bbf1fb0a42b29aa7a457c1f3c96cfac48be9a3594
|
data/lib/rdepend/printer.rb
CHANGED
@@ -3,10 +3,12 @@ require 'set'
|
|
3
3
|
|
4
4
|
module Rdepend
|
5
5
|
class Printer < RubyProf::AbstractPrinter
|
6
|
-
CLASS_COLOR = '"#666666"'
|
7
6
|
EDGE_COLOR = '"#666666"'
|
8
7
|
|
8
|
+
attr_reader :color
|
9
|
+
|
9
10
|
def initialize(result)
|
11
|
+
reset_color
|
10
12
|
super(result)
|
11
13
|
@seen_methods = Set.new
|
12
14
|
end
|
@@ -22,6 +24,11 @@ module Rdepend
|
|
22
24
|
|
23
25
|
private
|
24
26
|
|
27
|
+
def reset_color
|
28
|
+
color = (0...6).map { |_| '1234567890ABCDEF'.split(//).sample }.join
|
29
|
+
@color = "\"##{color}\""
|
30
|
+
end
|
31
|
+
|
25
32
|
def print_threads
|
26
33
|
@result.threads.each do |thread|
|
27
34
|
add("subgraph \"Thread #{thread.id}\" {")
|
@@ -34,7 +41,9 @@ module Rdepend
|
|
34
41
|
def print_thread(thread)
|
35
42
|
thread.methods.sort_by(&sort_method).reverse_each do |method|
|
36
43
|
name = method_name(method).split('#').last
|
37
|
-
|
44
|
+
reset_color
|
45
|
+
colors = "color=#{color}; fontcolor=#{color}; fontsize=14"
|
46
|
+
add("#{method.object_id} [label=\"#{name}\"; #{colors}];")
|
38
47
|
@seen_methods << method
|
39
48
|
print_edges(method)
|
40
49
|
end
|
@@ -54,17 +63,18 @@ module Rdepend
|
|
54
63
|
|
55
64
|
def print_methods(cls, methods)
|
56
65
|
return if methods.empty?
|
66
|
+
reset_color
|
57
67
|
add("subgraph cluster_#{cls.object_id} {")
|
58
|
-
add("label = \"#{cls}\";", "fontcolor = #{
|
59
|
-
add('fontsize = 16;', "color = #{
|
68
|
+
add("label = \"#{cls}\";", "fontcolor = #{color};")
|
69
|
+
add('fontsize = 16;', "color = #{color};")
|
60
70
|
methods.each { |m| add("#{m.object_id};") }
|
61
71
|
add('}')
|
62
72
|
end
|
63
73
|
|
64
74
|
def print_edges(method)
|
65
75
|
method.aggregate_children.each do |child|
|
66
|
-
label = "#{child.called}/#{child.target.called}"
|
67
|
-
label = "
|
76
|
+
label = "label=\"#{child.called}/#{child.target.called}\""
|
77
|
+
label = "fontsize=10 color=#{color} fontcolor=#{EDGE_COLOR}"
|
68
78
|
add("#{method.object_id} -> #{child.target.object_id} [#{label}];")
|
69
79
|
end
|
70
80
|
end
|
data/lib/rdepend/version.rb
CHANGED