rdoc 4.1.2 → 4.2.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.autotest +3 -1
  3. data/History.rdoc +70 -3
  4. data/LEGAL.rdoc +11 -0
  5. data/Manifest.txt +6 -2
  6. data/Rakefile +8 -1
  7. data/lib/rdoc.rb +3 -1
  8. data/lib/rdoc/context.rb +2 -0
  9. data/lib/rdoc/encoding.rb +3 -1
  10. data/lib/rdoc/generator.rb +1 -0
  11. data/lib/rdoc/generator/darkfish.rb +3 -2
  12. data/lib/rdoc/generator/json_index.rb +44 -0
  13. data/lib/rdoc/generator/pot.rb +97 -0
  14. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
  15. data/lib/rdoc/generator/template/darkfish/_head.rhtml +9 -12
  16. data/lib/rdoc/generator/template/darkfish/{fonts.css → css/fonts.css} +0 -0
  17. data/lib/rdoc/generator/template/darkfish/{rdoc.css → css/rdoc.css} +11 -1
  18. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +32 -11
  19. data/lib/rdoc/markdown.kpeg +6 -1
  20. data/lib/rdoc/markdown.rb +174 -2
  21. data/lib/rdoc/markup.rb +2 -2
  22. data/lib/rdoc/markup/attribute_manager.rb +1 -1
  23. data/lib/rdoc/markup/to_html.rb +5 -4
  24. data/lib/rdoc/markup/to_label.rb +1 -1
  25. data/lib/rdoc/method_attr.rb +11 -3
  26. data/lib/rdoc/options.rb +55 -3
  27. data/lib/rdoc/parser.rb +1 -1
  28. data/lib/rdoc/parser/c.rb +5 -6
  29. data/lib/rdoc/parser/changelog.rb +7 -3
  30. data/lib/rdoc/parser/ruby.rb +8 -12
  31. data/lib/rdoc/rd/block_parser.rb +1 -1
  32. data/lib/rdoc/rd/inline_parser.rb +1 -1
  33. data/lib/rdoc/rdoc.rb +5 -3
  34. data/lib/rdoc/ruby_lex.rb +3 -3
  35. data/lib/rdoc/ruby_token.rb +7 -7
  36. data/lib/rdoc/single_class.rb +4 -0
  37. data/lib/rdoc/stats.rb +4 -0
  38. data/lib/rdoc/stats/normal.rb +22 -11
  39. data/lib/rdoc/task.rb +1 -1
  40. data/lib/rdoc/test_case.rb +1 -1
  41. data/lib/rdoc/text.rb +9 -0
  42. data/lib/rdoc/token_stream.rb +1 -1
  43. data/test/test_rdoc_context.rb +2 -0
  44. data/test/test_rdoc_encoding.rb +23 -0
  45. data/test/test_rdoc_generator_darkfish.rb +2 -2
  46. data/test/test_rdoc_generator_json_index.rb +55 -0
  47. data/test/test_rdoc_generator_markup.rb +1 -1
  48. data/test/test_rdoc_generator_pot.rb +91 -0
  49. data/test/test_rdoc_generator_pot_po.rb +51 -0
  50. data/test/test_rdoc_generator_pot_po_entry.rb +139 -0
  51. data/test/test_rdoc_i18n_locale.rb +73 -0
  52. data/test/test_rdoc_i18n_text.rb +123 -0
  53. data/test/test_rdoc_markup_attribute_manager.rb +6 -0
  54. data/test/test_rdoc_markup_heading.rb +4 -4
  55. data/test/test_rdoc_markup_pre_process.rb +1 -1
  56. data/test/test_rdoc_markup_to_html.rb +46 -26
  57. data/test/test_rdoc_markup_to_html_snippet.rb +8 -7
  58. data/test/test_rdoc_markup_to_label.rb +4 -4
  59. data/test/test_rdoc_method_attr.rb +31 -1
  60. data/test/test_rdoc_normal_class.rb +4 -4
  61. data/test/test_rdoc_options.rb +19 -0
  62. data/test/test_rdoc_parser.rb +16 -1
  63. data/test/test_rdoc_parser_c.rb +31 -1
  64. data/test/test_rdoc_parser_changelog.rb +1 -1
  65. data/test/test_rdoc_parser_markdown.rb +1 -1
  66. data/test/test_rdoc_parser_rd.rb +1 -1
  67. data/test/test_rdoc_parser_ruby.rb +22 -25
  68. data/test/test_rdoc_parser_simple.rb +1 -1
  69. data/test/test_rdoc_rd_block_parser.rb +3 -1
  70. data/test/test_rdoc_rdoc.rb +24 -3
  71. data/test/test_rdoc_ruby_lex.rb +11 -0
  72. data/test/test_rdoc_rubygems_hook.rb +0 -3
  73. data/test/test_rdoc_single_class.rb +13 -5
  74. data/test/test_rdoc_stats.rb +55 -0
  75. data/test/test_rdoc_task.rb +1 -0
  76. metadata +18 -7
