voloko-sdoc 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/rdoc/History.txt +254 -0
  2. data/rdoc/Manifest.txt +126 -0
  3. data/rdoc/README.txt +47 -0
  4. data/rdoc/RI.txt +58 -0
  5. data/rdoc/Rakefile +70 -0
  6. data/rdoc/bin/rdoc +35 -0
  7. data/rdoc/bin/ri +5 -0
  8. data/rdoc/lib/rdoc/alias.rb +54 -0
  9. data/rdoc/lib/rdoc/anon_class.rb +10 -0
  10. data/rdoc/lib/rdoc/any_method.rb +190 -0
  11. data/rdoc/lib/rdoc/attr.rb +79 -0
  12. data/rdoc/lib/rdoc/cache.rb +41 -0
  13. data/rdoc/lib/rdoc/class_module.rb +87 -0
  14. data/rdoc/lib/rdoc/code_object.rb +152 -0
  15. data/rdoc/lib/rdoc/code_objects.rb +23 -0
  16. data/rdoc/lib/rdoc/constant.rb +36 -0
  17. data/rdoc/lib/rdoc/context.rb +712 -0
  18. data/rdoc/lib/rdoc/diagram.rb +340 -0
  19. data/rdoc/lib/rdoc/dot.rb +249 -0
  20. data/rdoc/lib/rdoc/generator/darkfish.rb +455 -0
  21. data/rdoc/lib/rdoc/generator/markup.rb +194 -0
  22. data/rdoc/lib/rdoc/generator/ri.rb +230 -0
  23. data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +281 -0
  24. data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +112 -0
  25. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  26. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  27. data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  28. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  29. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  30. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  31. data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  32. data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  33. data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  34. data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  35. data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  36. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  37. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  38. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  39. data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  40. data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  41. data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  42. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  43. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  44. data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  45. data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +64 -0
  46. data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
  47. data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
  48. data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
  49. data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
  50. data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
  51. data/rdoc/lib/rdoc/generator.rb +8 -0
  52. data/rdoc/lib/rdoc/ghost_method.rb +8 -0
  53. data/rdoc/lib/rdoc/include.rb +39 -0
  54. data/rdoc/lib/rdoc/known_classes.rb +68 -0
  55. data/rdoc/lib/rdoc/markup/attribute_manager.rb +311 -0
  56. data/rdoc/lib/rdoc/markup/formatter.rb +25 -0
  57. data/rdoc/lib/rdoc/markup/fragments.rb +377 -0
  58. data/rdoc/lib/rdoc/markup/inline.rb +126 -0
  59. data/rdoc/lib/rdoc/markup/lines.rb +156 -0
  60. data/rdoc/lib/rdoc/markup/preprocess.rb +80 -0
  61. data/rdoc/lib/rdoc/markup/to_flow.rb +211 -0
  62. data/rdoc/lib/rdoc/markup/to_html.rb +406 -0
  63. data/rdoc/lib/rdoc/markup/to_html_crossref.rb +140 -0
  64. data/rdoc/lib/rdoc/markup/to_latex.rb +328 -0
  65. data/rdoc/lib/rdoc/markup/to_test.rb +53 -0
  66. data/rdoc/lib/rdoc/markup/to_texinfo.rb +73 -0
  67. data/rdoc/lib/rdoc/markup.rb +378 -0
  68. data/rdoc/lib/rdoc/meta_method.rb +8 -0
  69. data/rdoc/lib/rdoc/normal_class.rb +18 -0
  70. data/rdoc/lib/rdoc/normal_module.rb +34 -0
  71. data/rdoc/lib/rdoc/options.rb +542 -0
  72. data/rdoc/lib/rdoc/parser/c.rb +678 -0
  73. data/rdoc/lib/rdoc/parser/perl.rb +165 -0
  74. data/rdoc/lib/rdoc/parser/ruby.rb +2904 -0
  75. data/rdoc/lib/rdoc/parser/simple.rb +39 -0
  76. data/rdoc/lib/rdoc/parser.rb +138 -0
  77. data/rdoc/lib/rdoc/rdoc.rb +375 -0
  78. data/rdoc/lib/rdoc/require.rb +32 -0
  79. data/rdoc/lib/rdoc/ri/cache.rb +187 -0
  80. data/rdoc/lib/rdoc/ri/descriptions.rb +156 -0
  81. data/rdoc/lib/rdoc/ri/display.rb +340 -0
  82. data/rdoc/lib/rdoc/ri/driver.rb +828 -0
  83. data/rdoc/lib/rdoc/ri/formatter.rb +654 -0
  84. data/rdoc/lib/rdoc/ri/paths.rb +93 -0
  85. data/rdoc/lib/rdoc/ri/reader.rb +106 -0
  86. data/rdoc/lib/rdoc/ri/util.rb +79 -0
  87. data/rdoc/lib/rdoc/ri/writer.rb +68 -0
  88. data/rdoc/lib/rdoc/ri.rb +8 -0
  89. data/rdoc/lib/rdoc/single_class.rb +8 -0
  90. data/rdoc/lib/rdoc/stats.rb +178 -0
  91. data/rdoc/lib/rdoc/task.rb +276 -0
  92. data/rdoc/lib/rdoc/tokenstream.rb +33 -0
  93. data/rdoc/lib/rdoc/top_level.rb +242 -0
  94. data/rdoc/lib/rdoc.rb +398 -0
  95. metadata +1 -1
