rdoc 3.6.1 → 3.7

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 (66) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +45 -0
  3. data/Manifest.txt +4 -0
  4. data/lib/rdoc.rb +3 -2
  5. data/lib/rdoc/any_method.rb +12 -7
  6. data/lib/rdoc/attr.rb +16 -1
  7. data/lib/rdoc/class_module.rb +156 -42
  8. data/lib/rdoc/code_object.rb +8 -1
  9. data/lib/rdoc/context.rb +75 -29
  10. data/lib/rdoc/generator/markup.rb +3 -1
  11. data/lib/rdoc/generator/ri.rb +3 -2
  12. data/lib/rdoc/generator/template/darkfish/rdoc.css +4 -0
  13. data/lib/rdoc/known_classes.rb +2 -2
  14. data/lib/rdoc/markup.rb +63 -18
  15. data/lib/rdoc/markup/document.rb +43 -4
  16. data/lib/rdoc/markup/formatter.rb +13 -3
  17. data/lib/rdoc/markup/formatter_test_case.rb +13 -3
  18. data/lib/rdoc/markup/indented_paragraph.rb +33 -0
  19. data/lib/rdoc/markup/inline.rb +8 -1
  20. data/lib/rdoc/markup/parser.rb +1 -0
  21. data/lib/rdoc/markup/pre_process.rb +7 -0
  22. data/lib/rdoc/markup/to_ansi.rb +4 -4
  23. data/lib/rdoc/markup/to_bs.rb +1 -1
  24. data/lib/rdoc/markup/to_html.rb +2 -2
  25. data/lib/rdoc/markup/to_html_crossref.rb +3 -2
  26. data/lib/rdoc/markup/to_rdoc.rb +10 -1
  27. data/lib/rdoc/markup/to_test.rb +1 -1
  28. data/lib/rdoc/markup/to_tt_only.rb +1 -1
  29. data/lib/rdoc/parser.rb +1 -1
  30. data/lib/rdoc/parser/c.rb +69 -26
  31. data/lib/rdoc/parser/ruby.rb +19 -9
  32. data/lib/rdoc/rdoc.rb +14 -3
  33. data/lib/rdoc/ri/driver.rb +137 -103
  34. data/lib/rdoc/ri/store.rb +111 -26
  35. data/lib/rdoc/ruby_lex.rb +1 -1
  36. data/lib/rdoc/rubygems_hook.rb +220 -0
  37. data/lib/rdoc/text.rb +1 -1
  38. data/lib/rdoc/top_level.rb +31 -0
  39. data/test/test_rdoc_any_method.rb +68 -0
  40. data/test/test_rdoc_attr.rb +62 -0
  41. data/test/test_rdoc_class_module.rb +459 -29
  42. data/test/test_rdoc_code_object.rb +17 -0
  43. data/test/test_rdoc_context.rb +70 -0
  44. data/test/test_rdoc_context_section.rb +1 -1
  45. data/test/test_rdoc_generator_ri.rb +14 -3
  46. data/test/test_rdoc_markup.rb +55 -1
  47. data/test/test_rdoc_markup_document.rb +83 -0
  48. data/test/test_rdoc_markup_indented_paragraph.rb +40 -0
  49. data/test/test_rdoc_markup_paragraph.rb +12 -0
  50. data/test/test_rdoc_markup_pre_process.rb +13 -2
  51. data/test/test_rdoc_markup_to_ansi.rb +4 -0
  52. data/test/test_rdoc_markup_to_bs.rb +4 -0
  53. data/test/test_rdoc_markup_to_html.rb +7 -3
  54. data/test/test_rdoc_markup_to_rdoc.rb +14 -0
  55. data/test/test_rdoc_markup_to_tt_only.rb +4 -0
  56. data/test/test_rdoc_parser_c.rb +302 -2
  57. data/test/test_rdoc_parser_ruby.rb +48 -1
  58. data/test/test_rdoc_rdoc.rb +41 -10
  59. data/test/test_rdoc_ri_driver.rb +40 -7
  60. data/test/test_rdoc_ri_store.rb +111 -23
  61. data/test/test_rdoc_rubygems_hook.rb +201 -0
  62. data/test/test_rdoc_stats.rb +12 -12
  63. data/test/test_rdoc_text.rb +17 -0
  64. data/test/test_rdoc_top_level.rb +35 -0
  65. metadata +18 -14
  66. metadata.gz.sig +0 -0
