rdoc 2.5.11 → 3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (113) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.document +1 -0
  3. data/History.txt +95 -0
  4. data/Manifest.txt +13 -4
  5. data/README.txt +9 -3
  6. data/Rakefile +1 -1
  7. data/lib/rdoc.rb +15 -298
  8. data/lib/rdoc/alias.rb +65 -16
  9. data/lib/rdoc/any_method.rb +27 -150
  10. data/lib/rdoc/attr.rb +36 -115
  11. data/lib/rdoc/class_module.rb +236 -22
  12. data/lib/rdoc/code_object.rb +76 -31
  13. data/lib/rdoc/constant.rb +32 -4
  14. data/lib/rdoc/context.rb +494 -222
  15. data/lib/rdoc/encoding.rb +79 -0
  16. data/lib/rdoc/erbio.rb +37 -0
  17. data/lib/rdoc/gauntlet.rb +9 -5
  18. data/lib/rdoc/generator.rb +33 -1
  19. data/lib/rdoc/generator/darkfish.rb +284 -375
  20. data/lib/rdoc/generator/markup.rb +72 -36
  21. data/lib/rdoc/generator/ri.rb +4 -4
  22. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +267 -274
  23. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +91 -91
  24. data/lib/rdoc/generator/template/darkfish/index.rhtml +45 -45
  25. data/lib/rdoc/generator/template/darkfish/rdoc.css +298 -298
  26. data/lib/rdoc/include.rb +40 -1
  27. data/lib/rdoc/known_classes.rb +1 -0
  28. data/lib/rdoc/markup.rb +467 -2
  29. data/lib/rdoc/markup/attribute_manager.rb +24 -6
  30. data/lib/rdoc/markup/blank_line.rb +11 -3
  31. data/lib/rdoc/markup/document.rb +6 -0
  32. data/lib/rdoc/markup/formatter.rb +10 -0
  33. data/lib/rdoc/markup/formatter_test_case.rb +339 -3
  34. data/lib/rdoc/markup/heading.rb +3 -0
  35. data/lib/rdoc/markup/inline.rb +11 -1
  36. data/lib/rdoc/markup/list.rb +3 -0
  37. data/lib/rdoc/markup/list_item.rb +3 -0
  38. data/lib/rdoc/markup/paragraph.rb +3 -0
  39. data/lib/rdoc/markup/parser.rb +191 -237
  40. data/lib/rdoc/markup/{preprocess.rb → pre_process.rb} +50 -29
  41. data/lib/rdoc/markup/raw.rb +4 -0
  42. data/lib/rdoc/markup/rule.rb +3 -0
  43. data/lib/rdoc/markup/text_formatter_test_case.rb +116 -0
  44. data/lib/rdoc/markup/to_ansi.rb +14 -2
  45. data/lib/rdoc/markup/to_bs.rb +8 -2
  46. data/lib/rdoc/markup/to_html.rb +84 -91
  47. data/lib/rdoc/markup/to_html_crossref.rb +77 -26
  48. data/lib/rdoc/markup/to_rdoc.rb +94 -49
  49. data/lib/rdoc/markup/to_test.rb +9 -1
  50. data/lib/rdoc/markup/verbatim.rb +6 -3
  51. data/lib/rdoc/method_attr.rb +353 -0
  52. data/lib/rdoc/normal_class.rb +11 -2
  53. data/lib/rdoc/normal_module.rb +0 -5
  54. data/lib/rdoc/options.rb +373 -82
  55. data/lib/rdoc/parser.rb +59 -23
  56. data/lib/rdoc/parser/c.rb +224 -86
  57. data/lib/rdoc/parser/ruby.rb +219 -111
  58. data/lib/rdoc/parser/ruby_tools.rb +4 -1
  59. data/lib/rdoc/parser/simple.rb +9 -4
  60. data/lib/rdoc/rdoc.rb +68 -28
  61. data/lib/rdoc/require.rb +21 -0
  62. data/lib/rdoc/ri/driver.rb +20 -10
  63. data/lib/rdoc/ri/paths.rb +2 -2
  64. data/lib/rdoc/ri/store.rb +22 -5
  65. data/lib/rdoc/ruby_lex.rb +11 -12
  66. data/lib/rdoc/ruby_token.rb +2 -2
  67. data/lib/rdoc/single_class.rb +2 -1
  68. data/lib/rdoc/stats.rb +202 -162
  69. data/lib/rdoc/stats/normal.rb +51 -0
  70. data/lib/rdoc/stats/quiet.rb +59 -0
  71. data/lib/rdoc/stats/verbose.rb +45 -0
  72. data/lib/rdoc/text.rb +133 -4
  73. data/lib/rdoc/{tokenstream.rb → token_stream.rb} +0 -2
  74. data/lib/rdoc/top_level.rb +230 -39
  75. data/test/test_attribute_manager.rb +58 -7
  76. data/test/test_rdoc_alias.rb +13 -0
  77. data/test/test_rdoc_any_method.rb +43 -2
  78. data/test/test_rdoc_attr.rb +15 -8
  79. data/test/test_rdoc_class_module.rb +133 -0
  80. data/test/test_rdoc_code_object.rb +62 -5
  81. data/test/test_rdoc_context.rb +72 -26
  82. data/test/test_rdoc_encoding.rb +145 -0
  83. data/test/test_rdoc_generator_darkfish.rb +119 -0
  84. data/test/test_rdoc_generator_ri.rb +22 -2
  85. data/test/test_rdoc_include.rb +79 -0
  86. data/test/test_rdoc_markup_attribute_manager.rb +4 -4
  87. data/test/test_rdoc_markup_parser.rb +134 -95
  88. data/test/test_rdoc_markup_pre_process.rb +7 -2
  89. data/test/test_rdoc_markup_to_ansi.rb +43 -153
  90. data/test/test_rdoc_markup_to_bs.rb +42 -156
  91. data/test/test_rdoc_markup_to_html.rb +130 -58
  92. data/test/test_rdoc_markup_to_html_crossref.rb +10 -10
  93. data/test/test_rdoc_markup_to_rdoc.rb +40 -151
  94. data/test/test_rdoc_method_attr.rb +122 -0
  95. data/test/test_rdoc_normal_class.rb +1 -1
  96. data/test/test_rdoc_normal_module.rb +6 -1
  97. data/test/test_rdoc_options.rb +237 -12
  98. data/test/test_rdoc_parser.rb +3 -22
  99. data/test/test_rdoc_parser_c.rb +203 -2
  100. data/test/test_rdoc_parser_ruby.rb +403 -89
  101. data/test/test_rdoc_parser_simple.rb +25 -1
  102. data/test/test_rdoc_rdoc.rb +44 -32
  103. data/test/test_rdoc_ri_driver.rb +29 -24
  104. data/test/test_rdoc_ri_store.rb +46 -3
  105. data/test/test_rdoc_task.rb +1 -1
  106. data/test/test_rdoc_text.rb +102 -8
  107. data/test/test_rdoc_top_level.rb +13 -4
  108. data/test/xref_data.rb +8 -0
  109. data/test/xref_test_case.rb +6 -0
  110. metadata +29 -19
  111. metadata.gz.sig +0 -0
  112. data/lib/rdoc/parser/perl.rb +0 -165
  113. data/test/test_rdoc_parser_perl.rb +0 -73