@@ -0,0 +1,39 @@
1
+ require 'rdoc/parser'
2
+
3
+ ##
4
+ # Parse a non-source file. We basically take the whole thing as one big
5
+ # comment. If the first character in the file is '#', we strip leading pound
6
+ # signs.
7
+
8
+ class RDoc::Parser::Simple < RDoc::Parser
9
+
10
+ parse_files_matching(//)
11
+
12
+ ##
13
+ # Prepare to parse a plain file
14
+
15
+ def initialize(top_level, file_name, content, options, stats)
16
+ super
17
+
18
+ preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
19
+
20
+ preprocess.handle @content do |directive, param|
21
+ warn "Unrecognized directive '#{directive}' in #{@file_name}"
22
+ end
23
+ end
24
+
25
+ ##
26
+ # Extract the file contents and attach them to the TopLevel as a comment
27
+
28
+ def scan
29
+ @top_level.comment = remove_private_comments(@content)
30
+ @top_level.parser = self.class
31
+ @top_level
32
+ end
33
+
34
+ def remove_private_comments(comment)
35
+ comment.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
36
+ end
37
+
38
+ end
39
+
@@ -0,0 +1,138 @@
1
+ require 'rdoc'
2
+ require 'rdoc/code_objects'
3
+ require 'rdoc/markup/preprocess'
4
+ require 'rdoc/stats'
5
+
6
+ ##
7
+ # A parser is simple a class that implements
8
+ #
9
+ # #initialize(file_name, body, options)
10
+ #
11
+ # and
12
+ #
13
+ # #scan
14
+ #
15
+ # The initialize method takes a file name to be used, the body of the file,
16
+ # and an RDoc::Options object. The scan method is then called to return an
17
+ # appropriately parsed TopLevel code object.
18
+ #
19
+ # The ParseFactory is used to redirect to the correct parser given a
20
+ # filename extension. This magic works because individual parsers have to
21
+ # register themselves with us as they are loaded in. The do this using the
22
+ # following incantation
23
+ #
24
+ # require "rdoc/parser"
25
+ #
26
+ # class RDoc::Parser::Xyz < RDoc::Parser
27
+ # parse_files_matching /\.xyz$/ # <<<<
28
+ #
29
+ # def initialize(file_name, body, options)
30
+ # ...
31
+ # end
32
+ #
33
+ # def scan
34
+ # ...
35
+ # end
36
+ # end
37
+ #
38
+ # Just to make life interesting, if we suspect a plain text file, we also
39
+ # look for a shebang line just in case it's a potential shell script
40
+
41
+ class RDoc::Parser
42
+
43
+ @parsers = []
44
+
45
+ class << self
46
+ attr_reader :parsers
47
+ end
48
+
49
+ ##
50
+ # Alias an extension to another extension. After this call, files ending
51
+ # "new_ext" will be parsed using the same parser as "old_ext"
52
+
53
+ def self.alias_extension(old_ext, new_ext)
54
+ old_ext = old_ext.sub(/^\.(.*)/, '\1')
55
+ new_ext = new_ext.sub(/^\.(.*)/, '\1')
56
+
57
+ parser = can_parse "xxx.#{old_ext}"
58
+ return false unless parser
59
+
60
+ RDoc::Parser.parsers.unshift [/\.#{new_ext}$/, parser]
61
+
62
+ true
63
+ end
64
+
65
+ ##
66
+ # Shamelessly stolen from the ptools gem (since RDoc cannot depend on
67
+ # the gem).
68
+
69
+ def self.binary?(file)
70
+ s = (File.read(file, File.stat(file).blksize) || "").split(//)
71
+
72
+ if s.size > 0 then
73
+ ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
74
+ else
75
+ false
76
+ end
77
+ end
78
+ private_class_method :binary?
79
+
80
+ ##
81
+ # Return a parser that can handle a particular extension
82
+
83
+ def self.can_parse(file_name)
84
+ parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }.last
85
+
86
+ #
87
+ # The default parser should *NOT* parse binary files.
88
+ #
89
+ if parser == RDoc::Parser::Simple && file_name !~ /\.(txt|rdoc)$/ then
90
+ if binary? file_name then
91
+ return nil
92
+ end
93
+ end
94
+
95
+ return parser
96
+ end
97
+
98
+ ##
99
+ # Find the correct parser for a particular file name. Return a SimpleParser
100
+ # for ones that we don't know
101
+
102
+ def self.for(top_level, file_name, body, options, stats)
103
+ # If no extension, look for shebang
104
+ if file_name !~ /\.\w+$/ && body =~ %r{\A#!(.+)} then
105
+ shebang = $1
106
+ case shebang
107
+ when %r{env\s+ruby}, %r{/ruby}
108
+ file_name = "dummy.rb"
109
+ end
110
+ end
111
+
112
+ parser = can_parse file_name
113
+
114
+ # This method must return a parser.
115
+ parser ||= RDoc::Parser::Simple
116
+
117
+ parser.new top_level, file_name, body, options, stats
118
+ end
119
+
120
+ ##
121
+ # Record which file types this parser can understand.
122
+
123
+ def self.parse_files_matching(regexp)
124
+ RDoc::Parser.parsers.unshift [regexp, self]
125
+ end
126
+
127
+ def initialize(top_level, file_name, content, options, stats)
128
+ @top_level = top_level
129
+ @file_name = file_name
130
+ @content = content
131
+ @options = options
132
+ @stats = stats
133
+ end
134
+
135
+ end
136
+
137
+ require 'rdoc/parser/simple'
138
+
@@ -0,0 +1,375 @@
1
+ require 'rdoc'
2
+
3
+ require 'rdoc/parser'
4
+
5
+ # Simple must come first
6
+ require 'rdoc/parser/simple'
7
+ require 'rdoc/parser/ruby'
8
+ require 'rdoc/parser/c'
9
+ require 'rdoc/parser/perl'
10
+
11
+ require 'rdoc/stats'
12
+ require 'rdoc/options'
13
+
14
+ require 'rdoc/diagram'
15
+
16
+ require 'find'
17
+ require 'fileutils'
18
+ require 'time'
19
+ require 'thread'
20
+
21
+ ##
22
+ # Encapsulate the production of rdoc documentation. Basically you can use this
23
+ # as you would invoke rdoc from the command line:
24
+ #
25
+ # rdoc = RDoc::RDoc.new
26
+ # rdoc.document(args)
27
+ #
28
+ # Where +args+ is an array of strings, each corresponding to an argument you'd
29
+ # give rdoc on the command line. See rdoc/rdoc.rb for details.
30
+
31
+ class RDoc::RDoc
32
+
33
+ ##
34
+ # Generator instance used for creating output
35
+
36
+ attr_accessor :generator
37
+
38
+ ##
39
+ # RDoc options
40
+
41
+ attr_reader :options
42
+
43
+ ##
44
+ # Accessor for statistics. Available after each call to parse_files
45
+
46
+ attr_reader :stats
47
+
48
+ ##
49
+ # This is the list of supported output generators
50
+
51
+ GENERATORS = {}
52
+
53
+ ##
54
+ # Add +klass+ that can generate output after parsing
55
+
56
+ def self.add_generator(klass)
57
+ name = klass.name.sub(/^RDoc::Generator::/, '').downcase
58
+ GENERATORS[name] = klass
59
+ end
60
+
61
+ ##
62
+ # Active RDoc::RDoc instance
63
+
64
+ def self.current
65
+ @current
66
+ end
67
+
68
+ ##
69
+ # Sets the active RDoc::RDoc instance
70
+
71
+ def self.current=(rdoc)
72
+ @current = rdoc
73
+ end
74
+
75
+ def initialize
76
+ @generator = nil
77
+ @options = nil
78
+ @stats = nil
79
+ end
80
+
81
+ ##
82
+ # Report an error message and exit
83
+
84
+ def error(msg)
85
+ raise RDoc::Error, msg
86
+ end
87
+
88
+ ##
89
+ # Turns RDoc from stdin into HTML
90
+
91
+ def handle_pipe
92
+ @html = RDoc::Markup::ToHtml.new
93
+
94
+ out = @html.convert $stdin.read
95
+
96
+ $stdout.write out
97
+ end
98
+
99
+ ##
100
+ # Create an output dir if it doesn't exist. If it does exist, but doesn't
101
+ # contain the flag file <tt>created.rid</tt> then we refuse to use it, as
102
+ # we may clobber some manually generated documentation
103
+
104
+ def setup_output_dir(op_dir, force)
105
+ flag_file = output_flag_file op_dir
106
+
107
+ if File.exist? op_dir then
108
+ unless File.directory? op_dir then
109
+ error "'#{op_dir}' exists, and is not a directory"
110
+ end
111
+ begin
112
+ created = File.read(flag_file)
113
+ rescue SystemCallError
114
+ error "\nDirectory #{op_dir} already exists, but it looks like it\n" +
115
+ "isn't an RDoc directory. Because RDoc doesn't want to risk\n" +
116
+ "destroying any of your existing files, you'll need to\n" +
117
+ "specify a different output directory name (using the\n" +
118
+ "--op <dir> option).\n\n"
119
+ else
120
+ last = (Time.parse(created) unless force rescue nil)
121
+ end
122
+ else
123
+ FileUtils.mkdir_p(op_dir)
124
+ end
125
+ last
126
+ end
127
+
128
+ ##
129
+ # Update the flag file in an output directory.
130
+
131
+ def update_output_dir(op_dir, time)
132
+ File.open(output_flag_file(op_dir), "w") { |f| f.puts time.rfc2822 }
133
+ end
134
+
135
+ ##
136
+ # Return the path name of the flag file in an output directory.
137
+
138
+ def output_flag_file(op_dir)
139
+ File.join op_dir, "created.rid"
140
+ end
141
+
142
+ ##
143
+ # The .document file contains a list of file and directory name patterns,
144
+ # representing candidates for documentation. It may also contain comments
145
+ # (starting with '#')
146
+
147
+ def parse_dot_doc_file(in_dir, filename, options)
148
+ # read and strip comments
149
+ patterns = File.read(filename).gsub(/#.*/, '')
150
+
151
+ result = []
152
+
153
+ patterns.split.each do |patt|
154
+ candidates = Dir.glob(File.join(in_dir, patt))
155
+ result.concat(normalized_file_list(options, candidates))
156
+ end
157
+
158
+ result
159
+ end
160
+
161
+ ##
162
+ # Given a list of files and directories, create a list of all the Ruby
163
+ # files they contain.
164
+ #
165
+ # If +force_doc+ is true we always add the given files, if false, only
166
+ # add files that we guarantee we can parse. It is true when looking at
167
+ # files given on the command line, false when recursing through
168
+ # subdirectories.
169
+ #
170
+ # The effect of this is that if you want a file with a non-standard
171
+ # extension parsed, you must name it explicitly.
172
+
173
+ def normalized_file_list(options, relative_files, force_doc = false,
174
+ exclude_pattern = nil)
175
+ file_list = []
176
+
177
+ relative_files.each do |rel_file_name|
178
+ next if exclude_pattern && exclude_pattern =~ rel_file_name
179
+ stat = File.stat rel_file_name rescue next
180
+
181
+ case type = stat.ftype
182
+ when "file"
183
+ next if @last_created and stat.mtime < @last_created
184
+
185
+ if force_doc or RDoc::Parser.can_parse(rel_file_name) then
186
+ file_list << rel_file_name.sub(/^\.\//, '')
187
+ end
188
+ when "directory"
189
+ next if rel_file_name == "CVS" || rel_file_name == ".svn"
190
+ dot_doc = File.join(rel_file_name, RDoc::DOT_DOC_FILENAME)
191
+ if File.file?(dot_doc)
192
+ file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))
193
+ else
194
+ file_list.concat(list_files_in_directory(rel_file_name, options))
195
+ end
196
+ else
197
+ raise RDoc::Error, "I can't deal with a #{type} #{rel_file_name}"
198
+ end
199
+ end
200
+
201
+ file_list
202
+ end
203
+
204
+ ##
205
+ # Return a list of the files to be processed in a directory. We know that
206
+ # this directory doesn't have a .document file, so we're looking for real
207
+ # files. However we may well contain subdirectories which must be tested
208
+ # for .document files.
209
+
210
+ def list_files_in_directory(dir, options)
211
+ files = Dir.glob File.join(dir, "*")
212
+
213
+ normalized_file_list options, files, false, options.exclude
214
+ end
215
+
216
+ ##
217
+ # Parse each file on the command line, recursively entering directories.
218
+
219
+ def parse_files(options)
220
+ files = options.files
221
+ files = ["."] if files.empty?
222
+
223
+ file_list = normalized_file_list(options, files, true, options.exclude)
224
+
225
+ return [] if file_list.empty?
226
+
227
+ jobs = SizedQueue.new(@options.threads * 3)
228
+ workers = []
229
+ file_info = []
230
+ file_info_lock = Mutex.new
231
+
232
+ Thread.abort_on_exception = true
233
+ @stats = RDoc::Stats.new(file_list.size, options.verbosity)
234
+ @stats.begin_adding @options.threads
235
+
236
+ # Create worker threads.
237
+ @options.threads.times do
238
+ thread = Thread.new do
239
+ while (filename = jobs.pop)
240
+ @stats.add_file(filename)
241
+ content = read_file_contents(filename)
242
+ top_level = RDoc::TopLevel.new filename
243
+
244
+ parser = RDoc::Parser.for(top_level, filename, content, options,
245
+ @stats)
246
+ result = parser.scan
247
+
248
+ file_info_lock.synchronize do
249
+ file_info << result
250
+ end
251
+ end
252
+ end
253
+ workers << thread
254
+ end
255
+
256
+ # Feed filenames to the parser worker threads...
257
+ file_list.each do |filename|
258
+ jobs << filename
259
+ end
260
+ workers.size.times do
261
+ jobs << nil
262
+ end
263
+
264
+ # ...and wait until they're done.
265
+ workers.each do |thread|
266
+ thread.join
267
+ end
268
+
269
+ @stats.done_adding
270
+
271
+ file_info
272
+ end
273
+
274
+ ##
275
+ # Format up one or more files according to the given arguments.
276
+ #
277
+ # For simplicity, _argv_ is an array of strings, equivalent to the strings
278
+ # that would be passed on the command line. (This isn't a coincidence, as
279
+ # we _do_ pass in ARGV when running interactively). For a list of options,
280
+ # see rdoc/rdoc.rb. By default, output will be stored in a directory
281
+ # called +doc+ below the current directory, so make sure you're somewhere
282
+ # writable before invoking.
283
+ #
284
+ # Throws: RDoc::Error on error
285
+
286
+ def document(argv)
287
+ RDoc::TopLevel.reset
288
+
289
+ @options = RDoc::Options.new
290
+ @options.parse argv
291
+
292
+ if @options.pipe then
293
+ handle_pipe
294
+ exit
295
+ end
296
+
297
+ @last_created = setup_output_dir @options.op_dir, @options.force_update
298
+
299
+ start_time = Time.now
300
+
301
+ file_info = parse_files @options
302
+
303
+ @options.title = "RDoc Documentation"
304
+
305
+ if file_info.empty?
306
+ $stderr.puts "\nNo newer files." unless @options.quiet
307
+ else
308
+ gen_klass = @options.generator
309
+
310
+ unless @options.quiet then
311
+ $stderr.puts "\nGenerating #{gen_klass.name.sub(/^.*::/, '')}..."
312
+ end
313
+
314
+ @generator = gen_klass.for @options
315
+
316
+ pwd = Dir.pwd
317
+
318
+ Dir.chdir @options.op_dir
319
+
320
+ begin
321
+ self.class.current = self
322
+
323
+ RDoc::Diagram.new(file_info, @options).draw if @options.diagram
324
+ @generator.generate file_info
325
+ update_output_dir ".", start_time
326
+ ensure
327
+ self.class.current = nil
328
+ Dir.chdir pwd
329
+ end
330
+ end
331
+
332
+ unless @options.quiet or not @stats then
333
+ puts
334
+ @stats.print
335
+ end
336
+ end
337
+
338
+ private
339
+
340
+ def read_file_contents(filename)
341
+ content = if RUBY_VERSION >= '1.9' then
342
+ File.open(filename, "r:ascii-8bit") { |f| f.read }
343
+ else
344
+ File.read filename
345
+ end
346
+
347
+ if defined? Encoding then
348
+ if /coding:\s*(\S+)/ =~ content[/\A(?:.*\n){0,2}/]
349
+ if enc = ::Encoding.find($1)
350
+ content.force_encoding(enc)
351
+ end
352
+ end
353
+ end
354
+
355
+ content
356
+ end
357
+
358
+ end
359
+
360
+ if Gem.respond_to? :find_files then
361
+ rdoc_extensions = Gem.find_files 'rdoc/discover'
362
+
363
+ rdoc_extensions.each do |extension|
364
+ begin
365
+ load extension
366
+ rescue => e
367
+ warn "error loading #{extension.inspect}: #{e.message} (#{e.class})"
368
+ end
369
+ end
370
+ end
371
+
372
+ # require built-in generators after discovery in case they've been replaced
373
+ require 'rdoc/generator/darkfish'
374
+ require 'rdoc/generator/ri'
375
+
@@ -0,0 +1,32 @@
1
+ require 'rdoc/code_object'
2
+
3
+ ##
4
+ # A file loaded by \#require
5
+
6
+ class RDoc::Require < RDoc::CodeObject
7
+
8
+ ##
9
+ # Name of the required file
10
+
11
+ attr_accessor :name
12
+
13
+ ##
14
+ # Creates a new Require that loads +name+ with +comment+
15
+
16
+ def initialize(name, comment)
17
+ super()
18
+ @name = name.gsub(/'|"/, "") #'
19
+ self.comment = comment
20
+ end
21
+
22
+ def inspect # :nodoc:
23
+ "#<%s:0x%x require '%s' in %s>" % [
24
+ self.class,
25
+ object_id,
26
+ @name,
27
+ parent_file_name,
28
+ ]
29
+ end
30
+
31
+ end
32
+