@@ -12,7 +12,7 @@ class TestRDocParserChangeLog < RDoc::TestCase
12
12
  end
13
13
 
14
14
  def teardown
15
- @tempfile.close
15
+ @tempfile.close!
16
16
  end
17
17
 
18
18
  def test_class_can_parse
@@ -19,7 +19,7 @@ class TestRDocParserMarkdown < RDoc::TestCase
19
19
  def teardown
20
20
  super
21
21
 
22
- @tempfile.close
22
+ @tempfile.close!
23
23
  end
24
24
 
25
25
  def test_file
@@ -19,7 +19,7 @@ class TestRDocParserRd < RDoc::TestCase
19
19
  def teardown
20
20
  super
21
21
 
22
- @tempfile.close
22
+ @tempfile.close!
23
23
  end
24
24
 
25
25
  def test_file
@@ -29,8 +29,8 @@ class TestRDocParserRuby < RDoc::TestCase
29
29
  def teardown
30
30
  super
31
31
 
32
- @tempfile.close
33
- @tempfile2.close
32
+ @tempfile.close!
33
+ @tempfile2.close!
34
34
  end
35
35
 
36
36
  def test_collect_first_comment
@@ -788,7 +788,7 @@ end
788
788
  assert_equal 2, foo.method_list.length
789
789
  end
790
790
 
791
- def test_parse_const_fail_w_meta_method
791
+ def test_parse_const_fail_w_meta
792
792
  util_parser <<-CLASS
793
793
  class ConstFailMeta
794
794
  ##
@@ -810,27 +810,6 @@ end
810
810
  assert_equal 1, const_fail_meta.attributes.length
811
811
  end
812
812
 
813
- def test_parse_const_third_party
814
- util_parser <<-CLASS
815
- class A
816
- true if B::C
817
- true if D::E::F
818
- end
819
- CLASS
820
-
821
- tk = @parser.get_tk
822
-
823
- @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
824
-
825
- a = @top_level.classes.first
826
- assert_equal 'A', a.full_name
827
-
828
- visible = @store.all_modules.reject { |mod| mod.suppressed? }
829
- visible = visible.map { |mod| mod.full_name }
830
-
831
- assert_empty visible
832
- end
833
-
834
813
  def test_parse_class_nested_superclass
835
814
  foo = @top_level.add_module RDoc::NormalModule, 'Foo'
836
815
 
@@ -3266,7 +3245,25 @@ end
3266
3245
  c_b = c.find_method_named 'b'
3267
3246
 
3268
3247
  assert_equal :private, c_b.visibility
3269
- refute c_b.singleton
3248
+ assert c_b.singleton
3249
+ end
3250
+
3251
+ def test_singleton_method_via_eigenclass
3252
+ util_parser <<-RUBY
3253
+ class C
3254
+ class << self
3255
+ def a() end
3256
+ end
3257
+ end
3258
+ RUBY
3259
+
3260
+ @parser.scan
3261
+
3262
+ c = @store.find_class_named 'C'
3263
+ c_a = c.find_method_named 'a'
3264
+
3265
+ assert_equal :public, c_a.visibility
3266
+ assert c_a.singleton
3270
3267
  end