@@ -0,0 +1,201 @@
1
+ require 'rubygems/test_case'
2
+ require 'rubygems'
3
+ require 'rdoc/rubygems_hook'
4
+
5
+ class TestRDocRubygemsHook < Gem::TestCase
6
+
7
+ def setup
8
+ super
9
+ skip 'requires RubyGems 1.9+' unless
10
+ Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
11
+
12
+ @a = quick_spec 'a'
13
+
14
+ @rdoc = RDoc::RubygemsHook.new @a
15
+
16
+ begin
17
+ RDoc::RubygemsHook.load_rdoc
18
+ rescue Gem::DocumentError => e
19
+ skip e.message
20
+ end
21
+
22
+ Gem.configuration[:rdoc] = nil
23
+ end
24
+
25
+ def test_initialize
26
+ assert @rdoc.generate_rdoc
27
+ assert @rdoc.generate_ri
28
+
29
+ rdoc = RDoc::RubygemsHook.new @a, false, false
30
+
31
+ refute rdoc.generate_rdoc
32
+ refute rdoc.generate_ri
33
+ end
34
+
35
+ def test_delete_legacy_args
36
+ args = %w[
37
+ --inline-source
38
+ --one-file
39
+ --promiscuous
40
+ -p
41
+ ]
42
+
43
+ @rdoc.delete_legacy_args args
44
+
45
+ assert_empty args
46
+ end
47
+
48
+ def test_document
49
+ options = RDoc::Options.new
50
+ options.files = []
51
+
52
+ @rdoc.instance_variable_set :@rdoc, @rdoc.new_rdoc
53
+ @rdoc.instance_variable_set :@file_info, []
54
+
55
+ @rdoc.document 'darkfish', options, @a.doc_dir('rdoc')
56
+
57
+ assert @rdoc.rdoc_installed?
58
+ end
59
+
60
+ def test_generate
61
+ FileUtils.mkdir_p @a.doc_dir
62
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
63
+
64
+ @rdoc.generate
65
+
66
+ assert @rdoc.rdoc_installed?
67
+ assert @rdoc.ri_installed?
68
+
69
+ rdoc = @rdoc.instance_variable_get :@rdoc
70
+
71
+ refute rdoc.options.hyperlink_all
72
+ end
73
+
74
+ def test_generate_configuration_rdoc_array
75
+ Gem.configuration[:rdoc] = %w[-A]
76
+
77
+ FileUtils.mkdir_p @a.doc_dir
78
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
79
+
80
+ @rdoc.generate
81
+
82
+ rdoc = @rdoc.instance_variable_get :@rdoc
83
+
84
+ assert rdoc.options.hyperlink_all
85
+ end
86
+
87
+ def test_generate_configuration_rdoc_string
88
+ Gem.configuration[:rdoc] = '-A'
89
+
90
+ FileUtils.mkdir_p @a.doc_dir
91
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
92
+
93
+ @rdoc.generate
94
+
95
+ rdoc = @rdoc.instance_variable_get :@rdoc
96
+
97
+ assert rdoc.options.hyperlink_all
98
+ end
99
+
100
+ def test_generate_disabled
101
+ @rdoc.generate_rdoc = false
102
+ @rdoc.generate_ri = false
103
+
104
+ @rdoc.generate
105
+
106
+ refute @rdoc.rdoc_installed?
107
+ refute @rdoc.ri_installed?
108
+ end
109
+
110
+ def test_generate_force
111
+ FileUtils.mkdir_p @a.doc_dir 'ri'
112
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
113
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
114
+
115
+ @rdoc.force = true
116
+
117
+ @rdoc.generate
118
+
119
+ assert_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
120
+ assert_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
121
+ end
122
+
123
+ def test_generate_no_overwrite
124
+ FileUtils.mkdir_p @a.doc_dir 'ri'
125
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
126
+ FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
127
+
128
+ @rdoc.generate
129
+
130
+ refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
131
+ refute_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
132
+ end
133
+
134
+ def test_new_rdoc
135
+ assert_kind_of RDoc::RDoc, @rdoc.new_rdoc
136
+ end
137
+
138
+ def test_rdoc_installed?
139
+ refute @rdoc.rdoc_installed?
140
+
141
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
142
+
143
+ assert @rdoc.rdoc_installed?
144
+ end
145
+
146
+ def test_remove
147
+ FileUtils.mkdir_p @a.doc_dir 'rdoc'
148
+ FileUtils.mkdir_p @a.doc_dir 'ri'
149
+
150
+ @rdoc.remove
151
+
152
+ refute @rdoc.rdoc_installed?
153
+ refute @rdoc.ri_installed?
154
+
155
+ assert_path_exists @a.doc_dir
156
+ end
157
+
158
+ def test_remove_unwritable
159
+ skip 'chmod not supported' if Gem.win_platform?
160
+ FileUtils.mkdir_p @a.base_dir
161
+ FileUtils.chmod 0, @a.base_dir
162
+
163
+ e = assert_raises Gem::FilePermissionError do
164
+ @rdoc.remove
165
+ end
166
+
167
+ assert_equal @a.base_dir, e.directory
168
+ ensure
169
+ FileUtils.chmod 0755, @a.base_dir
170
+ end
171
+
172
+ def test_ri_installed?
173
+ refute @rdoc.ri_installed?
174
+
175
+ FileUtils.mkdir_p @a.doc_dir 'ri'
176
+
177
+ assert @rdoc.ri_installed?
178
+ end
179
+
180
+ def test_setup
181
+ @rdoc.setup
182
+
183
+ assert_path_exists @a.doc_dir
184
+ end
185
+
186
+ def test_setup_unwritable
187
+ skip 'chmod not supported' if Gem.win_platform?
188
+ FileUtils.mkdir_p @a.doc_dir
189
+ FileUtils.chmod 0, @a.doc_dir
190
+
191
+ e = assert_raises Gem::FilePermissionError do
192
+ @rdoc.setup
193
+ end
194
+
195
+ assert_equal @a.doc_dir, e.directory
196
+ ensure
197
+ FileUtils.chmod 0755, @a.doc_dir
198
+ end
199
+
200
+ end
201
+
@@ -17,7 +17,7 @@ class TestRDocStats < MiniTest::Unit::TestCase
17
17
  tl = RDoc::TopLevel.new 'file.rb'
