rdoc 2.2.1 → 2.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 (95) hide show
  1. data.tar.gz.sig +2 -0
  2. data/.document +4 -0
  3. data/History.txt +35 -0
  4. data/Manifest.txt +36 -15
  5. data/README.txt +11 -27
  6. data/Rakefile +3 -0
  7. data/lib/rdoc.rb +1 -1
  8. data/lib/rdoc/cache.rb +32 -0
  9. data/lib/rdoc/code_objects.rb +121 -59
  10. data/lib/rdoc/generator.rb +196 -133
  11. data/lib/rdoc/generator/darkfish.rb +471 -0
  12. data/lib/rdoc/generator/html.rb +71 -60
  13. data/lib/rdoc/generator/html/html.rb +115 -115
  14. data/lib/rdoc/generator/html/one_page_html.rb +56 -56
  15. data/lib/rdoc/generator/ri.rb +2 -0
  16. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  17. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +302 -0
  18. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +114 -0
  19. data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  20. data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  21. data/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  22. data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  23. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  24. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  25. data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  26. data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  27. data/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  28. data/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  29. data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  30. data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  31. data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  32. data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  33. data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  34. data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  35. data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  36. data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  37. data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  38. data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  39. data/lib/rdoc/generator/template/darkfish/index.rhtml +57 -0
  40. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
  41. data/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
  42. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
  43. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
  44. data/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
  45. data/lib/rdoc/generator/xml.rb +19 -12
  46. data/lib/rdoc/generator/xml/rdf.rb +50 -50
  47. data/lib/rdoc/generator/xml/xml.rb +58 -58
  48. data/lib/rdoc/known_classes.rb +0 -1
  49. data/lib/rdoc/markup/preprocess.rb +4 -3
  50. data/lib/rdoc/markup/to_html.rb +4 -1
  51. data/lib/rdoc/markup/to_html_crossref.rb +28 -31
  52. data/lib/rdoc/options.rb +25 -20
  53. data/lib/rdoc/parser.rb +10 -2
  54. data/lib/rdoc/parser/c.rb +38 -29
  55. data/lib/rdoc/parser/f95.rb +32 -32
  56. data/lib/rdoc/parser/ruby.rb +5 -2
  57. data/lib/rdoc/parser/simple.rb +1 -0
  58. data/lib/rdoc/rdoc.rb +99 -47
  59. data/lib/rdoc/ri/cache.rb +6 -6
  60. data/lib/rdoc/ri/display.rb +22 -75
  61. data/lib/rdoc/ri/driver.rb +237 -78
  62. data/lib/rdoc/stats.rb +91 -28
  63. data/lib/rdoc/template.rb +6 -2
  64. data/test/test.ja.rdoc +8 -0
  65. data/test/test.ja.txt +8 -0
  66. data/test/test_attribute_manager.rb +9 -6
  67. data/test/test_rdoc_markup.rb +4 -2
  68. data/test/test_rdoc_markup_attribute_manager.rb +13 -3
  69. data/test/test_rdoc_markup_to_html.rb +18 -2
  70. data/test/test_rdoc_markup_to_html_crossref.rb +186 -249
  71. data/test/test_rdoc_parser.rb +17 -1
  72. data/test/test_rdoc_parser_c.rb +65 -10
  73. data/test/test_rdoc_parser_perl.rb +4 -2
  74. data/test/test_rdoc_parser_ruby.rb +6 -4
  75. data/test/test_rdoc_ri_attribute_formatter.rb +4 -2
  76. data/test/test_rdoc_ri_default_display.rb +8 -4
  77. data/test/test_rdoc_ri_driver.rb +4 -2
  78. data/test/test_rdoc_ri_formatter.rb +6 -4
  79. data/test/test_rdoc_ri_overstrike_formatter.rb +4 -2
  80. metadata +84 -33
  81. metadata.gz.sig +0 -0
  82. data/lib/rdoc/generator/chm.rb +0 -113
  83. data/lib/rdoc/generator/chm/chm.rb +0 -100
  84. data/lib/rdoc/generator/html/frameless.rb +0 -92
  85. data/lib/rdoc/generator/html/hefss.rb +0 -150
  86. data/lib/rdoc/generator/html/kilmer.rb +0 -151
  87. data/lib/rdoc/generator/html/kilmerfactory.rb +0 -427
  88. data/lib/rdoc/generator/texinfo.rb +0 -81
  89. data/lib/rdoc/generator/texinfo/class.texinfo.erb +0 -44
  90. data/lib/rdoc/generator/texinfo/file.texinfo.erb +0 -6
  91. data/lib/rdoc/generator/texinfo/method.texinfo.erb +0 -6
  92. data/lib/rdoc/generator/texinfo/texinfo.erb +0 -28
  93. data/test/rdoc_markup_to_html_crossref_reference.rb +0 -31
  94. data/test/test_rdoc_info_formatting.rb +0 -175
  95. data/test/test_rdoc_info_sections.rb +0 -136