@@ -49,7 +49,6 @@ module RDoc::Parser::RubyTools
49
49
  obj.pop_token
50
50
  end if @token_listeners
51
51
  else
52
- warn("':' not followed by identifier or operator")
53
52
  tk = tk1
54
53
  end
55
54
  end
@@ -62,6 +61,10 @@ module RDoc::Parser::RubyTools
62
61
  tk
63
62
  end
64
63
 
64
+ ##
65
+ # Reads and returns all tokens up to one of +tokens+. Leaves the matched
66
+ # token in the token list.
67
+
65
68
  def get_tk_until(*tokens)
66
69
  read = []
67
70
 
@@ -1,7 +1,6 @@
1
1
  ##
2
2
  # Parse a non-source file. We basically take the whole thing as one big
3
- # comment. If the first character in the file is '#', we strip leading pound
4
- # signs.
3
+ # comment.
5
4
 
6
5
  class RDoc::Parser::Simple < RDoc::Parser
7
6
 
@@ -32,10 +31,16 @@ class RDoc::Parser::Simple < RDoc::Parser
32
31
  @top_level
33
32
  end
34
33
 
35
- def remove_private_comments(comment)
36
- comment.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
34
+ ##
35
+ # Removes comments wrapped in <tt>--/++</tt>
36
+
37
+ def remove_private_comments text
38
+ text.gsub(/^--\n.*?^\+\+/m, '').sub(/^--\n.*/m, '')
37
39
  end
38
40
 