18
18
  c = tl.add_class RDoc::NormalClass, 'C'
19
19
  c.record_location tl
20
- c.comment = 'C'
20
+ c.add_comment 'C', tl
21
21
 
22
22
  a = RDoc::Attr.new nil, 'a', 'RW', nil
23
23
  a.record_location tl
@@ -43,7 +43,7 @@ end
43
43
  tl = RDoc::TopLevel.new 'file.rb'
44
44
  c = tl.add_class RDoc::NormalClass, 'C'
45
45
  c.record_location tl
46
- c.comment = 'C'
46
+ c.add_comment 'C', tl
47
47
 
48
48
  a = RDoc::Attr.new nil, 'a', 'RW', 'a'
49
49
  a.record_location tl
@@ -60,7 +60,7 @@ end
60
60
  tl = RDoc::TopLevel.new 'file.rb'
61
61
  m = tl.add_module RDoc::NormalModule, 'M'
62
62
  m.record_location tl
63
- m.comment = 'M'
63
+ m.add_comment 'M', tl
64
64
 
65
65
  c = RDoc::Constant.new 'C', nil, nil
66
66
  c.record_location tl
@@ -152,7 +152,7 @@ end
152
152
  tl = RDoc::TopLevel.new 'file.rb'
153
153
  c = tl.add_class RDoc::NormalClass, 'C'