3271
3268
 
3272
3269
  def test_stopdoc_after_comment
@@ -17,7 +17,7 @@ class TestRDocParserSimple < RDoc::TestCase
17
17
  def teardown
18
18
  super
19
19
 
20
- @tempfile.close
20
+ @tempfile.close!
21
21
  end
22
22
 
23
23
  def test_initialize_metadata
@@ -153,7 +153,7 @@ class TestRDocRdBlockParser < RDoc::TestCase
153
153
  blank_line,
154
154
  blank_line)
155
155
 
156
- Tempfile.open %w[parse_include .rd] do |io|
156
+ tf = Tempfile.open %w[parse_include .rd] do |io|
157
157
  io.puts "=begin\ninclude ((*worked*))\n=end"
158
158
  io.flush
159
159
 
@@ -162,7 +162,9 @@ class TestRDocRdBlockParser < RDoc::TestCase
162
162
  STR
163
163
 
164
164
  assert_equal expected, parse(str)
165
+ io
165
166
  end
167
+ tf.close! if tf.respond_to? :close!
166
168
  end
167
169
 
168
170
  def test_parse_heading
@@ -252,14 +252,16 @@ class TestRDocRDoc < RDoc::TestCase
252
252
  @rdoc.options.encoding = Encoding::ISO_8859_1
253
253
  @rdoc.store = RDoc::Store.new
254
254
 
255
- Tempfile.open 'test.txt' do |io|
255
+ tf = Tempfile.open 'test.txt' do |io|
256
256
  io.write 'hi'
257
257
  io.rewind
258
258
 
259
259
  top_level = @rdoc.parse_file io.path
260
260
 
261
261
  assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
262
+ io
262
263
  end
264
+ tf.close! if tf.respond_to? :close!
263
265
  end
264
266
 
265
267
  def test_parse_file_forbidden
@@ -267,7 +269,7 @@ class TestRDocRDoc < RDoc::TestCase
267
269
 
268
270
  @rdoc.store = RDoc::Store.new
269
271
 
270
- Tempfile.open 'test.txt' do |io|
272
+ tf = Tempfile.open 'test.txt' do |io|
271
273
  io.write 'hi'
272
274
  io.rewind
273
275
 
@@ -286,7 +288,9 @@ class TestRDocRDoc < RDoc::TestCase
286
288
  ensure
287
289
  File.chmod 0400, io.path
288
290
  end
291
+ io
289
292
  end
293
+ tf.close! if tf.respond_to? :close!
290
294
  end
291
295
 
292
296
  def test_remove_unparseable
@@ -382,7 +386,7 @@ class TestRDocRDoc < RDoc::TestCase
382
386
  end
383
387
 
384
388
  def test_setup_output_dir_exists_file
385
- Tempfile.open 'test_rdoc_rdoc' do |tempfile|
389
+ tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile|
386
390
  path = tempfile.path
387
391
 
388
392
  e = assert_raises RDoc::Error do
@@ -391,7 +395,9 @@ class TestRDocRDoc < RDoc::TestCase
391
395
 
392
396
  assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
393
397
  e.message)
398
+ tempfile
394
399
  end
400
+ tf.close! if tf.respond_to? :close!
395
401
  end
396
402
 
397
403
  def test_setup_output_dir_exists_not_rdoc
@@ -430,5 +436,20 @@ class TestRDocRDoc < RDoc::TestCase
430
436
  end
431
437
  end
432
438
 
439
+ def test_normalized_file_list_removes_created_rid_dir
440
+ temp_dir do |d|
441
+ FileUtils.mkdir "doc"
442
+ flag_file = @rdoc.output_flag_file "doc"
443
+ file = File.join "doc", "test"
444
+ FileUtils.touch flag_file
445
+ FileUtils.touch file
446
+
447
+ file_list = ["doc"]
448
+
449
+ output = @rdoc.normalized_file_list file_list
450
+
451
+ assert_empty output
452
+ end
453
+ end
433
454
  end
434
455
 