@@ -0,0 +1,2 @@
1
+ s
2
+ #��,�r��'n0ٓB��)��Mgy���|����P�;1���ؖβ�����JSR�w�@izW�H�F�ѿ.�=��{,��r��??ٲ����ha�\��ˁ���Ir$��ׁ�*'�S$��LOɸ!?db�cj��ůu�οE�~�I.����d�{)u��8 �x����/����䏂��st�Kw��w�g ��֠4�1Pc�6%��aeB� (a�t�'d����"DW]YS��'�b���*�[F�*
@@ -0,0 +1,4 @@
1
+ History.txt
2
+ README.txt
3
+ RI.txt
4
+ lib
@@ -1,3 +1,38 @@
1
+ === 2.3.0 / 2009-01-28
2
+
3
+ * 3 Major Enhancements
4
+ * Michael Granger's Darkfish generator is now the default for HTML output
5
+ * Various rdoc generation speedups by Hongli Lai. Patches #22555, #22556,
6
+ #22557, #22562, #22565.
7
+ * rdoc/discover.rb files are loaded automatically from installed gems
8
+
9
+ * 8 Minor Enhancements
10
+ * Added a space after the commas in ri class method lists. RubyForge
11
+ enhancement #22182.
12
+ * Improved ri --interactive
13
+ * Generators can now override generated file locations
14
+ * Moved unmaintained CHM generator to it's own package
15
+ * Moved unmaintained extra HTML templates to their own package
16
+ * Removed experimental texinfo generator
17
+ * Converted to minitest
18
+ * Known classes and modules list outputs once per line now for grep
19
+
20
+ * 11 Bug Fixes
21
+ * Fix missing superclass in ri output
22
+ * Fix an RDoc crash when told to parse an empty file
23
+ * Ignore nonexistent files instead of crashing
24
+ * .txt and .rdoc files are always considered text. Patch #22897 by Aaron
25
+ Patterson.
26
+ * When merging ri data with a nonexistant directory, RDoc no longer crashes
27
+ * Fix visibility of methods in XML output. Issue by Yehuda Katz.
28
+ * Fixed relative link generation
29
+ * Fix crash, RDoc now ignores comments above local variable assignments in
30
+ modules
31
+ * RDoc now only accepts adjacent comments for rb_define_module and
32
+ rb_define_class
33
+ * C file RDoc is no longer included in token stream
34
+ * Scan all gem paths to match gem name for ri output
35
+
1
36
  === 2.2.1 / 2008-09-24
2
37
  This version provides some minor fixes and enhancements to 2.2.0 intended
3
38
  to polish RDoc for Ruby 1.9.1.
@@ -1,31 +1,52 @@
1
+ .document
1
2
  History.txt
2
3
  Manifest.txt
3
4
  README.txt
4
- Rakefile
5
5
  RI.txt
6
+ Rakefile
6
7
  bin/rdoc
7
8
  bin/ri
8
9
  lib/rdoc.rb