154
154
  c.record_location tl
155
- c.comment = 'C'
155
+ c.add_comment 'C', tl
156
156
 
157
157
  m = RDoc::AnyMethod.new nil, 'm'
158
158
  m.record_location tl
@@ -170,7 +170,7 @@ end
170
170
  tl = RDoc::TopLevel.new 'file.rb'
171
171
  c1 = tl.add_class RDoc::NormalClass, 'C1'
172
172
  c1.record_location tl
173
- c1.comment = 'C1'
173
+ c1.add_comment 'C1', tl
174
174
 
175
175
  m1 = RDoc::AnyMethod.new nil, 'm1'
176
176
  m1.record_location tl
@@ -231,7 +231,7 @@ The following items are not documented:
231
231
 
232
232
  c2 = tl.add_class RDoc::NormalClass, 'C2'
233
233
  c2.record_location tl
234
- c2.comment = 'C2'
234
+ c2.add_comment 'C2', tl
235
235
 
236
236
  RDoc::TopLevel.complete :public
237
237
 
@@ -291,7 +291,7 @@ end
291
291
  tl = RDoc::TopLevel.new 'file.rb'
292
292
  c = tl.add_class RDoc::NormalClass, 'C'
293
293
  c.record_location tl
294
- c.comment = 'C'
294
+ c.add_comment 'C', tl
295
295
 
296
296
  m1 = RDoc::AnyMethod.new nil, 'm1'
297
297
  m1.record_location tl
@@ -324,7 +324,7 @@ end
324
324
  tl = RDoc::TopLevel.new 'file.rb'
325
325
  c = tl.add_class RDoc::NormalClass, 'C'
326
326
  c.record_location tl
327
- c.comment = 'C'
327
+ c.add_comment 'C', tl
328
328
 
329
329
  m = RDoc::AnyMethod.new nil, 'm'
330
330
  m.record_location tl
@@ -342,7 +342,7 @@ end
342
342
  tl = RDoc::TopLevel.new 'file.rb'
343
343
  c = tl.add_class RDoc::NormalClass, 'C'
344
344
  c.record_location tl
345
- c.comment = 'C'
345
+ c.add_comment 'C', tl
346
346
 
347
347
  m1 = RDoc::AnyMethod.new nil, 'm1'
348
348
  m1.record_location tl
@@ -379,7 +379,7 @@ end
379
379
  tl = RDoc::TopLevel.new 'file.rb'
380
380
  c = tl.add_class RDoc::NormalClass, 'C'
381
381
  c.record_location tl
382
- c.comment = 'C'
382
+ c.add_comment 'C', tl
383
383
 
384
384
  m = RDoc::AnyMethod.new nil, 'm'
385
385
  m.record_location tl
@@ -399,7 +399,7 @@ end
399
399
  tl = RDoc::TopLevel.new 'file.rb'
400
400
  c = tl.add_class RDoc::NormalClass, 'C'
401
401
  c.record_location tl
402
- c.comment = 'C'
402
+ c.add_comment 'C', tl
403
403
 
404
404
  m = RDoc::AnyMethod.new nil, 'm'
405
405
  m.record_location tl
@@ -505,7 +505,7 @@ Total: 1 (1 undocumented)
505
505
  tl = RDoc::TopLevel.new 'file.rb'
506
506
  c = tl.add_class RDoc::NormalClass, 'C'
507
507
  c.record_location tl
508
- c.comment = 'C'
508
+ c.add_comment 'C', tl
509
509
 
510
510
  m = RDoc::AnyMethod.new nil, 'm'
511
511
  m.record_location tl