41
+ ##
42
+ # Removes the encoding magic comment from +text+
43
+
39
44
  def remove_coding_comment text
40
45
  text.sub(/\A# .*coding[=:].*$/, '')
41
46
  end
@@ -1,5 +1,6 @@
1
1
  require 'rdoc'
2
2
 
3
+ require 'rdoc/encoding'
3
4
  require 'rdoc/parser'
4
5
 
5
6
  # Simple must come first
@@ -23,7 +24,28 @@ require 'time'
23
24
  # rdoc.document(args)
24
25
  #
25
26
  # Where +args+ is an array of strings, each corresponding to an argument you'd
26
- # give rdoc on the command line. See rdoc/rdoc.rb for details.
27
+ # give rdoc on the command line. See <tt>rdoc --help<tt> for details.
28
+ #
29
+ # = Plugins
30
+ #
31
+ # When you <tt>require 'rdoc/rdoc'</tt> RDoc looks for 'rdoc/discover' files
32
+ # in your installed gems. This can be used to load alternate generators or
33
+ # add additional preprocessor directives.
34
+ #
35
+ # You will want to wrap your plugin loading in an RDoc version check.
36
+ # Something like:
37
+ #
38
+ # begin
39
+ # gem 'rdoc', '~> 3'
40
+ # require 'path/to/my/awesome/rdoc/plugin'
41
+ # rescue Gem::LoadError
42
+ # end
43
+ #
44
+ # The most obvious plugin type is a new output generator. See RDoc::Generator
45
+ # for details.
46
+ #
47
+ # You can also hook into RDoc::Markup to add new directives (:nodoc: is a
48
+ # directive). See RDoc::Markup::PreProcess::register for details.
27
49
 
28
50
  class RDoc::RDoc
29
51
 
@@ -79,6 +101,10 @@ class RDoc::RDoc
79
101
  @current = rdoc
80
102
  end
81
103
 
104
+ ##
105
+ # Creates a new RDoc::RDoc instance. Call #document to parse files and
106
+ # generate documentation.
107
+
82
108
  def initialize
83
109
  @current = nil
84
110
  @exclude = nil
@@ -142,7 +168,9 @@ class RDoc::RDoc
142
168
 
143
169
  last = {}
144
170
 
145
- if File.exist? dir then
171
+ if @options.dry_run then
172
+ # do nothing
173
+ elsif File.exist? dir then
146
174
  error "#{dir} exists and is not a directory" unless File.directory? dir
147
175
 
148
176
  begin
@@ -167,7 +195,7 @@ you'll need to specify a different output directory name (using the --op <dir>
167
195
  option)
168
196
 
169
197
  ERROR
170
- end
198
+ end unless @options.force_output
171
199
  else
172
200
  FileUtils.mkdir_p dir
173
201
  end
@@ -179,6 +207,8 @@ option)
179
207
  # Update the flag file in an output directory.
180
208
 
181
209
  def update_output_dir(op_dir, time, last = {})
210
+ return if @options.dry_run
211
+
182
212
  open output_flag_file(op_dir), "w" do |f|
183
213
  f.puts time.rfc2822
184
214
  last.each do |n, t|
@@ -277,7 +307,9 @@ option)
277
307
 
278
308
  def parse_file filename
279
309
  @stats.add_file filename
280
- content = read_file_contents filename
310
+ encoding = @options.encoding if defined?(Encoding)
311
+
312
+ content = RDoc::Encoding.read_file filename, encoding
281
313
 
282
314
  return unless content
283
315
 
@@ -288,11 +320,22 @@ option)
288
320
  return unless parser
289
321
 
290
322
  parser.scan
323
+
324
+ # restart documentation for the classes & modules found
325
+ top_level.classes_or_modules.each do |cm|
326
+ cm.done_documenting = false
327
+ end
328
+
329
+ top_level
330
+
291
331
  rescue => e
292
332
  $stderr.puts <<-EOF
293
333
  Before reporting this, could you check that the file you're documenting
294
- compiles cleanly--RDoc is not a full Ruby parser, and gets confused easily if
295
- fed invalid programs.
334
+ has proper syntax:
335
+
336
+ #{Gem.ruby} -c #{filename}
337
+
338
+ RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.
296
339
 
297
340
  The internal error was:
298
341
 
@@ -300,7 +343,7 @@ The internal error was:
300
343
 
301
344
  EOF
302
345
 