10
+ lib/rdoc/cache.rb
9
11
  lib/rdoc/code_objects.rb
10
12
  lib/rdoc/diagram.rb
11
13
  lib/rdoc/dot.rb
12
14
  lib/rdoc/generator.rb
13
- lib/rdoc/generator/chm.rb
14
- lib/rdoc/generator/chm/chm.rb
15
+ lib/rdoc/generator/darkfish.rb
15
16
  lib/rdoc/generator/html.rb
16
17
  lib/rdoc/generator/html/common.rb
17
- lib/rdoc/generator/html/frameless.rb
18
- lib/rdoc/generator/html/hefss.rb
19
18
  lib/rdoc/generator/html/html.rb
20
- lib/rdoc/generator/html/kilmer.rb
21
- lib/rdoc/generator/html/kilmerfactory.rb
22
19
  lib/rdoc/generator/html/one_page_html.rb
23
20
  lib/rdoc/generator/ri.rb
24
- lib/rdoc/generator/texinfo.rb
25
- lib/rdoc/generator/texinfo/class.texinfo.erb
26
- lib/rdoc/generator/texinfo/file.texinfo.erb
27
- lib/rdoc/generator/texinfo/method.texinfo.erb
28
- lib/rdoc/generator/texinfo/texinfo.erb
21
+ lib/rdoc/generator/template/darkfish/.document
22
+ lib/rdoc/generator/template/darkfish/classpage.rhtml
23
+ lib/rdoc/generator/template/darkfish/filepage.rhtml
24
+ lib/rdoc/generator/template/darkfish/images/brick.png
25
+ lib/rdoc/generator/template/darkfish/images/brick_link.png
26
+ lib/rdoc/generator/template/darkfish/images/bug.png
27
+ lib/rdoc/generator/template/darkfish/images/bullet_black.png
28
+ lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png
29
+ lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png
30
+ lib/rdoc/generator/template/darkfish/images/date.png
31
+ lib/rdoc/generator/template/darkfish/images/find.png
32
+ lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif
33
+ lib/rdoc/generator/template/darkfish/images/macFFBgHack.png
34
+ lib/rdoc/generator/template/darkfish/images/package.png
35
+ lib/rdoc/generator/template/darkfish/images/page_green.png
36
+ lib/rdoc/generator/template/darkfish/images/page_white_text.png
37
+ lib/rdoc/generator/template/darkfish/images/page_white_width.png
38
+ lib/rdoc/generator/template/darkfish/images/plugin.png
39
+ lib/rdoc/generator/template/darkfish/images/ruby.png
40
+ lib/rdoc/generator/template/darkfish/images/tag_green.png
41
+ lib/rdoc/generator/template/darkfish/images/wrench.png
42
+ lib/rdoc/generator/template/darkfish/images/wrench_orange.png
43
+ lib/rdoc/generator/template/darkfish/images/zoom.png
44
+ lib/rdoc/generator/template/darkfish/index.rhtml
45
+ lib/rdoc/generator/template/darkfish/js/darkfish.js
46
+ lib/rdoc/generator/template/darkfish/js/jquery.js
47
+ lib/rdoc/generator/template/darkfish/js/quicksearch.js
48
+ lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
49
+ lib/rdoc/generator/template/darkfish/rdoc.css
29
50
  lib/rdoc/generator/xml.rb
30
51
  lib/rdoc/generator/xml/rdf.rb
31
52
  lib/rdoc/generator/xml/xml.rb
@@ -65,9 +86,9 @@ lib/rdoc/stats.rb
65
86
  lib/rdoc/template.rb
66
87
  lib/rdoc/tokenstream.rb
67
88
  test/binary.dat
68
- test/rdoc_markup_to_html_crossref_reference.rb
69
- test/test_rdoc_info_formatting.rb
70
- test/test_rdoc_info_sections.rb
89
+ test/test.ja.rdoc
90
+ test/test.ja.txt
91
+ test/test_attribute_manager.rb
71
92
  test/test_rdoc_markup.rb