@@ -240,6 +240,23 @@ The comments associated with
240
240
  assert_equal expected, strip_stars(text)
241
241
  end
242
242
 
243
+ def test_strip_stars_document_method
244
+ text = <<-TEXT
245
+ /*
246
+ * Document-method: Zlib::GzipFile#mtime=
247
+ *
248
+ * A comment
249
+ */
250
+ TEXT
251
+
252
+ expected = <<-EXPECTED
253
+
254
+ A comment
255
+ EXPECTED
256
+
257
+ assert_equal expected, strip_stars(text)
258
+ end
259
+
243
260
  def test_strip_stars_encoding
244
261
  skip "Encoding not implemented" unless Object.const_defined? :Encoding
245
262
 
@@ -81,6 +81,15 @@ class TestRDocTopLevel < XrefTestCase
81
81
  RDoc::TopLevel.modules.map { |m| m.full_name }.sort
82
82
  end
83
83
 
84
+ def test_class_new
85
+ tl1 = RDoc::TopLevel.new 'file.rb'
86
+ tl2 = RDoc::TopLevel.new 'file.rb'
87
+ tl3 = RDoc::TopLevel.new 'other.rb'
88
+
89
+ assert_same tl1, tl2
90
+ refute_same tl1, tl3
91
+ end
92
+
84
93
  def test_class_reset
85
94
  RDoc::TopLevel.reset
86
95
 
@@ -93,6 +102,24 @@ class TestRDocTopLevel < XrefTestCase
93
102
  assert_equal 'top_level.rb', @top_level.base_name
94
103
  end
95
104
 
105
+ def test_eql_eh
106
+ top_level2 = RDoc::TopLevel.new 'path/top_level.rb'
107
+ other_level = RDoc::TopLevel.new 'path/other_level.rb'
108
+
109
+ assert_operator @top_level, :eql?, top_level2
110
+
111
+ refute_operator other_level, :eql?, @top_level
112
+ end
113
+
114
+ def test_equals2
115
+ top_level2 = RDoc::TopLevel.new 'path/top_level.rb'
116
+ other_level = RDoc::TopLevel.new 'path/other_level.rb'
117
+
118
+ assert_equal @top_level, top_level2
119
+
120
+ refute_equal other_level, @top_level
121
+ end
122
+
96
123
  def test_find_class_or_module
97
124
  assert_equal @c1, @xref_data.find_class_or_module('C1')
98
125
  assert_equal @c2_c3, @xref_data.find_class_or_module('C2::C3')
@@ -104,6 +131,14 @@ class TestRDocTopLevel < XrefTestCase
104
131
  assert_equal 'path/top_level.rb', @top_level.full_name
105
132
  end
106
133
 
134
+ def test_hash
135
+ tl2 = RDoc::TopLevel.new 'path/top_level.rb'
136
+ tl3 = RDoc::TopLevel.new 'other/top_level.rb'
137
+
138
+ assert_equal @top_level.hash, tl2.hash
139
+ refute_equal @top_level.hash, tl3.hash
140
+ end
141
+
107
142
  def test_http_url
108
143
  assert_equal 'prefix/path/top_level_rb.html', @top_level.http_url('prefix')
109
144
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
- - 6
9
- - 1
10
- version: 3.6.1
8
+ - 7
9
+ version: "3.7"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Eric Hodel
@@ -39,7 +38,7 @@ cert_chain:
39
38
  x52qPcexcYZR7w==
40
39
  -----END CERTIFICATE-----
41
40
 
42
- date: 2011-05-15 00:00:00 Z
41
+ date: 2011-06-27 00:00:00 Z
43
42
  dependencies:
44
43
  - !ruby/object:Gem::Dependency
45
44
  name: minitest
@@ -49,12 +48,12 @@ dependencies:
49
48
  requirements:
50
49
  - - ">="
51
50
  - !ruby/object:Gem::Version
52
- hash: 11
51
+ hash: 1
53
52
  segments:
54
53
  - 2