@@ -231,6 +231,17 @@ U
231
231
  assert_equal expected, tokens
232
232
  end
233
233
 
234
+ def test_class_tokenize_percent_w_quote
235
+ tokens = RDoc::RubyLex.tokenize '%w"hi"', nil
236
+
237
+ expected = [
238
+ @TK::TkDSTRING.new( 0, 1, 0, '%w"hi"'),
239
+ @TK::TkNL .new( 6, 1, 6, "\n"),
240
+ ]
241
+
242
+ assert_equal expected, tokens
243
+ end
244
+
234
245
  def test_class_tokenize_regexp
235
246
  tokens = RDoc::RubyLex.tokenize "/hay/", nil
236
247
 
@@ -138,9 +138,6 @@ class TestRDocRubygemsHook < Gem::TestCase
138
138
  @a.loaded_from =
139
139
  File.join Gem::Specification.default_specifications_dir, 'a.gemspec'
140
140
 
141
- FileUtils.mkdir_p @a.doc_dir
142
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
143
-
144
141
  @hook.generate
145
142
 
146
143
  refute @hook.rdoc_installed?
@@ -1,11 +1,19 @@
1
- require File.expand_path '../xref_test_case', __FILE__
1
+ require 'rdoc/test_case'
2
2
 
3
- class TestRDocSingleClass < XrefTestCase
3
+ class TestRDocSingleClass < RDoc::TestCase
4
4
 
5
- def test_definition
6
- c = RDoc::SingleClass.new 'C'
5
+ def setup
6
+ super
7
+
8
+ @c = RDoc::SingleClass.new 'C'
9
+ end
7
10
 
8
- assert_equal 'class << C', c.definition
11
+ def test_aref_prefix
12
+ assert_equal 'sclass', @c.aref_prefix
13
+ end
14
+
15
+ def test_definition
16
+ assert_equal 'class << C', @c.definition
9
17
  end
10
18
 
11
19
  end
@@ -663,5 +663,60 @@ m(a, b) { |c, d| ... }
663
663
  RDoc::Markup::ToRdoc.new
664
664
  end
665
665
 
666
+ def test_undoc_params
667
+ method = RDoc::AnyMethod.new [], 'm'
668
+ method.params = '(a)'
669
+ method.comment = comment 'comment'
670
+
671
+ total, undoc = @s.undoc_params method
672
+
673
+ assert_equal 1, total
674
+ assert_equal %w[a], undoc
675
+ end
676
+
677
+ def test_undoc_params_block
678
+ method = RDoc::AnyMethod.new [], 'm'
679
+ method.params = '(&a)'
680
+ method.comment = comment '+a+'
681
+
682
+ total, undoc = @s.undoc_params method
683
+
684
+ assert_equal 1, total
685
+ assert_empty undoc
686
+ end
687
+
688
+ def test_undoc_params_documented
689
+ method = RDoc::AnyMethod.new [], 'm'
690
+ method.params = '(a)'
691
+ method.comment = comment '+a+'
692
+
693
+ total, undoc = @s.undoc_params method
694
+
695
+ assert_equal 1, total
696
+ assert_empty undoc
697
+ end
698
+
699
+ def test_undoc_params_keywords
700
+ method = RDoc::AnyMethod.new [], 'm'
701
+ method.params = '(**a)'
702
+ method.comment = comment '+a+'
703
+
704
+ total, undoc = @s.undoc_params method
705
+
706
+ assert_equal 1, total
707
+ assert_empty undoc
708
+ end
709
+
710
+ def test_undoc_params_splat
711
+ method = RDoc::AnyMethod.new [], 'm'
712
+ method.params = '(*a)'
713
+ method.comment = comment '+a+'
714
+
715
+ total, undoc = @s.undoc_params method
716
+
717
+ assert_equal 1, total
718
+ assert_empty undoc
719
+ end
720
+
666
721
  end
667
722
 
@@ -46,6 +46,7 @@ class TestRDocTask < RDoc::TestCase
46
46
  assert Rake::Task[:rdoc]
47
47
  assert Rake::Task[:clobber_rdoc]
