rdot 1.0.4 → 1.1.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -1
- data/bin/rbdot +4 -0
- data/bin/rdot +20 -2
- data/lib/rbdot.rb +54 -0
- data/lib/rdot-common.rb +27 -0
- data/lib/rdot.rb +42 -43
- metadata +8 -4
data/README.md
CHANGED
@@ -113,6 +113,9 @@
|
|
113
113
|
'monospace' by default.
|
114
114
|
--font-size=size Font size for main text (pt).
|
115
115
|
9 by default.
|
116
|
+
|
117
|
+
--graph-splines=mode Edges form in graph.
|
118
|
+
'spline' by default.
|
116
119
|
Colors:
|
117
120
|
May be RGB value or name from X11 scheme,
|
118
121
|
see http://graphviz.org/content/color-names#x11.
|
@@ -136,7 +139,7 @@
|
|
136
139
|
--color-module-preloaded=color
|
137
140
|
Background color of preloaded module title.
|
138
141
|
#CCCCEE by default.
|
139
|
-
--color-
|
142
|
+
--color-modude-core=color Background color of core modude title.
|
140
143
|
#DDDDFF by default.
|
141
144
|
--color-protected=color Background color for protected methods.
|
142
145
|
#EEEEEE by default.
|
data/bin/rbdot
ADDED
data/bin/rdot
CHANGED
@@ -385,6 +385,24 @@ else
|
|
385
385
|
options[:node_fontsize] = value
|
386
386
|
end
|
387
387
|
|
388
|
+
o.separator ''
|
389
|
+
|
390
|
+
o.on '--graph-splines', '=mode',
|
391
|
+
[
|
392
|
+
'none',
|
393
|
+
'line',
|
394
|
+
'polyline',
|
395
|
+
'curved',
|
396
|
+
'ortho',
|
397
|
+
'spline',
|
398
|
+
'true',
|
399
|
+
'false'
|
400
|
+
],
|
401
|
+
'Edges form in graph.',
|
402
|
+
" '#{RDot::defaults[:graph_splines]}' by default." do |value|
|
403
|
+
options[:graph_splines] = value
|
404
|
+
end
|
405
|
+
|
388
406
|
o.separator "Colors:\n" +
|
389
407
|
' May by RGB value or name from X11 scheme,' + "\n" +
|
390
408
|
' see http://graphviz.org/content/color-names#x11.'
|
@@ -435,8 +453,8 @@ else
|
|
435
453
|
options[:color_module_preloaded] = value
|
436
454
|
end
|
437
455
|
|
438
|
-
o.on '--color-
|
439
|
-
'Background color of core
|
456
|
+
o.on '--color-modude-core', '=color', String,
|
457
|
+
'Background color of core modude title.',
|
440
458
|
" #{RDot::defaults[:color_module_core]} by default." do |value|
|
441
459
|
options[:color_module_core] = value
|
442
460
|
end
|
data/lib/rbdot.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rdot-common'
|
4
|
+
|
5
|
+
module Kernel
|
6
|
+
|
7
|
+
alias :rbdot_original_require :require
|
8
|
+
|
9
|
+
def require lib
|
10
|
+
result = rbdot_original_require lib
|
11
|
+
end
|
12
|
+
|
13
|
+
private :rbdot_original_require, :require
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
module RbDot
|
18
|
+
|
19
|
+
EXTENSIONS = ['.rb', '.so', '.o', '.dll']
|
20
|
+
|
21
|
+
class << self
|
22
|
+
|
23
|
+
def find_file name
|
24
|
+
case File.extname(name).downcase
|
25
|
+
when *EXTENSIONS
|
26
|
+
return name
|
27
|
+
else
|
28
|
+
EXTENSIONS.each do |ext|
|
29
|
+
fn = name + ext
|
30
|
+
$:.each do |path|
|
31
|
+
if File.exists?(File.join(path, fn))
|
32
|
+
return fn
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def register_link from_file, from_line, to
|
41
|
+
@links ||= []
|
42
|
+
link = {
|
43
|
+
:from => {
|
44
|
+
:file => RDot.get_file(from_file),
|
45
|
+
:line => from_line
|
46
|
+
},
|
47
|
+
:to => find_file(to)
|
48
|
+
}
|
49
|
+
@links << link
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/rdot-common.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module RDot
|
4
|
+
|
5
|
+
VERSION = '1.1.0'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def get_file file
|
10
|
+
src = File.expand_path file
|
11
|
+
$:.each do |dir|
|
12
|
+
dir = File.expand_path dir
|
13
|
+
len = dir.length
|
14
|
+
if src[0...len] == dir
|
15
|
+
src = src[len..-1]
|
16
|
+
if src[0] == '/'
|
17
|
+
src = src[1..-1]
|
18
|
+
end
|
19
|
+
return src
|
20
|
+
end
|
21
|
+
end
|
22
|
+
return file
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/rdot.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'is/monkey/sandbox'
|
4
4
|
require 'is/monkey/namespace'
|
5
|
+
require 'rdot-common'
|
5
6
|
|
6
7
|
# @private
|
7
8
|
class Module
|
@@ -69,8 +70,6 @@ end
|
|
69
70
|
|
70
71
|
module RDot
|
71
72
|
|
72
|
-
VERSION = '1.0.4'
|
73
|
-
|
74
73
|
class << self
|
75
74
|
|
76
75
|
# @private
|
@@ -86,23 +85,6 @@ module RDot
|
|
86
85
|
end
|
87
86
|
end
|
88
87
|
|
89
|
-
# @private
|
90
|
-
def get_file file
|
91
|
-
src = File.expand_path file
|
92
|
-
$:.each do |dir|
|
93
|
-
dir = File.expand_path dir
|
94
|
-
len = dir.length
|
95
|
-
if src[0...len] == dir
|
96
|
-
src = src[len..-1]
|
97
|
-
if src[0] == '/'
|
98
|
-
src = src[1..-1]
|
99
|
-
end
|
100
|
-
return src
|
101
|
-
end
|
102
|
-
end
|
103
|
-
return file
|
104
|
-
end
|
105
|
-
|
106
88
|
# @private
|
107
89
|
def get_method_object mod, scope, name
|
108
90
|
case scope
|
@@ -313,8 +295,10 @@ module RDot
|
|
313
295
|
result[:module] = base[:module]
|
314
296
|
result[:superclass] = base[:superclass]
|
315
297
|
result[:nested] = base[:nested]
|
316
|
-
result[:included] = base[:included] - other[:included]
|
317
|
-
|
298
|
+
result[:included] = base[:included] # - other[:included]
|
299
|
+
test_included = base[:included] - other[:included]
|
300
|
+
result[:extended] = base[:extended] # - other[:extended]
|
301
|
+
test_extended = base[:extended] - other[:extended]
|
318
302
|
result[:constants] = {}
|
319
303
|
if base[:constants]
|
320
304
|
base[:constants].each do |c|
|
@@ -342,7 +326,7 @@ module RDot
|
|
342
326
|
end
|
343
327
|
end
|
344
328
|
end
|
345
|
-
if
|
329
|
+
if test_included.empty? && test_extended.empty? &&
|
346
330
|
result[:constants].empty? && result[:class].nil? &&
|
347
331
|
result[:instance].nil?
|
348
332
|
nil
|
@@ -396,21 +380,31 @@ module RDot
|
|
396
380
|
:graph_label => 'RDot Graph',
|
397
381
|
:node_fontname => 'monospace',
|
398
382
|
:node_fontsize => 9,
|
399
|
-
:color_class => '#
|
400
|
-
:color_class_preloaded => '#
|
401
|
-
:color_class_core => '#
|
402
|
-
:color_exception => '#
|
403
|
-
:color_exception_preloaded => '#
|
404
|
-
:color_exception_core => '#
|
405
|
-
:color_module => '#
|
406
|
-
:color_module_preloaded => '#
|
407
|
-
:color_module_core => '#
|
383
|
+
:color_class => '#77FF77',
|
384
|
+
:color_class_preloaded => '#AAFFAA',
|
385
|
+
:color_class_core => '#DDFFDD',
|
386
|
+
:color_exception => '#FF7777',
|
387
|
+
:color_exception_preloaded => '#FFAAAA',
|
388
|
+
:color_exception_core => '#FFDDDD',
|
389
|
+
:color_module => '#9999FF',
|
390
|
+
:color_module_preloaded => '#BBBBFF',
|
391
|
+
:color_module_core => '#DDDDFF',
|
392
|
+
# :color_class => '#BBFFBB',
|
393
|
+
# :color_class_preloaded => '#CCEECC',
|
394
|
+
# :color_class_core => '#DDFF99',
|
395
|
+
# :color_exception => '#FFBBBB',
|
396
|
+
# :color_exception_preloaded => '#EECCCC',
|
397
|
+
# :color_exception_core => '#FFDD99',
|
398
|
+
# :color_module => '#BBBBFF',
|
399
|
+
# :color_module_preloaded => '#CCCCEE',
|
400
|
+
# :color_module_core => '#99DDFF',
|
408
401
|
:color_protected => '#EEEEEE',
|
409
402
|
:color_private => '#DDDDDD',
|
410
403
|
:color_inherited => '#0000FF',
|
411
404
|
:color_included => '#00AAFF',
|
412
405
|
:color_extended => '#AA00FF',
|
413
|
-
:color_nested => '#EEEEEE'
|
406
|
+
:color_nested => '#EEEEEE',
|
407
|
+
:graph_splines => 'spline'
|
414
408
|
}
|
415
409
|
end
|
416
410
|
|
@@ -616,16 +610,19 @@ module RDot
|
|
616
610
|
result << node_name(name) + '['
|
617
611
|
result << ' label=<' + node_label(name, m, opts) + '>'
|
618
612
|
result << '];'
|
613
|
+
if opts[:hide_nested] || ! m[:module].namespace #) && ! (Class === m[:module]) && ! (m[:module] == Kernel)
|
614
|
+
result << node_name(name) + ' -> nullnode[color=transparent,minlen=0,weight=1];'
|
615
|
+
end
|
619
616
|
if m[:nested] && ! opts[:hide_nested]
|
620
617
|
ns = find_module space, m[:nested]
|
621
618
|
result << dot_module(space, m[:nested], ns, opts)
|
622
|
-
@nested << node_name(
|
619
|
+
@nested << node_name(name) + ' -> ' + node_name(m[:nested]) + ';'
|
623
620
|
end
|
624
621
|
if ! opts[:hide_extended]
|
625
622
|
m[:extended].each do |e|
|
626
623
|
ext = find_module space, e
|
627
624
|
result << dot_module(space, e, ext, opts)
|
628
|
-
@extended << node_name(
|
625
|
+
@extended << node_name(name) + ' -> ' + node_name(e) + ';'
|
629
626
|
end
|
630
627
|
end
|
631
628
|
if ! opts[:hide_included]
|
@@ -633,13 +630,13 @@ module RDot
|
|
633
630
|
next if m[:module].name == 'CMath' && i == 'Math'
|
634
631
|
inc = find_module space, i
|
635
632
|
result << dot_module(space, i, inc, opts)
|
636
|
-
@included << node_name(
|
633
|
+
@included << node_name(name) + ' -> ' + node_name(i) + ';'
|
637
634
|
end
|
638
635
|
end
|
639
636
|
if m[:superclass]
|
640
637
|
spc = find_module space, m[:superclass]
|
641
638
|
result << dot_module(space, m[:superclass], spc, opts)
|
642
|
-
@inherited << node_name(
|
639
|
+
@inherited << node_name(name) + ' -> ' + node_name(m[:superclass]) + ';'
|
643
640
|
end
|
644
641
|
result.join "\n "
|
645
642
|
end
|
@@ -686,9 +683,9 @@ module RDot
|
|
686
683
|
result = []
|
687
684
|
result << 'digraph graph_RDot{'
|
688
685
|
result << ' graph['
|
689
|
-
result << ' rankdir=
|
690
|
-
result << ' splines=
|
691
|
-
result << ' labelloc=t,'
|
686
|
+
result << ' rankdir=RL,'
|
687
|
+
result << ' splines=' + opts[:graph_splines] + ','
|
688
|
+
result << ' labelloc=t,searchsize=1000,'
|
692
689
|
result << ' fontname="' + opts[:graph_fontname] + '",'
|
693
690
|
result << ' fontsize=' + opts[:graph_fontsize].to_s + ','
|
694
691
|
result << ' label="' + opts[:graph_label] + '"'
|
@@ -699,10 +696,12 @@ module RDot
|
|
699
696
|
result << ' fontsize=' + opts[:node_fontsize].to_s + ''
|
700
697
|
result << ' ];'
|
701
698
|
result << ' edge['
|
702
|
-
result << ' dir=back,'
|
703
|
-
result << '
|
699
|
+
# result << ' dir=back,'
|
700
|
+
# result << ' arrowhead=vee,'
|
704
701
|
result << ' penwidth=0.5, arrowsize=0.5'
|
705
702
|
result << ' ];'
|
703
|
+
result << ' nullnode[label=""];'
|
704
|
+
# result << ' nullnode -> ' + node_name('Kernel') + '[color=yellow,weight=0,minlen=0];'
|
706
705
|
@processed = []
|
707
706
|
@nested = []
|
708
707
|
@extended = []
|
@@ -715,7 +714,7 @@ module RDot
|
|
715
714
|
result << ' subgraph subNested{'
|
716
715
|
result << ' edge['
|
717
716
|
result << ' color="' + opts[:color_nested] + '",'
|
718
|
-
result << ' weight=
|
717
|
+
result << ' weight=1,'
|
719
718
|
result << ' minlen=0'
|
720
719
|
result << ' ];'
|
721
720
|
result << ' ' + @nested.join("\n ")
|
@@ -748,7 +747,7 @@ module RDot
|
|
748
747
|
result.join "\n"
|
749
748
|
end
|
750
749
|
|
751
|
-
private :
|
750
|
+
private :get_method_object, :get_module, :add_method,
|
752
751
|
:add_module, :diff_module, :find_module, :dot_module, :node_name,
|
753
752
|
:node_color, :node_label, :module_kind, :dot_constants, :dot_scope,
|
754
753
|
:module_stage, :escape
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0.pre3
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ivan Shikhalev
|
@@ -31,12 +31,16 @@ description: GraphViz diagrams for Ruby classes.
|
|
31
31
|
email: shikhalev@gmail.com
|
32
32
|
executables:
|
33
33
|
- rdot
|
34
|
+
- rbdot
|
34
35
|
extensions: []
|
35
36
|
extra_rdoc_files: []
|
36
37
|
files:
|
38
|
+
- lib/rbdot.rb
|
37
39
|
- lib/rdot.rb
|
40
|
+
- lib/rdot-common.rb
|
38
41
|
- README.md
|
39
42
|
- bin/rdot
|
43
|
+
- bin/rbdot
|
40
44
|
- .yardopts
|
41
45
|
homepage: https://github.com/shikhalev/rdot
|
42
46
|
licenses:
|
@@ -54,9 +58,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
59
|
none: false
|
56
60
|
requirements:
|
57
|
-
- - ! '
|
61
|
+
- - ! '>'
|
58
62
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
63
|
+
version: 1.3.1
|
60
64
|
requirements: []
|
61
65
|
rubyforge_project:
|
62
66
|
rubygems_version: 1.8.25
|