rdoc 2.4.0 → 2.4.1

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.

data.tar.gz.sig CHANGED
Binary file
@@ -1,6 +1,17 @@
1
- === 2.3.1 / ??
1
+ === 2.4.1 / 2009-02-26
2
2
 
3
- * N Minor Enhancements
3
+ * 1 Minor Enhancements
4
+ * Added :attr:, :attr_reader:, :attr_writer:, :attr_accessor: directives.
5
+ Replaces --accessor. See RDoc::Parser::Ruby for details.
6
+
7
+ * 3 Bug Fixes
8
+ * Don't complain when exiting normally. Bug by Matt Neuburg.
9
+ * Restore --inline-source that warns
10
+ * Fixed links to files in Darkfish output
11
+
12
+ === 2.4.0 / 2009-02-24
13
+
14
+ * 9 Minor Enhancements
4
15
  * `ri -f html` is now XHTML-happy
5
16
  * Clarified RDoc::Markup link syntax. Bug #23517 by Eric Armstrong.
6
17
  * Number of threads to parse with is now configurable
@@ -15,7 +26,7 @@
15
26
  * Removed --ri-system as it is unused by Ruby's makefiles
16
27
  * Added method list to index.html
17
28
 
18
- * N Bug Fixes
29
+ * 6 Bug Fixes
19
30
  * nodoc'd classes no longer appear in the index. Bug #23751 by Clifford
20
31
  Heath.
21
32
  * Fix 1.9 compatibility issues. Bug #23815 by paddor.
data/README.txt CHANGED
@@ -1,7 +1,8 @@
1
1
  = \RDoc
2
2
 