303
- $stderr.puts e.backtrace.join("\n\t") if $RDOC_DEBUG
346
+ $stderr.puts e.backtrace.join("\n\t") if $DEBUG_RDOC
304
347
 
305
348
  raise e
306
349
  nil
@@ -344,11 +387,9 @@ The internal error was:
344
387
  # For simplicity, +argv+ is an array of strings, equivalent to the strings
345
388
  # that would be passed on the command line. (This isn't a coincidence, as
346
389
  # we _do_ pass in ARGV when running interactively). For a list of options,
347
- # see rdoc/rdoc.rb. By default, output will be stored in a directory
390
+ # see <tt>rdoc --help</tt>. By default, output will be stored in a directory
348
391
  # called +doc+ below the current directory, so make sure you're somewhere
349
392
  # writable before invoking.
350
- #
351
- # Throws: RDoc::Error on error
352
393
 
353
394
  def document(argv)
354
395
  RDoc::TopLevel.reset
@@ -364,31 +405,36 @@ The internal error was:
364
405
 
365
406
  @exclude = @options.exclude
366
407
 
367
- @last_modified = setup_output_dir @options.op_dir, @options.force_update
408
+ unless @options.coverage_report then
409
+ @last_modified = setup_output_dir @options.op_dir, @options.force_update
410
+ end
368
411
 
369
412
  start_time = Time.now
370
413
 
371
414
  file_info = parse_files @options.files
372
415
 
373
- @options.title = "RDoc Documentation"
416
+ @options.default_title = "RDoc Documentation"
417
+
418
+ RDoc::TopLevel.complete @options.visibility
374
419
 
375
- if file_info.empty?
420
+ if @options.coverage_report then
421
+ puts
422
+ puts @stats.report
423
+ elsif file_info.empty?
376
424
  $stderr.puts "\nNo newer files." unless @options.quiet
377
425
  else
378
426
  gen_klass = @options.generator
379
427
 
380
- unless @options.quiet then
381
- $stderr.puts "\nGenerating #{gen_klass.name.sub(/^.*::/, '')}..."
382
- end
383
-
384
- @generator = gen_klass.for @options
385
-
386
- pwd = Dir.pwd
428
+ @generator = gen_klass.new @options
387
429
 
388
430
  Dir.chdir @options.op_dir do
389
431
  begin
390
432
  self.class.current = self
391
433
 
434
+ unless @options.quiet then
435
+ $stderr.puts "\nGenerating #{gen_klass.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
436
+ end
437
+
392
438
  @generator.generate file_info
393
439
  update_output_dir ".", start_time, @last_modified
394
440
  ensure
@@ -399,16 +445,10 @@ The internal error was:
399
445
 
400
446
  unless @options.quiet or not @stats then
401
447
  puts
402
- @stats.print
448
+ puts @stats.summary
403
449
  end
404
- end
405
450
 
406
- def read_file_contents(filename)
407
- content = open filename, "rb" do |f| f.read end
408
- RDoc::Parser.set_encoding(content)
409
- content
410
- rescue Errno::EISDIR, Errno::ENOENT
411
- nil
451
+ exit @stats.fully_documented? if @options.coverage_report
412
452
  end
413
453
 
414
454
  ##
@@ -16,6 +16,7 @@ class RDoc::Require < RDoc::CodeObject
16
16
  def initialize(name, comment)
17
17
  super()
18
18
  @name = name.gsub(/'|"/, "") #'
19
+ @top_level = nil
19
20
  self.comment = comment
20
21
  end
21
22
 
@@ -28,5 +29,25 @@ class RDoc::Require < RDoc::CodeObject
28
29
  ]
29
30
  end
30
31
 
32
+ def to_s # :nodoc:
33
+ "require #{name} in: #{parent}"
34
+ end
35
+
36
+ ##
37
+ # The RDoc::TopLevel corresponding to this require, or +nil+ if not found.
38
+
39
+ def top_level
40
+ @top_level ||= begin
41
+ tl = RDoc::TopLevel.all_files_hash[name + '.rb']
42
+
43
+ if tl.nil? and RDoc::TopLevel.all_files.first.full_name =~ %r(^lib/) then
44
+ # second chance
45
+ tl = RDoc::TopLevel.all_files_hash['lib/' + name + '.rb']
46
+ end
47
+
48
+ tl
49
+ end
50
+ end
51
+
31
52
  end
32
53
 
@@ -6,6 +6,11 @@ begin
6
6
  rescue LoadError
7
7
  end
8
8
 
