rdot 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +9 -0
- data/README.md +152 -0
- data/bin/rdot +531 -0
- data/lib/rdot.rb +762 -0
- metadata +67 -0
data/.yardopts
ADDED
data/README.md
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# RDot — GraphViz diagrams for Ruby classes
|
2
|
+
|
3
|
+
[![endorse](https://api.coderwall.com/shikhalev/endorsecount.png)](https://coderwall.com/shikhalev)
|
4
|
+
|
5
|
+
## About
|
6
|
+
|
7
|
+
<img src="https://raw.github.com/shikhalev/rdot/master/share/img/rdot.png" align="right" />
|
8
|
+
|
9
|
+
* Author: [Ivan Shikhalev](https://github.com/shikhalev)
|
10
|
+
* License: [GNU GPL](http://www.gnu.org/copyleft/gpl.html)
|
11
|
+
* [Project](https://github.com/shikhalev/rdot) @ [GitHub.com](https://github.com/)
|
12
|
+
* [Gem](https://rubygems.org/gems/rdot) @ [RubyGems.org](https://rubygems.org)
|
13
|
+
* [Documentation](http://rubydoc.info/github/shikhalev/rdot/frames/)
|
14
|
+
@ [RubyDoc.info](http://rubydoc.info/)
|
15
|
+
|
16
|
+
### Versions
|
17
|
+
|
18
|
+
* For Ruby 1.9.2 and later:
|
19
|
+
* 1.1.x — testing
|
20
|
+
* [1.0.x — stable](https://github.com/shikhalev/rdot/tree/fixes)
|
21
|
+
* 0.10.x (0.10.10.3 latest) — pre-1.0
|
22
|
+
* For Ruby 1.8.7:
|
23
|
+
* [0.9.x (0.9.4 latest)](https://github.com/shikhalev/rdot/tree/v0.9.4)
|
24
|
+
|
25
|
+
## Command-line help
|
26
|
+
Usage: rdot [options] <libs>
|
27
|
+
|
28
|
+
Note:
|
29
|
+
-- Stop options parsing, rest of line treated
|
30
|
+
as <libs>.
|
31
|
+
If it's a FIRST argument, the 'optparse'
|
32
|
+
should not be loaded (include config
|
33
|
+
files), no options will be parsed, all
|
34
|
+
values will be default. And we can make
|
35
|
+
graph of 'optparse'.
|
36
|
+
Config files:
|
37
|
+
/etc/rdotopts
|
38
|
+
~/.config/rdotopts
|
39
|
+
./.rdotopts
|
40
|
+
|
41
|
+
Service options:
|
42
|
+
-h, --help Show short help and exit.
|
43
|
+
-?, --usage Show usage info and exit.
|
44
|
+
-B, --about Show about string and exit.
|
45
|
+
-A, --author Show author and contact info and exit.
|
46
|
+
-L, --license Show info about license and exit.
|
47
|
+
-V, --version Show version number and exit.
|
48
|
+
-I, --info=[info] Show some information and exit.
|
49
|
+
Argument may be comma-separated set of:
|
50
|
+
about, author, license, usage, version;
|
51
|
+
or one of presets:
|
52
|
+
help = about + usage,
|
53
|
+
info (or no argument) =
|
54
|
+
about + author + license,
|
55
|
+
all = about + author + license + usage.
|
56
|
+
|
57
|
+
-o, --output=[file] File for output instead STDOUT.
|
58
|
+
'rdot.dot' if empty.
|
59
|
+
--stdout Reset output to STDOUT.
|
60
|
+
|
61
|
+
Data options:
|
62
|
+
-p, --preload=libs Comma-separated list of preloading
|
63
|
+
libraries which must be hidden.
|
64
|
+
-i, --load, --input=libs Comma-separated list of libraries
|
65
|
+
which must be loaded and visualized.
|
66
|
+
-l, --libs, --search-path=paths Comma-separated list of paths where search
|
67
|
+
for libs by load and preload.
|
68
|
+
|
69
|
+
-e, --[no-]exclude-classes=list Comma-separated list of classes which
|
70
|
+
should be ignored with their descendants.
|
71
|
+
-xlist, Comma-separated list of modules which
|
72
|
+
--[no-]exclude-namespaces should be ignored with their namespace.
|
73
|
+
RDot, Gem, Errno & OptionParser by default,
|
74
|
+
use '--no-exclude-namespaces' to reset.
|
75
|
+
--[no-]exclude-files=list Comma-separated list of files & wildcards
|
76
|
+
their methods should by ingnored.
|
77
|
+
Currect RDot location excluding by default,
|
78
|
+
use '--no-exclude-files' to reset.
|
79
|
+
-c, --[no-]filter-classes=list Comma separated list of classes which only
|
80
|
+
should be visualized (with descendants).
|
81
|
+
-nlist, Comma-separated list of modules which only
|
82
|
+
--[no-]filter-namespaces should be visualized (with nested).
|
83
|
+
--[no-]filter-global Filter classes and modules only in global
|
84
|
+
namespace.
|
85
|
+
--[no-]filter-files=list Comma-separated list of files & wildcards
|
86
|
+
their methods only should by processed.
|
87
|
+
|
88
|
+
Diagram options:
|
89
|
+
-C, --[no-]hide-constants Ignore constants in classes & modules.
|
90
|
+
-M, --[no-]hide-methods Ignore methods & attributes.
|
91
|
+
-G, --[no-]hide-arguments Don't show methods' arguments.
|
92
|
+
-X, --[no-]hide-included Don't show 'include' links.
|
93
|
+
-E, --[no-]hide-extended Don't show 'extend' links.
|
94
|
+
-N, --[no-]hide-nested Don't show nesting links
|
95
|
+
|
96
|
+
-S, --[no-]show-private Show private & protected methods.
|
97
|
+
-s, --[no-]show-protected Show protected methods.
|
98
|
+
-P, --[no-]show-preloaded Show preloaded classes & modules.
|
99
|
+
|
100
|
+
--[no-]select-attributes Show attributes with access rights
|
101
|
+
instead getters & setters as methods.
|
102
|
+
True by default.
|
103
|
+
|
104
|
+
Graph options:
|
105
|
+
-T, --title=title Graph title.
|
106
|
+
'RDot Graph' by default.
|
107
|
+
|
108
|
+
--title-font=name Font name for the graph title.
|
109
|
+
'sans-serif' by default.
|
110
|
+
--title-size=size Font size for the graph title (pt).
|
111
|
+
24 by default.
|
112
|
+
--font=name Font name for main text.
|
113
|
+
'monospace' by default.
|
114
|
+
--font-size=size Font size for main text (pt).
|
115
|
+
9 by default.
|
116
|
+
Colors:
|
117
|
+
May be RGB value or name from X11 scheme,
|
118
|
+
see http://graphviz.org/content/color-names#x11.
|
119
|
+
--color-class=color Background color of class title.
|
120
|
+
#BBFFBB by default.
|
121
|
+
--color-class-preloaded=color
|
122
|
+
Background color of preloaded class title.
|
123
|
+
#CCEECC by default.
|
124
|
+
--color-class-core=color Background color of core class title.
|
125
|
+
#DDFF99 by default.
|
126
|
+
--color-exception=color Background color of exception title.
|
127
|
+
#FFBBBB by default.
|
128
|
+
--color-exception-preloaded=color
|
129
|
+
Background color of preloaded exception
|
130
|
+
title.
|
131
|
+
#EECCCC by default.
|
132
|
+
--color-exception-core=color Background color of core exception title.
|
133
|
+
#FFDD99 by default.
|
134
|
+
--color-module=color Background color of module title.
|
135
|
+
#BBBBFF by default.
|
136
|
+
--color-module-preloaded=color
|
137
|
+
Background color of preloaded module title.
|
138
|
+
#CCCCEE by default.
|
139
|
+
--color-module-core=color Background color of core module title.
|
140
|
+
#DDDDFF by default.
|
141
|
+
--color-protected=color Background color for protected methods.
|
142
|
+
#EEEEEE by default.
|
143
|
+
--color-private=color Background color for private methods.
|
144
|
+
#DDDDDD by default.
|
145
|
+
--color-inherited=color Color for inheritance links.
|
146
|
+
#0000FF by default.
|
147
|
+
--color-included=color Color for 'include' links.
|
148
|
+
#00AAFF by default.
|
149
|
+
--color-extended=color Color for 'extend' links.
|
150
|
+
#AA00FF by default.
|
151
|
+
--color-nested=color Color for nesting links.
|
152
|
+
#EEEEEE by default.
|
data/bin/rdot
ADDED
@@ -0,0 +1,531 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'is/monkey/sandbox'
|
5
|
+
require 'rdot'
|
6
|
+
|
7
|
+
options = {
|
8
|
+
:output => $stdout,
|
9
|
+
:preload => [],
|
10
|
+
:load => [],
|
11
|
+
:exclude_classes => [],
|
12
|
+
:exclude_namespaces => [RDot, Gem, Errno],
|
13
|
+
:exclude_files => [RDot.method(:dot).source_location[0], __FILE__],
|
14
|
+
:select_attributes => true
|
15
|
+
}
|
16
|
+
|
17
|
+
def hi str
|
18
|
+
if $stdout.stat.chardev?
|
19
|
+
"\e[1m#{str}\e[0m"
|
20
|
+
else
|
21
|
+
str
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
title = <<-TXT
|
26
|
+
#{hi("RDot v#{RDot::VERSION}:")} GraphViz class diagrams for Ruby
|
27
|
+
http://github.com/shikhalev/rdot
|
28
|
+
TXT
|
29
|
+
|
30
|
+
usage = <<-TXT
|
31
|
+
#{hi('Usage:')} rdot [options] <libs>
|
32
|
+
TXT
|
33
|
+
|
34
|
+
author = <<-TXT
|
35
|
+
#{hi('Author:')} Ivan Shikhalev <shikhalev@gmail.com>
|
36
|
+
http://github.com/shikhalev
|
37
|
+
TXT
|
38
|
+
|
39
|
+
license = <<-TXT
|
40
|
+
#{hi('License:')} GNU GPL (General Public License)
|
41
|
+
http://gnu.org/licenses/gpl.html
|
42
|
+
TXT
|
43
|
+
|
44
|
+
if ARGV[0] == '--'
|
45
|
+
|
46
|
+
ARGV.shift
|
47
|
+
options[:load] += ARGV
|
48
|
+
|
49
|
+
else
|
50
|
+
|
51
|
+
require 'optparse'
|
52
|
+
|
53
|
+
options[:exclude_namespaces] << OptionParser
|
54
|
+
|
55
|
+
opts = OptionParser.new(usage) do |o|
|
56
|
+
|
57
|
+
o.separator ''
|
58
|
+
o.separator hi('Note:')
|
59
|
+
o.separator ' -- ' +
|
60
|
+
'Stop options parsing, rest of line treated'
|
61
|
+
o.separator ' ' +
|
62
|
+
' as <libs>.'
|
63
|
+
o.separator ' ' +
|
64
|
+
'If it\'s a FIRST argument, the \'optparse\''
|
65
|
+
o.separator ' ' +
|
66
|
+
' should not be loaded (include config'
|
67
|
+
o.separator ' ' +
|
68
|
+
' files), no options will be parsed, all'
|
69
|
+
o.separator ' ' +
|
70
|
+
' values will be default. And we can make'
|
71
|
+
o.separator ' ' +
|
72
|
+
' graph of \'optparse\'.'
|
73
|
+
o.separator hi('Config files:')
|
74
|
+
o.separator ' /etc/rdotopts'
|
75
|
+
o.separator ' ~/.config/rdotopts'
|
76
|
+
o.separator ' ./.rdotopts'
|
77
|
+
|
78
|
+
o.separator ''
|
79
|
+
o.separator hi('Service options:')
|
80
|
+
|
81
|
+
o.on '-h', '--help', 'Show short help and exit.' do
|
82
|
+
puts title
|
83
|
+
puts
|
84
|
+
puts opts.help
|
85
|
+
exit 0
|
86
|
+
end
|
87
|
+
|
88
|
+
o.on '-?', '--usage', 'Show usage info and exit.' do
|
89
|
+
puts opts.help
|
90
|
+
exit 0
|
91
|
+
end
|
92
|
+
|
93
|
+
o.on '-B', '--about', 'Show about string and exit.' do
|
94
|
+
puts title
|
95
|
+
exit 0
|
96
|
+
end
|
97
|
+
|
98
|
+
o.on '-A', '--author', 'Show author and contact info and exit.' do
|
99
|
+
puts author
|
100
|
+
exit 0
|
101
|
+
end
|
102
|
+
|
103
|
+
o.on '-L', '--license', 'Show info about license and exit.' do
|
104
|
+
puts license
|
105
|
+
exit 0
|
106
|
+
end
|
107
|
+
|
108
|
+
o.on '-V', '--version', 'Show version number and exit.' do
|
109
|
+
puts RDot::VERSION
|
110
|
+
exit 0
|
111
|
+
end
|
112
|
+
|
113
|
+
o.on '-I', '--info', '=[info]', Array,
|
114
|
+
'Show some information and exit.',
|
115
|
+
'Argument may be comma-separated set of:',
|
116
|
+
' about, author, license, usage, version;',
|
117
|
+
'or one of presets:',
|
118
|
+
' help = about + usage,',
|
119
|
+
' info (or no argument) =',
|
120
|
+
' about + author + license,',
|
121
|
+
' all = about + author + license + usage.' do |value|
|
122
|
+
if value == nil || value == []
|
123
|
+
value = ['info']
|
124
|
+
end
|
125
|
+
case value[0]
|
126
|
+
when 'help'
|
127
|
+
value = ['about', 'usage']
|
128
|
+
when 'info'
|
129
|
+
value = ['about', 'author', 'license']
|
130
|
+
when 'all'
|
131
|
+
value = ['about', 'author', 'license', 'usage']
|
132
|
+
when 'version'
|
133
|
+
puts RDot::VERSION
|
134
|
+
exit 0
|
135
|
+
end
|
136
|
+
if value.include? 'about'
|
137
|
+
puts title
|
138
|
+
if value.include?('author') || value.include?('license') ||
|
139
|
+
value.include?('usage')
|
140
|
+
puts
|
141
|
+
end
|
142
|
+
end
|
143
|
+
if value.include? 'author'
|
144
|
+
puts author
|
145
|
+
if value.include?('usage') && ! value.include?('license')
|
146
|
+
puts
|
147
|
+
end
|
148
|
+
end
|
149
|
+
if value.include? 'license'
|
150
|
+
puts license
|
151
|
+
if value.include?('usage')
|
152
|
+
puts
|
153
|
+
end
|
154
|
+
end
|
155
|
+
if value.include? 'usage'
|
156
|
+
puts opts.help
|
157
|
+
end
|
158
|
+
exit 0
|
159
|
+
end
|
160
|
+
|
161
|
+
o.separator ''
|
162
|
+
|
163
|
+
o.on '-o', '--output', '=[file]', String,
|
164
|
+
'File for output instead STDOUT.',
|
165
|
+
' \'rdot.dot\' if empty.' do |value|
|
166
|
+
if value == nil
|
167
|
+
value = 'rdot.dot'
|
168
|
+
end
|
169
|
+
options[:output] = File.open value, 'w'
|
170
|
+
end
|
171
|
+
|
172
|
+
o.on '--stdout', 'Reset output to STDOUT.'
|
173
|
+
|
174
|
+
o.separator ''
|
175
|
+
o.separator hi('Data options:')
|
176
|
+
|
177
|
+
o.on '-p', '--preload', '=libs', Array,
|
178
|
+
'Comma-separated list of preloading',
|
179
|
+
' libraries which must be hidden.' do |value|
|
180
|
+
options[:preload] += value
|
181
|
+
end
|
182
|
+
|
183
|
+
o.on '-i', '--load', '--input', '=libs', Array,
|
184
|
+
'Comma-separated list of libraries',
|
185
|
+
' which must be loaded and visualized.' do |value|
|
186
|
+
options[:load] += value
|
187
|
+
end
|
188
|
+
|
189
|
+
o.on '-l', '--libs', '--search-path', '=paths', Array,
|
190
|
+
'Comma-separated list of paths where search',
|
191
|
+
' for libs by load and preload.' do |value|
|
192
|
+
$:.push *(value.map { |d| File.expand_path(d) })
|
193
|
+
end
|
194
|
+
|
195
|
+
o.separator ''
|
196
|
+
|
197
|
+
o.on '-e', '--[no-]exclude-classes', '=list', Array,
|
198
|
+
'Comma-separated list of classes which',
|
199
|
+
' should be ignored with their descendants.' do |value|
|
200
|
+
if ! value
|
201
|
+
options[:exclude_classes] = []
|
202
|
+
else
|
203
|
+
value.each do |v|
|
204
|
+
c = sandbox { eval v }
|
205
|
+
if Class === c
|
206
|
+
options[:exclude_classes] << c
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
o.on '-x', '--[no-]exclude-namespaces', '=list', Array,
|
213
|
+
'Comma-separated list of modules which',
|
214
|
+
' should be ignored with their namespace.',
|
215
|
+
'RDot, Gem, Errno & OptionParser by default,',
|
216
|
+
' use \'--no-exclude-namespaces\' to reset.' do |value|
|
217
|
+
if ! value
|
218
|
+
options[:exclude_namespaces] = []
|
219
|
+
else
|
220
|
+
value.each do |v|
|
221
|
+
m = sandbox { eval v }
|
222
|
+
if Module === m
|
223
|
+
options[:exclude_namespaces] << m
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
o.on '--[no-]exclude-files', '=list', Array,
|
230
|
+
'Comma-separated list of files & wildcards',
|
231
|
+
' their methods should by ingnored.',
|
232
|
+
'Currect RDot location excluding by default,',
|
233
|
+
' use \'--no-exclude-files\' to reset.' do |value|
|
234
|
+
if ! value
|
235
|
+
options[:exclude_files] = []
|
236
|
+
else
|
237
|
+
value.each do |v|
|
238
|
+
options[:exclude_files] += Dir[v]
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
o.on '-c', '--[no-]filter-classes', '=list', Array,
|
244
|
+
'Comma separated list of classes which only',
|
245
|
+
' should be visualized (with descendants).' do |value|
|
246
|
+
if ! value
|
247
|
+
options.delete :filter_classes
|
248
|
+
else
|
249
|
+
options[:filter_classes] ||= []
|
250
|
+
value.each do |v|
|
251
|
+
c = sandbox { eval v }
|
252
|
+
if Class === c
|
253
|
+
options[:filter_classes] << c
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
o.on '-n', '--[no-]filter-namespaces', '=list', Array,
|
260
|
+
'Comma-separated list of modules which only',
|
261
|
+
' should be visualized (with nested).' do |value|
|
262
|
+
if ! value
|
263
|
+
options.delete :filter_namespaces
|
264
|
+
else
|
265
|
+
options[:filter_namespaces] ||= []
|
266
|
+
value.each do |v|
|
267
|
+
m = sandbox { eval v }
|
268
|
+
if Module === m
|
269
|
+
options[:filter_namespaces] << m
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
o.on '--[no-]filter-global', TrueClass,
|
276
|
+
'Filter classes and modules only in global',
|
277
|
+
' namespace.' do |value|
|
278
|
+
options[:filter_global] = value
|
279
|
+
end
|
280
|
+
|
281
|
+
o.on '--[no-]filter-files', '=list', Array,
|
282
|
+
'Comma-separated list of files & wildcards',
|
283
|
+
' their methods only should by processed.' do |value|
|
284
|
+
if ! value
|
285
|
+
options.delete :filter_files
|
286
|
+
else
|
287
|
+
options[:filter_files] ||= []
|
288
|
+
value.each do |v|
|
289
|
+
options[:filter_files] += Dir[v]
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
o.separator ''
|
295
|
+
o.separator hi('Diagram options:')
|
296
|
+
|
297
|
+
o.on '-C', '--[no-]hide-constants', TrueClass,
|
298
|
+
'Ignore constants in classes & modules.' do |value|
|
299
|
+
options[:hide_constants] = value
|
300
|
+
end
|
301
|
+
|
302
|
+
o.on '-M', '--[no-]hide-methods', TrueClass,
|
303
|
+
'Ignore methods & attributes.' do |value|
|
304
|
+
options[:hide_methods] = value
|
305
|
+
end
|
306
|
+
|
307
|
+
o.on '-G', '--[no-]hide-arguments', TrueClass,
|
308
|
+
'Don\'t show methods\' arguments.' do |value|
|
309
|
+
options[:hide_arguments] = value
|
310
|
+
end
|
311
|
+
|
312
|
+
o.on '-X', '--[no-]hide-included', TrueClass,
|
313
|
+
'Don\'t show \'include\' links.' do |value|
|
314
|
+
options[:hide_included] = value
|
315
|
+
end
|
316
|
+
|
317
|
+
o.on '-E', '--[no-]hide-extended', TrueClass,
|
318
|
+
'Don\'t show \'extend\' links.' do |value|
|
319
|
+
options[:hide_extended] = value
|
320
|
+
end
|
321
|
+
|
322
|
+
o.on '-N', '--[no-]hide-nested', TrueClass,
|
323
|
+
'Don\'t show nesting links' do |value|
|
324
|
+
options[:hide_nested] = value
|
325
|
+
end
|
326
|
+
|
327
|
+
o.separator ''
|
328
|
+
|
329
|
+
o.on '-S', '--[no-]show-private', TrueClass,
|
330
|
+
'Show private & protected methods.' do |value|
|
331
|
+
options[:show_private] = value
|
332
|
+
if value
|
333
|
+
options[:show_protected] = value
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
o.on '-s', '--[no-]show-protected', TrueClass,
|
338
|
+
'Show protected methods.' do |value|
|
339
|
+
options[:show_protected] = value
|
340
|
+
end
|
341
|
+
|
342
|
+
o.on '-P', '--[no-]show-preloaded', TrueClass,
|
343
|
+
'Show preloaded classes & modules.' do |value|
|
344
|
+
options[:show_preloaded] = value
|
345
|
+
end
|
346
|
+
|
347
|
+
o.separator ''
|
348
|
+
|
349
|
+
o.on '--[no-]select-attributes', TrueClass,
|
350
|
+
'Show attributes with access rights',
|
351
|
+
' instead getters & setters as methods.',
|
352
|
+
'True by default.' do |value|
|
353
|
+
options[:select_attributes] = value
|
354
|
+
end
|
355
|
+
|
356
|
+
o.separator ''
|
357
|
+
o.separator hi('Graph options:')
|
358
|
+
|
359
|
+
o.on '-T', '--title', '=title', String, 'Graph title.',
|
360
|
+
" '#{RDot::defaults[:graph_label]}' by default." do |value|
|
361
|
+
options[:graph_label] = value
|
362
|
+
end
|
363
|
+
|
364
|
+
o.separator ''
|
365
|
+
|
366
|
+
o.on '--title-font', '=name', String,
|
367
|
+
'Font name for the graph title.',
|
368
|
+
" '#{RDot::defaults[:graph_fontname]}' by default." do |value|
|
369
|
+
options[:graph_fontname] = value
|
370
|
+
end
|
371
|
+
|
372
|
+
o.on '--title-size', '=size', Numeric,
|
373
|
+
'Font size for the graph title (pt).',
|
374
|
+
" #{RDot::defaults[:graph_fontsize]} by default." do |value|
|
375
|
+
options[:graph_fontsize] = value
|
376
|
+
end
|
377
|
+
|
378
|
+
o.on '--font', '=name', String, 'Font name for main text.',
|
379
|
+
" '#{RDot::defaults[:node_fontname]}' by default." do |value|
|
380
|
+
options[:node_fontname] = value
|
381
|
+
end
|
382
|
+
|
383
|
+
o.on '--font-size', '=size', Numeric, 'Font size for main text (pt).',
|
384
|
+
" #{RDot::defaults[:node_fontsize]} by default." do |value|
|
385
|
+
options[:node_fontsize] = value
|
386
|
+
end
|
387
|
+
|
388
|
+
o.separator "Colors:\n" +
|
389
|
+
' May by RGB value or name from X11 scheme,' + "\n" +
|
390
|
+
' see http://graphviz.org/content/color-names#x11.'
|
391
|
+
|
392
|
+
o.on '--color-class', '=color', String, 'Background color of class title.',
|
393
|
+
" #{RDot::defaults[:color_class]} by default." do |value|
|
394
|
+
options[:color_class] = value
|
395
|
+
end
|
396
|
+
|
397
|
+
o.on '--color-class-preloaded', '=color', String,
|
398
|
+
'Background color of preloaded class title.',
|
399
|
+
" #{RDot::defaults[:color_class_preloaded]} by default." do |value|
|
400
|
+
options[:color_class_preloaded] = value
|
401
|
+
end
|
402
|
+
|
403
|
+
o.on '--color-class-core', '=color', String,
|
404
|
+
'Background color of core class title.',
|
405
|
+
" #{RDot::defaults[:color_class_core]} by default." do |value|
|
406
|
+
options[:color_class_core] = value
|
407
|
+
end
|
408
|
+
|
409
|
+
o.on '--color-exception', '=color', String,
|
410
|
+
'Background color of exception title.',
|
411
|
+
" #{RDot::defaults[:color_exception]} by default." do |value|
|
412
|
+
options[:color_exception] = value
|
413
|
+
end
|
414
|
+
|
415
|
+
o.on '--color-exception-preloaded', '=color', String,
|
416
|
+
'Background color of preloaded exception', ' title.',
|
417
|
+
" #{RDot::defaults[:color_exception_preloaded]} by default." do |value|
|
418
|
+
options[:color_exception_preloaded] = value
|
419
|
+
end
|
420
|
+
|
421
|
+
o.on '--color-exception-core', '=color', String,
|
422
|
+
'Background color of core exception title.',
|
423
|
+
" #{RDot::defaults[:color_exception_core]} by default." do |value|
|
424
|
+
options[:color_exception_core] = value
|
425
|
+
end
|
426
|
+
|
427
|
+
o.on '--color-module', '=color', String, 'Background color of module title.',
|
428
|
+
" #{RDot::defaults[:color_module]} by default." do |value|
|
429
|
+
options[:color_module] = value
|
430
|
+
end
|
431
|
+
|
432
|
+
o.on '--color-module-preloaded', '=color', String,
|
433
|
+
'Background color of preloaded module title.',
|
434
|
+
" #{RDot::defaults[:color_module_preloaded]} by default." do |value|
|
435
|
+
options[:color_module_preloaded] = value
|
436
|
+
end
|
437
|
+
|
438
|
+
o.on '--color-module-core', '=color', String,
|
439
|
+
'Background color of core module title.',
|
440
|
+
" #{RDot::defaults[:color_module_core]} by default." do |value|
|
441
|
+
options[:color_module_core] = value
|
442
|
+
end
|
443
|
+
|
444
|
+
o.on '--color-protected', '=color', String,
|
445
|
+
'Background color for protected methods.',
|
446
|
+
" #{RDot::defaults[:color_protected]} by default." do |value|
|
447
|
+
options[:color_protected] = value
|
448
|
+
end
|
449
|
+
|
450
|
+
o.on '--color-private', '=color', String,
|
451
|
+
'Background color for private methods.',
|
452
|
+
" #{RDot::defaults[:color_private]} by default." do |value|
|
453
|
+
options[:color_private] = value
|
454
|
+
end
|
455
|
+
|
456
|
+
o.on '--color-inherited', '=color', String,
|
457
|
+
'Color for inheritance links.',
|
458
|
+
" #{RDot::defaults[:color_inherited]} by default." do |value|
|
459
|
+
options[:color_inherited] = value
|
460
|
+
end
|
461
|
+
|
462
|
+
o.on '--color-included', '=color', String,
|
463
|
+
'Color for \'include\' links.',
|
464
|
+
" #{RDot::defaults[:color_included]} by default." do |value|
|
465
|
+
options[:color_included] = value
|
466
|
+
end
|
467
|
+
|
468
|
+
o.on '--color-extended', '=color', String,
|
469
|
+
'Color for \'extend\' links.',
|
470
|
+
" #{RDot::defaults[:color_extended]} by default." do |value|
|
471
|
+
options[:color_extended] = value
|
472
|
+
end
|
473
|
+
|
474
|
+
o.on '--color-nested', '=color', String,
|
475
|
+
'Color for nesting links.',
|
476
|
+
" #{RDot::defaults[:color_nested]} by default." do |value|
|
477
|
+
options[:color_nested] = value
|
478
|
+
end
|
479
|
+
|
480
|
+
end
|
481
|
+
|
482
|
+
begin
|
483
|
+
[
|
484
|
+
'/etc/rdotopts',
|
485
|
+
File.expand_path('~/.config/rdotopts'),
|
486
|
+
File.expand_path('./.rdotopts')
|
487
|
+
].each do |f|
|
488
|
+
if File.exists? f
|
489
|
+
opts.load f
|
490
|
+
end
|
491
|
+
end
|
492
|
+
rescue
|
493
|
+
raise 'Error while processing options file.'
|
494
|
+
end
|
495
|
+
|
496
|
+
begin
|
497
|
+
options[:load] += opts.parse ARGV
|
498
|
+
rescue
|
499
|
+
raise 'Error while processing command line.'
|
500
|
+
end
|
501
|
+
|
502
|
+
if options[:load].include?('optparse')
|
503
|
+
options[:exclude_namespaces].delete OptionParser
|
504
|
+
end
|
505
|
+
|
506
|
+
end
|
507
|
+
|
508
|
+
if options[:load].include?('rdot')
|
509
|
+
options[:exclude_namespaces].delete RDot
|
510
|
+
options[:exclude_files].delete RDot.method(:dot).source_location[0]
|
511
|
+
end
|
512
|
+
|
513
|
+
if options[:preload]
|
514
|
+
options[:preload].each do |l|
|
515
|
+
require l
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
pre = RDot.snapshot options
|
520
|
+
|
521
|
+
if options[:load]
|
522
|
+
options[:load].each do |l|
|
523
|
+
require l
|
524
|
+
end
|
525
|
+
end
|
526
|
+
|
527
|
+
post = RDot.snapshot options
|
528
|
+
|
529
|
+
delta = RDot.diff post, pre, options
|
530
|
+
|
531
|
+
options[:output].puts RDot.dot(delta, options)
|