55
- - 0
56
- - 2
57
- version: 2.0.2
54
+ - 3
55
+ - 1
56
+ version: 2.3.1
58
57
  type: :development
59
58
  version_requirements: *id001
60
59
  - !ruby/object:Gem::Dependency
@@ -105,14 +104,13 @@ dependencies:
105
104
  requirement: &id005 !ruby/object:Gem::Requirement
106
105
  none: false
107
106
  requirements:
108
- - - ">="
107
+ - - ~>
109
108
  - !ruby/object:Gem::Version
110
- hash: 35
109
+ hash: 17
111
110
  segments:
112
111
  - 2
113
112
  - 9
114
- - 4
115
- version: 2.9.4
113
+ version: "2.9"
116
114
  type: :development
117
115
  version_requirements: *id005
118
116
  description: |-
@@ -205,6 +203,7 @@ files:
205
203
  - lib/rdoc/markup/formatter.rb
206
204
  - lib/rdoc/markup/formatter_test_case.rb
207
205
  - lib/rdoc/markup/heading.rb
206
+ - lib/rdoc/markup/indented_paragraph.rb
208
207
  - lib/rdoc/markup/inline.rb
209
208
  - lib/rdoc/markup/list.rb
210
209
  - lib/rdoc/markup/list_item.rb
@@ -241,6 +240,7 @@ files:
241
240
  - lib/rdoc/ri/store.rb
242
241
  - lib/rdoc/ruby_lex.rb
243
242
  - lib/rdoc/ruby_token.rb
243
+ - lib/rdoc/rubygems_hook.rb
244
244
  - lib/rdoc/single_class.rb
245
245
  - lib/rdoc/stats.rb
246
246
  - lib/rdoc/stats/normal.rb
@@ -273,6 +273,7 @@ files:
273
273
  - test/test_rdoc_markup.rb
274
274
  - test/test_rdoc_markup_attribute_manager.rb
275
275
  - test/test_rdoc_markup_document.rb
276
+ - test/test_rdoc_markup_indented_paragraph.rb
276
277
  - test/test_rdoc_markup_paragraph.rb
277
278
  - test/test_rdoc_markup_parser.rb
278
279
  - test/test_rdoc_markup_pre_process.rb
@@ -297,6 +298,7 @@ files:
297
298
  - test/test_rdoc_ri_paths.rb
298
299
  - test/test_rdoc_ri_store.rb
299
300
  - test/test_rdoc_ruby_lex.rb
301
+ - test/test_rdoc_rubygems_hook.rb
300
302
  - test/test_rdoc_single_class.rb
301
303
  - test/test_rdoc_stats.rb
302
304
  - test/test_rdoc_task.rb
@@ -338,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
340
  requirements: []
339
341
 
340
342
  rubyforge_project: rdoc
341
- rubygems_version: 1.8.2
343
+ rubygems_version: 1.8.5
342
344
  signing_key:
343
345
  specification_version: 3
344
346
  summary: RDoc produces HTML and command-line documentation for Ruby projects
@@ -359,6 +361,7 @@ test_files:
359
361
  - test/test_rdoc_markup.rb
360
362
  - test/test_rdoc_markup_attribute_manager.rb
361
363
  - test/test_rdoc_markup_document.rb
364
+ - test/test_rdoc_markup_indented_paragraph.rb
362
365
  - test/test_rdoc_markup_paragraph.rb
363
366
  - test/test_rdoc_markup_parser.rb
364
367
  - test/test_rdoc_markup_pre_process.rb
@@ -383,6 +386,7 @@ test_files:
383
386
  - test/test_rdoc_ri_paths.rb
384
387
  - test/test_rdoc_ri_store.rb
385
388
  - test/test_rdoc_ruby_lex.rb
389
+ - test/test_rdoc_rubygems_hook.rb
386
390
  - test/test_rdoc_single_class.rb
387
391
  - test/test_rdoc_stats.rb
388
392
  - test/test_rdoc_task.rb