9
+ begin
10
+ require 'win32console'
11
+ rescue LoadError
12
+ end
13
+
9
14
  require 'rdoc/ri'
10
15
  require 'rdoc/ri/paths'
11
16
  require 'rdoc/markup'
@@ -55,6 +60,9 @@ class RDoc::RI::Driver
55
60
  end
56
61
  end
57
62
 
63
+ ##
64
+ # An RDoc::RI::Store for each entry in the RI path
65
+
58
66
  attr_accessor :stores
59
67
 
60
68
  ##
@@ -120,7 +128,7 @@ Where name can be:
120
128
  All class names may be abbreviated to their minimum unambiguous form. If a name
121
129
  is ambiguous, all valid options will be listed.
122
130
 
123
- The form '.' method matches either class or instance methods, while #method
131
+ A '.' matches either class or instance methods, while #method
124
132
  matches only instance and ::method matches only class methods.
125
133
 
126
134
  For example:
@@ -130,7 +138,7 @@ For example:
130
138
  #{opt.program_name} File.new
131
139
  #{opt.program_name} zip
132
140
 
133
- Note that shell quoting may be required for method names containing
141
+ Note that shell quoting or escaping may be required for method names containing
134
142
  punctuation:
135
143
 
136
144
  #{opt.program_name} 'Array.[]'
@@ -354,7 +362,7 @@ Options may also be set in the 'RI' environment variable.
354
362
 
355
363
  paths = RDoc::Markup::Verbatim.new
356
364
  also_in.each do |store|
357
- paths.parts.push ' ', store.friendly_path, "\n"
365
+ paths.parts.push store.friendly_path, "\n"
358
366
  end
359
367
  out << paths
360
368
  end
@@ -422,7 +430,7 @@ Options may also be set in the 'RI' environment variable.
422
430
  verb = RDoc::Markup::Verbatim.new
423
431
 
424
432
  wout.each do |incl|
425
- verb.push ' ', incl.name, "\n"
433
+ verb.push incl.name, "\n"
426
434
  end
427
435
 
428
436
  out << verb
@@ -441,7 +449,7 @@ Options may also be set in the 'RI' environment variable.
441
449
  out << RDoc::Markup::BlankLine.new
442
450
 
443
451
  out.push(*methods.map do |method|
444
- RDoc::Markup::Verbatim.new ' ', method
452
+ RDoc::Markup::Verbatim.new method
445
453
  end)
446
454
 
447
455
  out << RDoc::Markup::BlankLine.new
@@ -546,7 +554,7 @@ Options may also be set in the 'RI' environment variable.
546
554
 
547
555
  def display document
548
556
  page do |io|
549
- text = document.accept formatter
557
+ text = document.accept formatter(io)
550
558
 
551
559
  io.write text
552
560
  end
@@ -659,8 +667,8 @@ Options may also be set in the 'RI' environment variable.
659
667
 
660
668
  if method.arglists then
661
669
  arglists = method.arglists.chomp.split "\n"
662
- arglists = arglists.map { |line| [' ', line, "\n"] }
663
- out << RDoc::Markup::Verbatim.new(*arglists.flatten)
670
+ arglists = arglists.map { |line| line + "\n" }
671
+ out << RDoc::Markup::Verbatim.new(*arglists)
664
672
  out << RDoc::Markup::Rule.new(1)
665
673
  end
666
674
 
@@ -795,10 +803,10 @@ Options may also be set in the 'RI' environment variable.
795
803
  # Creates a new RDoc::Markup::Formatter. If a formatter is given with -f,
796
804
  # use it. If we're outputting to a pager, use bs, otherwise ansi.
797
805
 
798
- def formatter
806
+ def formatter(io)
799
807
  if @formatter_klass then
800
808
  @formatter_klass.new
801
- elsif paging? then
809
+ elsif paging? or !io.tty? then
802
810
  RDoc::Markup::ToBs.new
803
811
  else
804
812
  RDoc::Markup::ToAnsi.new
@@ -1045,6 +1053,8 @@ Options may also be set in the 'RI' environment variable.
1045
1053
  pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
1046
1054
 
1047
1055
  pagers.compact.uniq.each do |pager|
1056
+ next unless pager
1057
+
1048
1058
  pager_cmd = pager.split.first
1049
1059
 
1050
1060
  next unless in_path? pager_cmd
@@ -37,7 +37,7 @@ module RDoc::RI::Paths
37
37
  # true
38
38
  # :site:: Where ri for installed libraries are stored. Yielded when