72
93
  test/test_rdoc_markup_attribute_manager.rb
73
94
  test/test_rdoc_markup_to_html.rb
data/README.txt CHANGED
@@ -10,21 +10,11 @@ files. RDoc includes the +rdoc+ and +ri+ tools for generating and displaying
10
10
  online documentation.
11
11
 
12
12
  At this point in time, RDoc 2.x is a work in progress and may incur further
13
- API changes beyond what has been made to the RDoc 1.0.1. Command-line tools
14
- are largely unaffected, but internal APIs may shift rapidly.
13
+ API changes beyond what has been made to RDoc 1.0.1. Command-line tools are
14
+ largely unaffected, but internal APIs may shift rapidly.
15
15
 
16
16
  See RDoc for a description of RDoc's markup and basic use.
17
17
 
18
- == TEMPLATE NOTE:
19
-
20
- RDoc comes with five built-in HTML templates. We use a 3rd party template,
21
- however, for RDoc's own documentation site[http://rdoc.rubyforge.org]. This
22
- template is Hanna[http://github.com/mislav/hanna/tree/master].
23
-
24
- We strongly are considering making Hanna as RDoc's default template
25
- in a future release, but for now this template can be downloaded separately
26
- and used with the +-T+ option.
27
-
28
18
  == SYNOPSIS:
29
19
 
30
20
  gem 'rdoc'
@@ -32,31 +22,25 @@ and used with the +-T+ option.
32
22
  # ... see RDoc
33
23
 
34
24
  == BUGS:
35
- ---
36
- RDoc's Fortran 95 support is pretty broken right now.
37
- The rdoc-f95[http://www.gfd-dennou.org/library/dcmodel/rdoc-f95/] project has
38
- patches for RDoc 1.x that provide excellent Fortran 95 support. Properly
39
- supporting Fortran 95 requires a rewrite of RDoc's markup engine, which
40
- is high on our list of goals. The Fortran 95 issue can be tracked
41
- here[http://rubyforge.org/tracker/index.php?func=detail&aid=21542&group_id=627&atid=2475].
42
- ---
25
+
43
26
  The markup engine has lots of little bugs. In particular:
44
27
  * Escaping does not work for all markup.
45
28
  * Typesetting is not always correct.
46
29
  * Some output formats (ri, for example) do not correctly handle all of the
47
30
  markup.
48
- The markup engine needs a rewrite, which can be tracked here[http://rubyforge.org/tracker/index.php?func=detail&aid=21540&group_id=627&atid=2475].
49
- ---
31
+
50
32
  RDoc has some subtle bugs processing classes that are split across multiple
51
33
  files (bugs that may or may not manifest depending on the order in which
52
34
  the files are encountered). This issue can be tracked here[http://rubyforge.org/tracker/index.php?func=detail&aid=22135&group_id=627&atid=2475].
53
- -------
35
+
54
36
  If you find a bug, please report it at the RDoc project's
55
37
  tracker[http://rubyforge.org/tracker/?group_id=627] on RubyForge:
56
38
 
57
39
  == LICENSE:
58
40
 
59
- RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers,
60
- portions (c) 2007-2008 Eric Hodel. It is free software, and may be
61
- redistributed under the terms specified in the README file of the Ruby
62
- distribution.
41
+ RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers.
42
+ Portions (c) 2007-2009 Eric Hodel. Portions copyright others, see individual
43
+ files for details.
44
+
45
+ It is free software, and may be redistributed under the terms specified in the
46
+ README file of the Ruby distribution.
data/Rakefile CHANGED
@@ -9,6 +9,9 @@ Hoe.new "rdoc", RDoc::VERSION do |rdoc|
9
9
  rdoc.developer 'Phil Hagelberg', 'technomancy@gmail.com'
10
10
  rdoc.developer 'Tony Strauss', 'tony.strauss@designingpatterns.com'
11
11
  rdoc.remote_rdoc_dir = ''
12
+
13
+ rdoc.extra_dev_deps << ['minitest', '~> 1.3']
14
+ rdoc.spec_extras['required_rubygems_version'] = '>= 1.3'
12
15
  end
13
16
 
14
17
  # These tasks expect to have the following directory structure:
@@ -372,7 +372,7 @@ module RDoc
372
372
  ##
373
373
  # RDoc version you are using
374
374
 
375
- VERSION = "2.2.1"
375
+ VERSION = "2.3.0"
376
376
 
377
377
  ##
378
378
  # Name of the dotfile that contains the description of files to be processed
@@ -0,0 +1,32 @@
1
+ require 'thread'
2
+ require 'singleton'
3
+
4
+ ##
5
+ # A generic, thread-safe in-memory cache. It's used for caching
6
+ # RDoc::TemplatePage objects when generating RDoc output.
7
+
8
+ class RDoc::Cache
9
+
10
+ include Singleton
11
+
12
+ def initialize
13
+ @contents = {}
14
+ @lock = Mutex.new
15
+ end
16
+
17
+ # Checks whether there's a value in the cache with key +key+. If so, then
18
+ # that value will be returned. Otherwise, the given block will be run,
19
+ # and its return value will be put into the cache, and returned.
20
+ def cache(key)
21
+ @lock.synchronize do
22
+ @contents[key] ||= yield
23
+ end
24
+ end
25
+
26
+ def clear
27
+ @lock.synchronize do
28
+ @contents.clear
29
+ end
30
+ end
31
+ end
32
+
@@ -1,6 +1,8 @@
1
1
  # We represent the various high-level code constructs that appear
2
2
  # in Ruby programs: classes, modules, methods, and so on.
3
3
 
4
+ require 'thread'
5
+
4
6
  require 'rdoc/tokenstream'
5
7
 
6
8
  module RDoc
@@ -11,25 +13,42 @@ module RDoc
11
13
 
12
14
  class CodeObject
13
15
 
14
- attr_accessor :parent
16
+ ##
17
+ # Our comment
15
18
 
16
- # We are the model of the code, but we know that at some point
17
- # we will be worked on by viewers. By implementing the Viewable
18
- # protocol, viewers can associated themselves with these objects.
19
+ attr_reader :comment
19
20
 
20
- attr_accessor :viewer
21
+ ##
22
+ # Do we document our children?
21
23
 
22
- # are we done documenting (ie, did we come across a :enddoc:)?
24
+ attr_reader :document_children
25
+
26
+ ##
27
+ # Do we document ourselves?
28
+
29
+ attr_reader :document_self
30
+
31
+ ##
32
+ # Are we done documenting (ie, did we come across a :enddoc:)?
23
33
 
24
34
  attr_accessor :done_documenting
25
35
 
36
+ ##
37
+ # Our parent CodeObject
38
+
39
+ attr_accessor :parent
40
+
41
+ ##
26
42
  # Which section are we in
27
43
 
28
44
  attr_accessor :section
29
45
 
30
- # do we document ourselves?
46
+ ##
47
+ # We are the model of the code, but we know that at some point we will be
48
+ # worked on by viewers. By implementing the Viewable protocol, viewers can
49
+ # associated themselves with these objects.
31
50
 
32
- attr_reader :document_self
51
+ attr_accessor :viewer
33
52
 
34
53
  def initialize
35
54
  @document_self = true
@@ -38,68 +57,86 @@ module RDoc
38
57
  @done_documenting = false
39
58
  end
40
59
 
41
- def document_self=(val)
42
- @document_self = val
43
- if !val
44
- remove_methods_etc
45
- end
60
+ ##
61
+ # Enables or disables documentation of this CodeObject. Calls
62
+ # remove_methods_etc when disabling.
63
+
64
+ def document_self=(document_self)
65
+ @document_self = document_self
66
+ remove_methods_etc unless document_self
46
67
  end
47
68
 
48
- # set and cleared by :startdoc: and :enddoc:, this is used to toggle
49
- # the capturing of documentation
69
+ ##
70
+ # Enable capture of documentation
71
+
50
72
  def start_doc
51
73
  @document_self = true
52
74
  @document_children = true
53
75
  end
54
76
 
77
+ ##
78
+ # Disable capture of documentation
79
+
55
80
  def stop_doc
56
81
  @document_self = false
57
82
  @document_children = false
58
83
  end
59
84
 
60
- # do we document ourselves and our children
61
-
62
- attr_reader :document_children
85
+ ##
86
+ # Enables or disables documentation of this CodeObject's children. Calls
87
+ # remove_classes_and_modules when disabling.
63
88
 
64
- def document_children=(val)
65
- @document_children = val
66
- if !val
67
- remove_classes_and_modules
68
- end
89
+ def document_children=(document_children)
90
+ @document_children = document_children
91
+ remove_classes_and_modules unless document_children
69
92
  end
70
93
 
71
- # Do we _force_ documentation, even is we wouldn't normally show the entity
94
+ ##
95
+ # Force documentation of this CodeObject
96
+
72
97
  attr_accessor :force_documentation
73
98
 
99
+ ##
100
+ # File name of our parent
101
+
74
102
  def parent_file_name
75
103
  @parent ? @parent.file_base_name : '(unknown)'
76
104
  end
77
105
 
106
+ ##
107
+ # Name of our parent
108
+
78
109
  def parent_name
79
110
  @parent ? @parent.name : '(unknown)'
80
111
  end
81
112
 
82
- # Default callbacks to nothing, but this is overridden for classes
83
- # and modules
113
+ ##
114
+ # Callback called upon disabling documentation of children. See
115
+ # #document_children=
116
+
84
117
  def remove_classes_and_modules
85
118
  end
86
119
 
120
+ ##
121
+ # Callback called upon disabling documentation of ourself. See
122
+ # #document_self=
123
+
87
124
  def remove_methods_etc
88
125
  end
89
126
 
90
- # Access the code object's comment
91
- attr_reader :comment
127
+ ##
128
+ # Replaces our comment with +comment+, unless it is empty.
92
129
 
93
- # Update the comment, but don't overwrite a real comment with an empty one
94
130
  def comment=(comment)
95
131
  @comment = comment unless comment.empty?
96
132
  end
97
133
 
134
+ ##
98
135
  # There's a wee trick we pull. Comment blocks can have directives that
99
136
  # override the stuff we extract during the parse. So, we have a special
100
- # class method, attr_overridable, that lets code objects list
101
- # those directives. Wehn a comment is assigned, we then extract
102
- # out any matching directives and update our object
137
+ # class method, attr_overridable, that lets code objects list those
138
+ # directives. When a comment is assigned, we then extract out any matching
139
+ # directives and update our object
103
140
 
104
141
  def self.attr_overridable(name, *aliases)
105
142
  @overridables ||= {}
@@ -137,11 +174,14 @@ module RDoc
137
174
  attr_reader :title, :comment, :sequence
138
175
 
139
176
  @@sequence = "SEC00000"
177
+ @@sequence_lock = Mutex.new
140
178
 
141
179
  def initialize(title, comment)
142
180
  @title = title
143
- @@sequence.succ!
144
- @sequence = @@sequence.dup
181
+ @@sequence_lock.synchronize do
182
+ @@sequence.succ!
183
+ @sequence = @@sequence.dup
184
+ end
145
185
  @comment = nil
146
186
  set_comment(comment)
147
187
  end
@@ -580,25 +620,33 @@ module RDoc
580
620
  attr_accessor :file_relative_name
581
621
  attr_accessor :file_absolute_name
582
622
  attr_accessor :diagram
623
+ attr_accessor :parser
583
624
 
625
+ @@lock = Mutex.new
584
626
  @@all_classes = {}
585
627
  @@all_modules = {}
586
628
  @@all_files = {}
587
629
 
588
630
  def self.reset
589
- @@all_classes = {}
590
- @@all_modules = {}
591
- @@all_files = {}
631
+ @@lock.synchronize do
632
+ @@all_classes = {}
633
+ @@all_modules = {}
634
+ @@all_files = {}
635
+ end
592
636
  end
593
637
 
594
638
  def initialize(file_name)
595
639
  super()
596
640
  @name = "TopLevel"
597
- @file_relative_name = file_name
598
- @file_absolute_name = file_name
599
- @file_stat = File.stat(file_name)
600
- @diagram = nil
601
- @@all_files[file_name] = self
641
+ @file_relative_name = file_name
642
+ @file_absolute_name = file_name
643
+ @file_stat = File.stat(file_name) rescue nil # HACK for testing
644
+ @diagram = nil
645
+ @parser = nil
646
+
647
+ @@lock.synchronize do
648
+ @@all_files[file_name] = self
649
+ end
602
650
  end
603
651
 
604
652
  def file_base_name
@@ -622,17 +670,25 @@ module RDoc
622
670
  cls.superclass = superclass unless cls.module?
623
671
  puts "Reusing class/module #{cls.full_name}" if $DEBUG_RDOC
624
672
  else
625
- if class_type == NormalModule then
626
- all = @@all_modules
627
- else
628
- all = @@all_classes
629
- end
673
+ all = nil
674
+
675
+ @@lock.synchronize do
676
+ if class_type == NormalModule then
677
+ all = @@all_modules
678
+ else
679
+ all = @@all_classes
680
+ end
630
681
 
631
- cls = all[name]
682
+ cls = all[name]
683
+ end
632
684
 
633
685
  if !cls then
634
686
  cls = class_type.new name, superclass
635
- all[name] = cls unless @done_documenting
687
+ unless @done_documenting
688
+ @@lock.synchronize do
689
+ all[name] = cls
690
+ end
691
+ end
636
692
  else
637
693
  # If the class has been encountered already, check that its
638
694
  # superclass has been set (it may not have been, depending on
@@ -653,19 +709,25 @@ module RDoc
653
709
  end
654
710
 
655
711
  def self.all_classes_and_modules
656
- @@all_classes.values + @@all_modules.values
712
+ @@lock.synchronize do
713
+ @@all_classes.values + @@all_modules.values
714
+ end
657
715
  end
658
716
 
659
717
  def self.find_class_named(name)
660
- @@all_classes.each_value do |c|
661
- res = c.find_class_named(name)
662
- return res if res
718
+ @@lock.synchronize do
719
+ @@all_classes.each_value do |c|
720
+ res = c.find_class_named(name)
721
+ return res if res
722
+ end
663
723
  end
664
724
  nil
665
725
  end
666
726
 
667
727
  def self.find_file_named(name)
668
- @@all_files[name]
728
+ @@lock.synchronize do
729
+ @@all_files[name]
730
+ end
669
731
  end
670
732
 
671
733
  def find_local_symbol(symbol)
@@ -673,8 +735,10 @@ module RDoc
673
735
  end
674
736
 
675
737
  def find_class_or_module_named(symbol)
676
- @@all_classes.each_value {|c| return c if c.name == symbol}
677
- @@all_modules.each_value {|m| return m if m.name == symbol}
738
+ @@lock.synchronize do
739
+ @@all_classes.each_value {|c| return c if c.name == symbol}
740
+ @@all_modules.each_value {|m| return m if m.name == symbol}
741
+ end
678
742
  nil
679
743
  end
680
744
 
@@ -766,9 +830,7 @@ module RDoc
766
830
  def superclass=(superclass)
767
831
  raise NoMethodError, "#{full_name} is a module" if module?
768
832
 
769
- if @superclass.nil? or @superclass == 'Object' then
770
- @superclass = superclass
771
- end
833
+ @superclass = superclass if @superclass.nil? or @superclass == 'Object'
772
834
  end
773
835
 
774
836
  def to_s