48
48
  assert Rake::Task[:rerdoc]
49
+ assert_equal ["html/created.rid"], Rake::Task[:rdoc].prerequisites
49
50
  end
50
51
 
51
52
  def test_tasks_creation_with_custom_name_symbol
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-10 00:00:00.000000000 Z
14
+ date: 2014-12-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json
@@ -95,14 +95,14 @@ dependencies:
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '3.12'
98
+ version: '3.13'
99
99
  type: :development
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '3.12'
105
+ version: '3.13'
106
106
  description: |-
107
107
  RDoc produces HTML and command-line documentation for Ruby projects. RDoc
108
108
  includes the +rdoc+ and +ri+ tools for generating and displaying documentation
@@ -169,6 +169,7 @@ files:
169
169
  - lib/rdoc/generator/darkfish.rb
170
170
  - lib/rdoc/generator/json_index.rb
171
171
  - lib/rdoc/generator/markup.rb
172
+ - lib/rdoc/generator/pot.rb
172
173
  - lib/rdoc/generator/ri.rb
173
174
  - lib/rdoc/generator/template/darkfish/.document
174
175
  - lib/rdoc/generator/template/darkfish/_footer.rhtml
@@ -187,7 +188,8 @@ files:
187
188
  - lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
188
189
  - lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
189
190
  - lib/rdoc/generator/template/darkfish/class.rhtml
190
- - lib/rdoc/generator/template/darkfish/fonts.css
191
+ - lib/rdoc/generator/template/darkfish/css/fonts.css
192
+ - lib/rdoc/generator/template/darkfish/css/rdoc.css
191
193
  - lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
192
194
  - lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
193
195
  - lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
@@ -224,7 +226,6 @@ files:
224
226
  - lib/rdoc/generator/template/darkfish/js/jquery.js
225
227
  - lib/rdoc/generator/template/darkfish/js/search.js
226
228
  - lib/rdoc/generator/template/darkfish/page.rhtml
227
- - lib/rdoc/generator/template/darkfish/rdoc.css
228
229
  - lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
229
230
  - lib/rdoc/generator/template/darkfish/servlet_root.rhtml
230
231
  - lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
@@ -366,7 +367,12 @@ files:
366
367
  - test/test_rdoc_generator_darkfish.rb
367
368
  - test/test_rdoc_generator_json_index.rb
368
369
  - test/test_rdoc_generator_markup.rb
370
+ - test/test_rdoc_generator_pot.rb
371
+ - test/test_rdoc_generator_pot_po.rb
372
+ - test/test_rdoc_generator_pot_po_entry.rb
369
373
  - test/test_rdoc_generator_ri.rb
374
+ - test/test_rdoc_i18n_locale.rb
375
+ - test/test_rdoc_i18n_text.rb
370
376
  - test/test_rdoc_include.rb
371
377
  - test/test_rdoc_markdown.rb
372
378
  - test/test_rdoc_markdown_test.rb
@@ -456,7 +462,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
456
462
  version: '1.3'
457
463
  requirements: []
458
464
  rubyforge_project:
459
- rubygems_version: 2.4.1
465
+ rubygems_version: 2.4.2
460
466
  signing_key:
461
467
  specification_version: 4
462
468
  summary: RDoc produces HTML and command-line documentation for Ruby projects
@@ -476,7 +482,12 @@ test_files:
476
482
  - test/test_rdoc_generator_darkfish.rb
477
483
  - test/test_rdoc_generator_json_index.rb
478
484
  - test/test_rdoc_generator_markup.rb
485
+ - test/test_rdoc_generator_pot.rb
486
+ - test/test_rdoc_generator_pot_po.rb
487
+ - test/test_rdoc_generator_pot_po_entry.rb
479
488
  - test/test_rdoc_generator_ri.rb
489
+ - test/test_rdoc_i18n_locale.rb
490
+ - test/test_rdoc_i18n_text.rb
480
491
  - test/test_rdoc_include.rb
481
492
  - test/test_rdoc_markdown.rb
482
493
  - test/test_rdoc_markdown_test.rb