39
39
  # +site+ is true. Normally no ri data is stored here.
40
- # :home:: ~/.ri. Yielded when +home+ is true.
40
+ # :home:: ~/.rdoc. Yielded when +home+ is true.
41
41
  # :gem:: ri data for an installed gem. Yielded when +gems+ is true.
42
42
  # :extra:: ri data directory from the command line. Yielded for each
43
43
  # entry in +extra_dirs+
@@ -49,7 +49,7 @@ module RDoc::RI::Paths
49
49
 
50
50
  yield SYSDIR, :system if system
51
51
  yield SITEDIR, :site if site
52
- yield HOMEDIR, :home if home
52
+ yield HOMEDIR, :home if home and HOMEDIR
53
53
 
54
54
  gemdirs.each do |dir|
55
55
  yield dir, :gem
@@ -10,6 +10,11 @@ require 'fileutils'
10
10
 
11
11
  class RDoc::RI::Store
12
12
 
13
+ ##
14
+ # If true this Store will not write any files
15
+
16
+ attr_accessor :dry_run
17
+
13
18
  ##
14
19
  # Path this store reads or writes
15
20
 
@@ -21,14 +26,18 @@ class RDoc::RI::Store
21
26
 
22
27
  attr_accessor :type
23
28
 
29
+ ##
30
+ # The contents of the Store
31
+
24
32
  attr_reader :cache
25
33
 
26
34
  ##
27
35
  # Creates a new Store of +type+ that will load or save to +path+
28
36
 
29
37
  def initialize path, type = nil
30
- @type = type
31
- @path = path
38
+ @dry_run = false
39
+ @type = type
40
+ @path = path
32
41
 
33
42
  @cache = {
34
43
  :class_methods => {},
@@ -172,9 +181,13 @@ class RDoc::RI::Store
172
181
 
173
182
  def save_cache
174
183
  # HACK mongrel-1.1.5 documents its files twice
184
+ @cache[:ancestors]. each do |_, m| m.uniq!; m.sort! end
175
185
  @cache[:attributes]. each do |_, m| m.uniq!; m.sort! end
176
186
  @cache[:class_methods]. each do |_, m| m.uniq!; m.sort! end
177
187
  @cache[:instance_methods].each do |_, m| m.uniq!; m.sort! end
188
+ @cache[:modules].uniq!; @cache[:modules].sort!
189
+
190
+ return if @dry_run
178
191
 
179
192
  open cache_path, 'wb' do |io|
180
193
  Marshal.dump @cache, io
@@ -185,7 +198,7 @@ class RDoc::RI::Store
185
198
  # Writes the ri data for +klass+
186
199
 
187
200
  def save_class klass
188
- FileUtils.mkdir_p class_path(klass.full_name)
201
+ FileUtils.mkdir_p class_path(klass.full_name) unless @dry_run
189
202
 
190
203
  @cache[:modules] << klass.full_name
191
204
 
@@ -212,7 +225,7 @@ class RDoc::RI::Store
212
225
  @cache[:ancestors][klass.full_name].push(*ancestors)
213
226
 
214
227
  attributes = klass.attributes.map do |attribute|
215
- "#{attribute.type} #{attribute.name}"
228
+ "#{attribute.definition} #{attribute.name}"
216
229
  end
217
230
 
218
231
  unless attributes.empty? then
@@ -220,6 +233,8 @@ class RDoc::RI::Store
220
233
  @cache[:attributes][klass.full_name].push(*attributes)
221
234
  end
222
235
 
236
+ return if @dry_run
237
+
223
238
  open path, 'wb' do |io|
224
239
  Marshal.dump klass, io
225
240
  end
@@ -229,7 +244,7 @@ class RDoc::RI::Store
229
244
  # Writes the ri data for +method+ on +klass+
230
245
 
231
246
  def save_method klass, method
232
- FileUtils.mkdir_p class_path(klass.full_name)
247
+ FileUtils.mkdir_p class_path(klass.full_name) unless @dry_run
233
248
 
234
249
  cache = if method.singleton then
235
250
  @cache[:class_methods]
@@ -239,6 +254,8 @@ class RDoc::RI::Store
239
254
  cache[klass.full_name] ||= []
240
255
  cache[klass.full_name] << method.name
241
256
 
257
+ return if @dry_run
258
+
242
259
  open method_file(klass.full_name, method.full_name), 'wb' do |io|
243
260
  Marshal.dump method, io
244
261
  end