3
- * Project Page: http://rubyforge.org/projects/rdoc/
4
- * Documentation: http://rdoc.rubyforge.org/
3
+ * {RDoc Project Page}[http://rubyforge.org/projects/rdoc/]
4
+ * {RDoc Documentation}[http://rdoc.rubyforge.org/]
5
+ * {RDoc Bug Tracker}[http://rubyforge.org/tracker/?atid=2472&group_id=627&func=browse]
5
6
 
6
7
  == DESCRIPTION:
7
8
 
data/bin/rdoc CHANGED
@@ -17,6 +17,8 @@ rescue Interrupt
17
17
  $stderr.puts
18
18
  $stderr.puts "Interrupted"
19
19
  exit 1
20
+ rescue SystemExit
21
+ raise
20
22
  rescue Exception => e
21
23
  if $DEBUG_RDOC then
22
24
  $stderr.puts e.message
@@ -1,5 +1,7 @@
1
1
  $DEBUG_RDOC = nil
2
2
 
3
+ # :main: README.txt
4
+
3
5
  ##
4
6
  # = \RDoc - Ruby Documentation System
5
7
  #
@@ -380,7 +382,7 @@ module RDoc
380
382
  ##
381
383
  # RDoc version you are using
382
384
 
383
- VERSION = "2.4.0"
385
+ VERSION = "2.4.1"
384
386
 
385
387
  ##
386
388
  # Name of the dotfile that contains the description of files to be processed
@@ -147,17 +147,27 @@ class RDoc::Generator::Darkfish
147
147
  @outputdir.mkpath
148
148
  end
149
149
 
150
- ### Copy over the stylesheet into the appropriate place in the
151
- ### output directory.
150
+ ### Copy over the stylesheet into the appropriate place in the output
151
+ ### directory.
152
152
  def write_style_sheet
153
- debug_msg "Copying over static files"
154
- staticfiles = %w[rdoc.css js images]
155
- staticfiles.each do |path|
156
- FileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG, :noop => $dryrun )
157
- end
158
- end
153
+ debug_msg "Copying static files"
154
+ options = { :verbose => $DEBUG_RDOC, :noop => $dryrun }
155
+
156
+ FileUtils.cp @template_dir + 'rdoc.css', '.', options
157
+
158
+ Dir[@template_dir + "{js,images}/**/*"].each do |path|
159
+ next if File.directory? path
160
+ next if path =~ /#{File::SEPARATOR}\./
159
161
 
162
+ dst = Pathname.new(path).relative_path_from @template_dir
160
163
 
164
+ # I suck at glob
165
+ dst_dir = dst.dirname
166
+ FileUtils.mkdir_p dst_dir, options unless File.exist? dst_dir
167
+
168
+ FileUtils.cp @template_dir + path, dst, options
169
+ end
170
+ end
161
171
 
162
172
  ### Build the initial indices and output objects
163
173
  ### based on an array of TopLevel objects containing
@@ -117,7 +117,7 @@
117
117
  <h3 class="section-header">Files</h3>
118
118
  <ul>
119
119
  <% simple_files.each do |file| %>
120
- <li class="file"><a href="<%= rel_prefix %>/<%= file.base_name %>.html"><%= h file.base_name %></a></li>
120
+ <li class="file"><a href="<%= rel_prefix %>/<%= file.path %>"><%= h file.base_name %></a></li>
121
121
  <% end %>
122
122
  </ul>
123
123
  </div>
@@ -30,7 +30,7 @@
30
30
  <h3 class="section-header">Files</h3>
31
31
  <ul>
32
32
  <% simple_files.each do |f| %>
33
- <li class="file"><a href="<%= rel_prefix %>/<%= f.base_name %>.html"><%= h f.base_name %></a></li>
33
+ <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.base_name %></a></li>
34
34
  <% end %>
35
35
  </ul>
36
36
  </div>
@@ -34,7 +34,7 @@
34
34
  <h2>Files</h2>
35
35
  <ul>
36
36
  <% simple_files.sort.each do |file| %>
37
- <li class="file"><a href="<%= file.base_name %>.html"><%= h file.base_name %></a></li>
37
+ <li class="file"><a href="<%= file.path %>"><%= h file.base_name %></a></li>
38
38
  <% end %>
39
39
  </ul>
40
40
  <% end %>
@@ -403,6 +403,16 @@ Usage: #{opt.program_name} [options] [names...]
403
403
  "'\%s', the filename will be appended to it.") do |value|
404
404
  @webcvs = value
405
405
  end
406
+
407
+ opt.separator nil
408
+
409
+ opt.separator 'Deprecated options - these warn when set'
410
+
411
+ opt.separator nil
412
+
413
+ opt.on("--inline-source", "-S") do |value|
414
+ warn "--inline-source will be removed from RDoc on or after August 2009"
415
+ end
406
416
  end
407
417
 
408
418
  argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
@@ -1439,12 +1439,23 @@ end
1439
1439
  # ##
1440
1440
  # # :singleton-method: woo_hoo!
1441
1441
  #
1442
- # == Hidden methods
1442
+ # Additionally you can mark a method as an attribute by
1443
+ # using :attr:, :attr_reader:, :attr_writer: or :attr_accessor:. Just like
1444
+ # for :method:, the name is optional.
1445
+ #
1446
+ # ##
1447
+ # # :attr_reader: my_attr_name
1448
+ #
1449
+ # == Hidden methods and attributes
1443
1450
  #
1444
1451
  # You can provide documentation for methods that don't appear using
1445
- # the :method: and :singleton-method: directives:
1452
+ # the :method:, :singleton-method: and :attr: directives:
1446
1453
  #
1447
1454
  # ##
1455
+ # # :attr_writer: ghost_writer
1456
+ # # There is an attribute here, but you can't see it!
1457
+ #
1458
+ # ##
1448
1459
  # # :method: ghost_method
1449
1460
  # # There is a method here, but you can't see it!
1450
1461
  #
@@ -1765,8 +1776,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
1765
1776
  return prefix + msg
1766
1777
  end
1767
1778
 
1779
+ ##
1780
+ # Creates an RDoc::Attr for the name following +tk+, setting the comment to
1781
+ # +comment+.
1782
+
1768
1783
  def parse_attr(context, single, tk, comment)
1769
- args = parse_symbol_arg(1)
1784
+ args = parse_symbol_arg 1
1770
1785
  if args.size > 0
1771
1786
  name = args[0]
1772
1787
  rw = "R"
@@ -1787,12 +1802,16 @@ class RDoc::Parser::Ruby < RDoc::Parser
1787
1802
  end
1788
1803
  end
1789
1804
 
1805
+ ##
1806
+ # Creates an RDoc::Attr for each attribute listed after +tk+, setting the
1807
+ # comment for each to +comment+.
1808
+
1790
1809
  def parse_attr_accessor(context, single, tk, comment)
1791
1810
  args = parse_symbol_arg
1792
1811
  read = get_tkread
1793
1812
  rw = "?"
1794
1813
 
1795
- # If nodoc is given, don't document any of them
1814
+ # TODO If nodoc is given, don't document any of them
1796
1815
 
1797
1816
  tmp = RDoc::CodeObject.new
1798
1817
  read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
@@ -1973,37 +1992,51 @@ class RDoc::Parser::Ruby < RDoc::Parser
1973
1992
  end
1974
1993
  end
1975
1994
 
1995
+ ##
1996
+ # Generates an RDoc::Method or RDoc::Attr from +comment+ by looking for
1997
+ # :method: or :attr: directives in +comment+.
1998
+
1976
1999
  def parse_comment(container, tk, comment)
1977
2000
  line_no = tk.line_no
1978
2001
  column = tk.char_no
1979
2002
 
1980
2003
  singleton = !!comment.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
1981
2004
 
2005
+ # REFACTOR
1982
2006
  if comment.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
1983
2007
  name = $1 unless $1.empty?
1984
- else
1985
- return nil
1986
- end
1987
2008
 
1988
- meth = RDoc::GhostMethod.new get_tkread, name
1989
- meth.singleton = singleton
2009
+ meth = RDoc::GhostMethod.new get_tkread, name
2010
+ meth.singleton = singleton
1990
2011
 
1991
- @stats.add_method meth
2012
+ @stats.add_method meth
1992
2013
 
1993
- meth.start_collecting_tokens
1994
- indent = TkSPACE.new 1, 1
1995
- indent.set_text " " * column
2014
+ meth.start_collecting_tokens
2015
+ indent = TkSPACE.new 1, 1
2016
+ indent.set_text " " * column
1996
2017
 
1997
- position_comment = TkCOMMENT.new(line_no, 1, "# File #{@top_level.absolute_name}, line #{line_no}")
1998
- meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
2018
+ position_comment = TkCOMMENT.new(line_no, 1, "# File #{@top_level.absolute_name}, line #{line_no}")
2019
+ meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
1999
2020
 
2000
- meth.params = ''
2021
+ meth.params = ''
2001
2022
 
2002
- extract_call_seq comment, meth
2023
+ extract_call_seq comment, meth
2003
2024
 
2004
- container.add_method meth if meth.document_self
2025
+ container.add_method meth if meth.document_self
2005
2026
 
2006
- meth.comment = comment
2027
+ meth.comment = comment
2028
+ elsif comment.sub!(/# +:?(attr(_reader|_writer|_accessor)?:) *(\S*).*?\n/i, '') then
2029
+ rw = case $1
2030
+ when 'attr_reader' then 'R'
2031
+ when 'attr_writer' then 'W'
2032
+ else 'RW'
2033
+ end
2034
+
2035
+ name = $3 unless $3.empty?
2036
+
2037
+ att = RDoc::Attr.new get_tkread, name, rw, comment
2038
+ container.add_attribute att
2039
+ end
2007
2040
  end
2008
2041
 
2009
2042
  def parse_include(context, comment)
@@ -2018,6 +2051,32 @@ class RDoc::Parser::Ruby < RDoc::Parser
2018
2051
  end
2019
2052
  end
2020
2053
 
2054
+ def parse_meta_attr(context, single, tk, comment)
2055
+ args = parse_symbol_arg
2056
+ read = get_tkread
2057
+ rw = "?"
2058
+
2059
+ # If nodoc is given, don't document any of them
2060
+
2061
+ tmp = RDoc::CodeObject.new
2062
+ read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
2063
+ return unless tmp.document_self
2064
+
2065
+ if comment.sub!(/^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
2066
+ rw = case $1
2067
+ when 'attr_reader' then 'R'
2068
+ when 'attr_writer' then 'W'
2069
+ else 'RW'
2070
+ end
2071
+ name = $3 unless $3.empty?
2072
+ end
2073
+
2074
+ for name in args
2075
+ att = RDoc::Attr.new get_tkread, name, rw, comment
2076
+ context.add_attribute att
2077
+ end
2078
+ end
2079
+
2021
2080
  ##
2022
2081
  # Parses a meta-programmed method
2023
2082
 
@@ -28,6 +28,28 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
28
28
  @tempfile2.close
29
29
  end
30
30
 
31
+ def test_look_for_directives_in_attr
32
+ util_parser ""
33
+
34
+ comment = "# :attr: my_attr\n"
35
+
36
+ @parser.look_for_directives_in @top_level, comment
37
+
38
+ assert_equal "# :attr: my_attr\n", comment
39
+
40
+ comment = "# :attr_reader: my_method\n"
41
+
42
+ @parser.look_for_directives_in @top_level, comment
43
+
44
+ assert_equal "# :attr_reader: my_method\n", comment
45
+
46
+ comment = "# :attr_writer: my_method\n"
47
+
48
+ @parser.look_for_directives_in @top_level, comment
49
+
50
+ assert_equal "# :attr_writer: my_method\n", comment
51
+ end
52
+
31
53
  def test_look_for_directives_in_commented
32
54
  util_parser ""
33
55
 
@@ -136,6 +158,147 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
136
158
  assert_equal 'hi', @options.title
137
159
  end
138
160
 
161
+ def test_parse_attr
162
+ klass = RDoc::NormalClass.new 'Foo'
163
+ klass.parent = @top_level
164
+
165
+ comment = "##\n# my attr\n"
166
+
167
+ util_parser "attr :foo, :bar"
168
+
169
+ tk = @parser.get_tk
170
+
171
+ @parser.parse_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
172
+
173
+ assert_equal 1, klass.attributes.length
174
+
175
+ foo = klass.attributes.first
176
+ assert_equal 'foo', foo.name
177
+ assert_equal "##\n# my attr\n", foo.comment
178
+ end
179
+
180
+ def test_parse_attr_accessor
181
+ klass = RDoc::NormalClass.new 'Foo'
182
+ klass.parent = @top_level
183
+
184
+ comment = "##\n# my attr\n"
185
+
186
+ util_parser "attr_accessor :foo, :bar"
187
+
188
+ tk = @parser.get_tk
189
+
190
+ @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment
191
+
192
+ assert_equal 2, klass.attributes.length
193
+
194
+ foo = klass.attributes.first
195
+ assert_equal 'foo', foo.name
196
+ assert_equal 'RW', foo.rw
197
+ assert_equal "##\n# my attr\n", foo.comment
198
+
199
+ bar = klass.attributes.last
200
+ assert_equal 'bar', bar.name
201
+ assert_equal 'RW', bar.rw
202
+ assert_equal "##\n# my attr\n", bar.comment
203
+ end
204
+
205
+ def test_parse_attr_accessor_writer
206
+ klass = RDoc::NormalClass.new 'Foo'
207
+ klass.parent = @top_level
208
+
209
+ comment = "##\n# my attr\n"
210
+
211
+ util_parser "attr_writer :foo, :bar"
212
+
213
+ tk = @parser.get_tk
214
+
215
+ @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment
216
+
217
+ assert_equal 2, klass.attributes.length
218
+
219
+ foo = klass.attributes.first
220
+ assert_equal 'foo', foo.name
221
+ assert_equal 'W', foo.rw
222
+ assert_equal "##\n# my attr\n", foo.comment
223
+
224
+ bar = klass.attributes.last
225
+ assert_equal 'bar', bar.name
226
+ assert_equal 'W', bar.rw
227
+ assert_equal "##\n# my attr\n", bar.comment
228
+ end
229
+
230
+ def test_parse_meta_attr
231
+ klass = RDoc::NormalClass.new 'Foo'
232
+ klass.parent = @top_level
233
+
234
+ comment = "##\n# :attr: \n# my method\n"
235
+
236
+ util_parser "add_my_method :foo, :bar"
237
+
238
+ tk = @parser.get_tk
239
+
240
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
241
+
242
+ foo = klass.attributes.first
243
+ assert_equal 'foo', foo.name
244
+ assert_equal 'RW', foo.rw
245
+ assert_equal "##\n# my method\n", foo.comment
246
+ end
247
+
248
+ def test_parse_meta_attr_accessor
249
+ klass = RDoc::NormalClass.new 'Foo'
250
+ klass.parent = @top_level
251
+
252
+ comment = "##\n# :attr_accessor: \n# my method\n"
253
+
254
+ util_parser "add_my_method :foo, :bar"
255
+
256
+ tk = @parser.get_tk
257
+
258
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
259
+
260
+ foo = klass.attributes.first
261
+ assert_equal 'foo', foo.name
262
+ assert_equal 'RW', foo.rw
263
+ assert_equal "##\n# my method\n", foo.comment
264
+ end
265
+
266
+ def test_parse_meta_attr_reader
267
+ klass = RDoc::NormalClass.new 'Foo'
268
+ klass.parent = @top_level
269
+
270
+ comment = "##\n# :attr_reader: \n# my method\n"
271
+
272
+ util_parser "add_my_method :foo, :bar"
273
+
274
+ tk = @parser.get_tk
275
+
276
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
277
+
278
+ foo = klass.attributes.first
279
+ assert_equal 'foo', foo.name
280
+ assert_equal 'R', foo.rw
281
+ assert_equal "##\n# my method\n", foo.comment
282
+ end
283
+
284
+ def test_parse_meta_attr_writer
285
+ klass = RDoc::NormalClass.new 'Foo'
286
+ klass.parent = @top_level
287
+
288
+ comment = "##\n# :attr_writer: \n# my method\n"
289
+
290
+ util_parser "add_my_method :foo, :bar"
291
+
292
+ tk = @parser.get_tk
293
+
294
+ @parser.parse_meta_attr klass, RDoc::Parser::Ruby::NORMAL, tk, comment
295
+
296
+ foo = klass.attributes.first
297
+ assert_equal 'foo', foo.name
298
+ assert_equal 'W', foo.rw
299
+ assert_equal "##\n# my method\n", foo.comment
300
+ end
301
+
139
302
  def test_parse_class
140
303
  comment = "##\n# my method\n"
141
304
 
@@ -265,15 +428,35 @@ EOF
265
428
  assert_equal 'Foo::Helper', helper.full_name
266
429
  end
267
430
 
268
- def test_parse_comment
269
- content = <<-EOF
270
- class Foo
271
- ##
272
- # :method: my_method
273
- # my method comment
431
+ def test_parse_comment_attr
432
+ klass = RDoc::NormalClass.new 'Foo'
433
+ klass.parent = @top_level
274
434
 
275
- end
276
- EOF
435
+ comment = "##\n# :attr: foo\n# my attr\n"
436
+
437
+ util_parser "\n"
438
+
439
+ tk = @parser.get_tk
440
+
441
+ @parser.parse_comment klass, tk, comment
442
+
443
+ foo = klass.attributes.first
444
+ assert_equal 'foo', foo.name
445
+ assert_equal 'RW', foo.rw
446
+ assert_equal comment, foo.comment
447
+
448
+ assert_equal nil, foo.viewer
449
+ assert_equal true, foo.document_children
450
+ assert_equal true, foo.document_self
451
+ assert_equal false, foo.done_documenting
452
+ assert_equal false, foo.force_documentation
453
+ assert_equal klass, foo.parent
454
+ assert_equal :public, foo.visibility
455
+ assert_equal "\n", foo.text
456
+ assert_equal klass.current_section, foo.section
457
+ end
458
+
459
+ def test_parse_comment_method
277
460
  klass = RDoc::NormalClass.new 'Foo'
278
461
  klass.parent = @top_level
279
462
 
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: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -33,7 +33,7 @@ cert_chain:
33
33
  x52qPcexcYZR7w==
34
34
  -----END CERTIFICATE-----
35
35
 
36
- date: 2009-02-24 00:00:00 -08:00
36
+ date: 2009-02-26 00:00:00 -08:00
37
37
  default_executable:
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: 1.8.3
57
+ version: 1.9.0
58
58
  version:
59
59
  description: RDoc is an application that produces documentation for one or more Ruby source files. RDoc includes the +rdoc+ and +ri+ tools for generating and displaying online documentation. At this point in time, RDoc 2.x is a work in progress and may incur further API changes beyond what has been made to RDoc 1.0.1. Command-line tools are largely unaffected, but internal APIs may shift rapidly. See RDoc for a description of RDoc's markup and basic use.
60
60
  email:
@@ -72,7 +72,6 @@ extra_rdoc_files:
72
72
  - Manifest.txt
73
73
  - README.txt
74
74
  - RI.txt
75
- - test/test.ja.txt
76
75
  files:
77
76
  - .autotest
78
77
  - .document
@@ -199,7 +198,7 @@ files:
199
198
  - test/xref_data.rb
200
199
  - test/xref_test_case.rb
201
200
  has_rdoc: true
202
- homepage: "Project Page: http://rubyforge.org/projects/rdoc/"
201
+ homepage: "{RDoc Project Page}[http://rubyforge.org/projects/rdoc/]"
203
202
  post_install_message:
204
203
  rdoc_options:
205
204
  - --main
metadata.gz.sig CHANGED
Binary file