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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc56bd705f7f947d8a102c45fce44175009072fb
4
- data.tar.gz: 6844ce99440dc27ae28274834c664105c9b6c933
3
+ metadata.gz: b9fc1ec90204eb72f848a5c9bc973a61247c6831
4
+ data.tar.gz: 23a413f682e660bae85ab5177c7d475facec7b47
5
5
  SHA512:
6
- metadata.gz: 33377a56d1cc87f353e8b25e20ec69497ee16658c95c5fc04c2d21c7e83a45f36db01fdca72389aa53514c33b4803bc27a578e4d262e7c9288a968ae7f9aefc1
7
- data.tar.gz: e73c9e4e61380c76c4af81be6142ec552babe75552e259e9bb9180ba3add1c701c01da4fd7a5d9c18aecf146936801dca63cdf9e4008d721b95c9cfbb952929b
6
+ metadata.gz: 9e224b09004a6e518ff1afeea408afce2859827e7eb102ef34ec9b5b9da7318beec4896743c0063c2684d3a5430a0735fdb188ba045029c5e9d3965d1a5274b8
7
+ data.tar.gz: d1311d31a86ce31cf6d78897208dd98f6bdd6c4017ce5f359eb2ba2a91a2206772266a13f3d1d5d169fdd66bbf1fb0a42b29aa7a457c1f3c96cfac48be9a3594
@@ -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
- add("#{method.object_id} [label=\"#{name}\"];")
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 = #{CLASS_COLOR};")
59
- add('fontsize = 16;', "color = #{CLASS_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 = "label=\"#{label}\" fontsize=10 fontcolor=#{EDGE_COLOR}"
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
@@ -1,3 +1,3 @@
1
1
  module Rdepend
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdepend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarra