Browse files

Some initial app benchmarks.

  • Loading branch information...
1 parent cff7c69 commit 79f14f5eb817f2172701fb740415a8a6c3ec35e3 Brian Ford committed Jun 15, 2009
Showing with 19,841 additions and 0 deletions.
  1. +12 −0 benchmark/app/bm_gem_install_local.rb
  2. +12 −0 benchmark/app/bm_gem_install_remote.rb
  3. +8 −0 benchmark/app/bm_mspec_ci.rb
  4. +8 −0 benchmark/app/bm_rails_-h.rb
  5. +12 −0 benchmark/app/bm_rdoc.rb
  6. BIN benchmark/app/rdoc-2.4.3.gem
  7. +14 −0 benchmark/app/rdoc-2.4.3/.autotest
  8. +4 −0 benchmark/app/rdoc-2.4.3/.document
  9. +260 −0 benchmark/app/rdoc-2.4.3/History.txt
  10. +126 −0 benchmark/app/rdoc-2.4.3/Manifest.txt
  11. +47 −0 benchmark/app/rdoc-2.4.3/README.txt
  12. +58 −0 benchmark/app/rdoc-2.4.3/RI.txt
  13. +71 −0 benchmark/app/rdoc-2.4.3/Rakefile
  14. +35 −0 benchmark/app/rdoc-2.4.3/bin/rdoc
  15. +5 −0 benchmark/app/rdoc-2.4.3/bin/ri
  16. +398 −0 benchmark/app/rdoc-2.4.3/lib/rdoc.rb
  17. +54 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/alias.rb
  18. +10 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/anon_class.rb
  19. +190 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/any_method.rb
  20. +79 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/attr.rb
  21. +41 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/cache.rb
  22. +87 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/class_module.rb
  23. +152 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/code_object.rb
  24. +23 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/code_objects.rb
  25. +36 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/constant.rb
  26. +712 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/context.rb
  27. +340 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/diagram.rb
  28. +249 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/dot.rb
  29. +8 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator.rb
  30. +455 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/darkfish.rb
  31. +194 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/markup.rb
  32. +230 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/ri.rb
  33. 0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/.document
  34. +281 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/classpage.rhtml
  35. +114 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/filepage.rhtml
  36. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/brick.png
  37. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/brick_link.png
  38. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/bug.png
  39. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/bullet_black.png
  40. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png
  41. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png
  42. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/date.png
  43. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/find.png
  44. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif
  45. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png
  46. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/package.png
  47. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/page_green.png
  48. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/page_white_text.png
  49. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/page_white_width.png
  50. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/plugin.png
  51. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/ruby.png
  52. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/tag_green.png
  53. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/wrench.png
  54. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/wrench_orange.png
  55. BIN benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/images/zoom.png
  56. +64 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/index.rhtml
  57. +116 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/js/darkfish.js
  58. +32 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/js/jquery.js
  59. +114 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/js/quicksearch.js
  60. +10 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
  61. +696 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/generator/template/darkfish/rdoc.css
  62. +8 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ghost_method.rb
  63. +39 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/include.rb
  64. +68 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/known_classes.rb
  65. +378 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup.rb
  66. +311 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/attribute_manager.rb
  67. +25 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/formatter.rb
  68. +377 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/fragments.rb
  69. +126 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/inline.rb
  70. +156 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/lines.rb
  71. +80 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/preprocess.rb
  72. +211 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/to_flow.rb
  73. +406 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/to_html.rb
  74. +140 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/to_html_crossref.rb
  75. +328 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/to_latex.rb
  76. +53 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/to_test.rb
  77. +73 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/markup/to_texinfo.rb
  78. +8 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/meta_method.rb
  79. +18 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/normal_class.rb
  80. +34 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/normal_module.rb
  81. +542 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/options.rb
  82. +138 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/parser.rb
  83. +678 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/parser/c.rb
  84. +165 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/parser/perl.rb
  85. +2,904 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/parser/ruby.rb
  86. +39 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/parser/simple.rb
  87. +375 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/rdoc.rb
  88. +32 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/require.rb
  89. +8 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri.rb
  90. +187 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/cache.rb
  91. +156 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/descriptions.rb
  92. +340 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/display.rb
  93. +828 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/driver.rb
  94. +654 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/formatter.rb
  95. +93 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/paths.rb
  96. +106 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/reader.rb
  97. +79 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/util.rb
  98. +68 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/ri/writer.rb
  99. +8 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/single_class.rb
  100. +178 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/stats.rb
  101. +276 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/task.rb
  102. +33 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/tokenstream.rb
  103. +242 −0 benchmark/app/rdoc-2.4.3/lib/rdoc/top_level.rb
  104. BIN benchmark/app/rdoc-2.4.3/test/binary.dat
  105. +8 −0 benchmark/app/rdoc-2.4.3/test/test.ja.rdoc
  106. +8 −0 benchmark/app/rdoc-2.4.3/test/test.ja.txt
  107. +76 −0 benchmark/app/rdoc-2.4.3/test/test_attribute_manager.rb
  108. +10 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_any_method.rb
  109. +80 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_code_object.rb
  110. +15 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_constant.rb
  111. +250 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_context.rb
  112. +17 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_include.rb
  113. +626 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_markup.rb
  114. +243 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_markup_attribute_manager.rb
  115. +81 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_markup_to_html.rb
  116. +161 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_markup_to_html_crossref.rb
  117. +26 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_normal_module.rb
  118. +29 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_parser.rb
  119. +401 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_parser_c.rb
  120. +74 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_parser_perl.rb
  121. +1,040 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_parser_ruby.rb
  122. +25 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_require.rb
  123. +44 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_ri_attribute_formatter.rb
  124. +302 −0 benchmark/app/rdoc-2.4.3/test/test_rdoc_ri_default_display.rb
Sorry, we could not display the entire diff because it was too big.
View
12 benchmark/app/bm_gem_install_local.rb
@@ -0,0 +1,12 @@
+dir = "rdoc-gem-local"
+rm = "rm -rf #{dir}"
+cmd = "#{rm}; #{ENV['VM']} -S gem install --local --install-dir #{dir} --bindir #{dir} --no-rdoc --no-ri --ignore-dependencies rdoc-2.4.3.gem"
+
+# ensure everything is compiled
+system cmd
+
+Bench.run [1] do |n|
+ system cmd
+end
+
+system rm
View
12 benchmark/app/bm_gem_install_remote.rb
@@ -0,0 +1,12 @@
+dir = "rdoc-gem-remote"
+rm = "rm -rf #{dir}"
+cmd = "#{rm}; #{ENV['VM']} -S gem install --remote --install-dir #{dir} --bindir #{dir} --no-rdoc --no-ri --ignore-dependencies rdoc --version '=2.4.3'"
+
+# ensure everything is compiled
+system cmd
+
+Bench.run [1] do |n|
+ system cmd
+end
+
+system rm
View
8 benchmark/app/bm_mspec_ci.rb
@@ -0,0 +1,8 @@
+cmd = "cd ../..; #{ENV['VM']} mspec/bin/mspec-ci spec/frozen/core"
+
+# ensure everything is compiled
+system cmd
+
+Bench.run [1] do |n|
+ system cmd
+end
View
8 benchmark/app/bm_rails_-h.rb
@@ -0,0 +1,8 @@
+cmd = "#{ENV['VM']} -S rails -h"
+
+# ensure everything is compiled
+system cmd
+
+Bench.run [1] do |n|
+ system cmd
+end
View
12 benchmark/app/bm_rdoc.rb
@@ -0,0 +1,12 @@
+output = "rdoc-output"
+rm = "rm -rf #{output}"
+cmd = "#{rm}; #{ENV['VM']} -S rdoc --all --force-update --threads=1 --output #{output} rdoc-2.4.3/lib"
+
+# ensure everything is compiled
+system cmd
+
+Bench.run [1] do |n|
+ system cmd
+end
+
+system rm
View
BIN benchmark/app/rdoc-2.4.3.gem
Binary file not shown.
View
14 benchmark/app/rdoc-2.4.3/.autotest
@@ -0,0 +1,14 @@
+# vim: filetype=ruby
+
+Autotest.add_hook :initialize do |at|
+ at.testlib = 'minitest/unit' if at.respond_to? :testlib=
+
+ def at.path_to_classname(s)
+ sep = File::SEPARATOR
+ f = s.sub(/^test#{sep}/, '').sub(/\.rb$/, '').split(sep)
+ f = f.map { |path| path.split(/_|(\d+)/).map { |seg| seg.capitalize }.join }
+ f = f.map { |path| path =~ /^Test/ ? path : "Test#{path}" }
+ f.join('::').sub 'Rdoc', 'RDoc'
+ end
+end
+
View
4 benchmark/app/rdoc-2.4.3/.document
@@ -0,0 +1,4 @@
+History.txt
+README.txt
+RI.txt
+lib
View
260 benchmark/app/rdoc-2.4.3/History.txt
@@ -0,0 +1,260 @@
+=== 2.4.3 / 2009-04-01
+
+* 2 Bug Fixes
+ * Corrected patch for file links
+ * Corrected display of file popup
+
+=== 2.4.2 / 2009-03-25
+
+* 2 Minor Enhancements
+ * Added --pipe for turning RDoc on stdin into HTML
+ * Added rdoc/task.rb containing a replacement for rake/rdoctask.rb. Use
+ RDoc::Task now instead of Rake::RDocTask.
+
+* 10 Bug Fixes
+ * Writing the ri cache file to the proper directory. Bug #24459 by Lars
+ Christensen.
+ * Possible fix for Dir::[] and Pathname interaction on 1.9. Bug #24650 by
+ tiburon.
+ * Fixed scanning constants for if/end, etc. pairs. Bug #24609 by Ryan
+ Davis.
+ * Fixed private methods in the C parser. Bug #24599 by Aaron Patterson.
+ * Fixed display of markup on RDoc main page. Bug #24168 by rhubarb.
+ * Fixed display of \\ character in documentation proceeding words.
+ Bug #22112 by James Gray. See RDoc for details.
+ * Fixed parsing and display of arg params for some corner cases. Bug #21113
+ by Csiszár Attila.
+ * Fixed links in Files box. Patch #24403 by Eric Wong.
+ * Toplevel methods now appear in Object. Bug #22677 by Ryan Davis.
+ * Added back --promiscuous which didn't do anything you cared about. Why
+ did you enable it? Nobody looked at that page! Oh, it warns, too.
+
+=== 2.4.1 / 2009-02-26
+
+* 1 Minor Enhancements
+ * Added :attr:, :attr_reader:, :attr_writer:, :attr_accessor: directives.
+ Replaces --accessor. See RDoc::Parser::Ruby for details.
+
+* 3 Bug Fixes
+ * Don't complain when exiting normally. Bug by Matt Neuburg.
+ * Restore --inline-source that warns
+ * Fixed links to files in Darkfish output
+
+=== 2.4.0 / 2009-02-24
+
+* 9 Minor Enhancements
+ * `ri -f html` is now XHTML-happy
+ * Clarified RDoc::Markup link syntax. Bug #23517 by Eric Armstrong.
+ * Number of threads to parse with is now configurable
+ * Darkfish can now use alternate templates from $LOAD_PATH via -T
+ * Removed F95 parser in favor of the rdoc-f95 gem
+ * Moved HTML and XML generators to unmaintained
+ * No gem will be provided as it's too difficult to make them work
+ * Removed options --one-file, --style=, --inline-source, --promiscuous,
+ --op-name
+ * Removed support for --accessor, use regular documentation or
+ the method directive instead. See RDoc::Parser::Ruby
+ * Removed --ri-system as it is unused by Ruby's makefiles
+ * Added method list to index.html
+
+* 6 Bug Fixes
+ * nodoc'd classes no longer appear in the index. Bug #23751 by Clifford
+ Heath.
+ * Fix 1.9 compatibility issues. Bug #23815 by paddor.
+ * Darkfish now respects --charset
+ * RDoc no longer attempts to be lazy when building HTML. This is a
+ workaround. Bug #23893 by Stefano Crocco.
+ * RDoc doesn't crash with def (blah).foo() end
+ * RDoc doesn't crash with #define functions
+
+=== 2.3.0 / 2009-01-28
+
+* 3 Major Enhancements
+ * Michael Granger's Darkfish generator is now the default for HTML output
+ * Various rdoc generation speedups by Hongli Lai. Patches #22555, #22556,
+ #22557, #22562, #22565.
+ * rdoc/discover.rb files are loaded automatically from installed gems
+
+* 8 Minor Enhancements
+ * Added a space after the commas in ri class method lists. RubyForge
+ enhancement #22182.
+ * Improved ri --interactive
+ * Generators can now override generated file locations
+ * Moved unmaintained CHM generator to it's own package
+ * Moved unmaintained extra HTML templates to their own package
+ * Removed experimental texinfo generator
+ * Converted to minitest
+ * Known classes and modules list outputs once per line now for grep
+
+* 11 Bug Fixes
+ * Fix missing superclass in ri output
+ * Fix an RDoc crash when told to parse an empty file
+ * Ignore nonexistent files instead of crashing
+ * .txt and .rdoc files are always considered text. Patch #22897 by Aaron
+ Patterson.
+ * When merging ri data with a nonexistant directory, RDoc no longer crashes
+ * Fix visibility of methods in XML output. Issue by Yehuda Katz.
+ * Fixed relative link generation
+ * Fix crash, RDoc now ignores comments above local variable assignments in
+ modules
+ * RDoc now only accepts adjacent comments for rb_define_module and
+ rb_define_class
+ * C file RDoc is no longer included in token stream
+ * Scan all gem paths to match gem name for ri output
+
+=== 2.2.1 / 2008-09-24
+This version provides some minor fixes and enhancements to 2.2.0 intended
+to polish RDoc for Ruby 1.9.1.
+
+* 3 Minor Enhancements
+ * Support for parsing RDoc from SWIG. Ruby patch #10742 by Gonzalo
+ Garramuno, #13993 by Steven Jenkins.
+ * Simple support for Perl POD documentation. Patch by Hugh Sasse.
+ * Changed the default character set of RDoc's output from iso-8859-1 to
+ utf-8.
+
+* 9 Bug Fixes
+ * Explicitly set the html template's text color, so that the generated
+ documentation will display correctly on browsers with custom text and
+ background color settings (patch by Luther Thompson).
+ * Ensure that RDoc correctly will associate an alias and a method, even
+ if it encounters the alias first because the alias lives in a different
+ file.
+ * Fix the parsing of multiline constants (patch by Chris Alfeld and
+ Joel VanderWerf)
+ * Make --exclude usuable. Ruby patch #11671 by Trans.
+ * Detect inline C functions. Ruby Bug #11993 by Florian Frank.
+ * Fix an issue in which RDoc might not document a class'
+ superclass correctly if the class was defined in multiple files and
+ depending on the order in which RDoc processed the files. This should
+ ensure that the child class -> parent class relationship is correct in
+ ri documentation, allowing ri to lookup inherited methods (i.e., File.read).
+ * Stop ri from crashing when it looks for a completely bogus method (i.e.,
+ File#reada). Now, ri exits with a helpful error message.
+ * Fixed missing display of constant values in ri.
+ * Fixed display of constants in ri's html output.
+
+=== 2.2.0 / 2008-09-19
+This version includes some significant enhancements to ri. See RI.txt for
+documentation about ri.
+
+* 5 Major Enhancements
+ * More extensive unit tests (special thanks to Chris Lowis for contributing
+ a test).
+ * Made ri twice as fast for the most common use case of displaying
+ information for a class or a fully-qualified method
+ (i.e., ri Array#flatten, after ri has created a cache the first time that
+ it runs).
+ * Made ri many times faster when searching for an unqualified method (i.e.,
+ ri read, again after the first such search has populated ri's cache)
+ * Changed ri to do regular expression searches for unqualified methods;
+ now, a regular expression for a method can be passed to ri on the
+ command-line.
+ * Added an interactive mode to ri (patch by Daniel Choi). Now, when ri
+ is given a -i argument, it will allow the user to disambiguate
+ unqualified methods if more than one is present and also will allow a
+ user to get information for a class' method.
+
+* 8 Minor Enhancements
+ * RDoc now adds the package title to the web pages that it generates
+ for files and classes/modules, which helps them appear better in
+ search engine results.
+ * RDoc now automatically generates cross-reference links for classes and
+ methods specified relative to the global namespace (i.e., ::A::B::C#method).
+ * All built-in templates now output valid, strict XHTML.
+ * The documentation is slightly better organized (the markup details were
+ merged into the RDoc module's documentation).
+ * Improved rdoc's HTML generation speed by about 20% (on Windows, the
+ boost seems larger).
+ * Provided an ri command-line option to control its caching behavior.
+ * Improved RDoc's documentation. Added RI.txt to document ri.
+ * Allow HTML templates distributed as gems to be loaded with the -T option,
+ just like the standard templates in rdoc/generator/html (so an HTML
+ template lib/new_template.rb in a gem can be used with rdoc -T new_template)
+
+* 25 Bug fixes:
+ * Fixed prototype detection in C parser. Can process ruby 1.8 C files
+ again.
+ * Fixed the main page for frameless template. Patch by Marcin Raczkowski.
+ * Fixed the main page for frame templates. Now, if no main page is
+ specified, RDoc will default to the README.
+ * Fixed missing stylesheet in generated chm. Patch by Gordon Thiesfeld.
+ * Fixed the parsing of module names starting with '::'. Patch by
+ Giuseppe Bilotta.
+ * Fixed a case where RDoc first would encounter Foo::Bar and then would
+ encounter class Foo. Previously, RDoc erroneously would have considered
+ that both a Foo class and a Foo module existed.
+ * Fix a clase where RDoc would not generate correct cross-reference links
+ to a class contained within a module of the same name (i.e. RDoc::RDoc)
+ * Prevented RDoc from trying to parse binary files, which would produce
+ garbage output.
+ * RDoc now correctly converts ' characters to apostrophes, opening single
+ quotes, and closing single quotes in most cases (smart single quotes).
+ * RDoc now correctly converts " characters to opening double quotes and
+ and closing double quotes in most cases (smart double quotes).
+ * (c) correctly is converted into the copyright symbol.
+ * '&' characters in text now correctly are translated to HTML character codes.
+ * Fixed missing stylesheet in generated chm. Patch by Gordon Thiesfeld.
+ * Fixed broken method links in the built-in templates.
+ * RDoc properly links to files and classes in the one page HTML template.
+ * The kilmer and hefss templates properly syntax highlight when inlining
+ source code.
+ * The kilmer and hefss template class pages properly display methods again.
+ * Fixed broken class, file, and method links in the frameless template.
+ * Fixed the clipping of source code in the html and frameless templates when
+ the source code cannot fit into the window; a scrollbar now will allow
+ all of the source code to be viewed.
+ * Fixed the missing constant descriptions in the html and frameless
+ templates.
+ * Fixed the ri command-line options that customize the directories to be
+ searched for documentation.
+ * Fixed the XML generator. Patch by Anthony Durity.
+ * Stopped the XML template from generating invalid XML due to malformed
+ embedded ruby.
+ * Adding missing information about a class' constants to the XML template.
+ * Fixed the horizontal rule markup (---) so that it correctly adds a
+ horizontal rule rather than suppressing all text that follows.
+
+=== 2.1.0 / 2008-07-20
+
+* 3 Major Enhancements:
+ * RDoc now knows about meta-programmed methods, see RDoc::Parser::Ruby
+ * Reorganized parsers under RDoc::Parser base class
+ * ri now walks the ancestors of a class looking for a method e.g. ri
+ File#read displays documentation for IO#read (may require regeneration of
+ ri data)
+* 5 Minor Enhancements:
+ * Allow links to files
+ * Default options now taken from RDOCOPT environment variable
+ * Class method documentation can be found at toplevel now (def X.foo)
+ * Allow HTML templates distributed as gems to be loaded with the -T option,
+ just like the standard templates in rdoc/generator/html (so an HTML
+ template lib/new_template.rb in a gem can be used with rdoc -T new_template)
+ * `rdoc -v` prints out files, classes, modules and methods as it goes
+* 11 Bug Fixes:
+ * `ri Foo.bar` now looks for class methods also
+ * Sections work in the default template again
+ * Doesn't warn about :foo:: list item being an unrecognized directive
+ * RDoc no longer converts characters inside tt tags
+ * Fixed "unitialized constant RDoc::Markup::ToHtml::HTML"
+ * Fixed generation of relative links
+ * Fixed various diagram generation issues
+ * Fixed templates broken by switch to erb
+ * Fixed issue with <!-- --> style comments
+ * Lowercase words are no longer rdoc'd as methods without leading #, as
+ described in the documentation
+ * RDoc now correctly sets superclasses if they were originally unknown
+
+=== 2.0.0 / 2008-04-10
+
+* 3 Major Enhancements:
+ * Renamespaced everything RDoc under the RDoc module.
+ * New `ri` implementation.
+ * Reads from a cache in ~/.ri/ for enhanced speed.
+ * RubyGems aware, only searches latest gem versions.
+ * Now up to over 100 tests and 200 assertions.
+* 4 Minor Enhancements:
+ * Switched to an ERb-based TemplatePage, see RDoc::TemplatePage.
+ * Class/module ri now displays attribute and constant comments.
+ * Cross-references can be disabled with a leading \.
+ * Relaxed parsing for some RDoc inline markup.
View
126 benchmark/app/rdoc-2.4.3/Manifest.txt
@@ -0,0 +1,126 @@
+.autotest
+.document
+History.txt
+Manifest.txt
+README.txt
+RI.txt
+Rakefile
+bin/rdoc
+bin/ri
+lib/rdoc.rb
+lib/rdoc/alias.rb
+lib/rdoc/anon_class.rb
+lib/rdoc/any_method.rb
+lib/rdoc/attr.rb
+lib/rdoc/cache.rb
+lib/rdoc/class_module.rb
+lib/rdoc/code_object.rb
+lib/rdoc/code_objects.rb
+lib/rdoc/constant.rb
+lib/rdoc/context.rb
+lib/rdoc/diagram.rb
+lib/rdoc/dot.rb
+lib/rdoc/generator.rb
+lib/rdoc/generator/darkfish.rb
+lib/rdoc/generator/markup.rb
+lib/rdoc/generator/ri.rb
+lib/rdoc/generator/template/darkfish/.document
+lib/rdoc/generator/template/darkfish/classpage.rhtml
+lib/rdoc/generator/template/darkfish/filepage.rhtml
+lib/rdoc/generator/template/darkfish/images/brick.png
+lib/rdoc/generator/template/darkfish/images/brick_link.png
+lib/rdoc/generator/template/darkfish/images/bug.png
+lib/rdoc/generator/template/darkfish/images/bullet_black.png
+lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png
+lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png
+lib/rdoc/generator/template/darkfish/images/date.png
+lib/rdoc/generator/template/darkfish/images/find.png
+lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif
+lib/rdoc/generator/template/darkfish/images/macFFBgHack.png
+lib/rdoc/generator/template/darkfish/images/package.png
+lib/rdoc/generator/template/darkfish/images/page_green.png
+lib/rdoc/generator/template/darkfish/images/page_white_text.png
+lib/rdoc/generator/template/darkfish/images/page_white_width.png
+lib/rdoc/generator/template/darkfish/images/plugin.png
+lib/rdoc/generator/template/darkfish/images/ruby.png
+lib/rdoc/generator/template/darkfish/images/tag_green.png
+lib/rdoc/generator/template/darkfish/images/wrench.png
+lib/rdoc/generator/template/darkfish/images/wrench_orange.png
+lib/rdoc/generator/template/darkfish/images/zoom.png
+lib/rdoc/generator/template/darkfish/index.rhtml
+lib/rdoc/generator/template/darkfish/js/darkfish.js
+lib/rdoc/generator/template/darkfish/js/jquery.js
+lib/rdoc/generator/template/darkfish/js/quicksearch.js
+lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js
+lib/rdoc/generator/template/darkfish/rdoc.css
+lib/rdoc/ghost_method.rb
+lib/rdoc/include.rb
+lib/rdoc/known_classes.rb
+lib/rdoc/markup.rb
+lib/rdoc/markup/attribute_manager.rb
+lib/rdoc/markup/formatter.rb
+lib/rdoc/markup/fragments.rb
+lib/rdoc/markup/inline.rb
+lib/rdoc/markup/lines.rb
+lib/rdoc/markup/preprocess.rb
+lib/rdoc/markup/to_flow.rb
+lib/rdoc/markup/to_html.rb
+lib/rdoc/markup/to_html_crossref.rb
+lib/rdoc/markup/to_latex.rb
+lib/rdoc/markup/to_test.rb
+lib/rdoc/markup/to_texinfo.rb
+lib/rdoc/meta_method.rb
+lib/rdoc/normal_class.rb
+lib/rdoc/normal_module.rb
+lib/rdoc/options.rb
+lib/rdoc/parser.rb
+lib/rdoc/parser/c.rb
+lib/rdoc/parser/perl.rb
+lib/rdoc/parser/ruby.rb
+lib/rdoc/parser/simple.rb
+lib/rdoc/rdoc.rb
+lib/rdoc/require.rb
+lib/rdoc/ri.rb
+lib/rdoc/ri/cache.rb
+lib/rdoc/ri/descriptions.rb
+lib/rdoc/ri/display.rb
+lib/rdoc/ri/driver.rb
+lib/rdoc/ri/formatter.rb
+lib/rdoc/ri/paths.rb
+lib/rdoc/ri/reader.rb
+lib/rdoc/ri/util.rb
+lib/rdoc/ri/writer.rb
+lib/rdoc/single_class.rb
+lib/rdoc/stats.rb
+lib/rdoc/task.rb
+lib/rdoc/tokenstream.rb
+lib/rdoc/top_level.rb
+test/binary.dat
+test/test.ja.rdoc
+test/test.ja.txt
+test/test_attribute_manager.rb
+test/test_rdoc_any_method.rb
+test/test_rdoc_code_object.rb
+test/test_rdoc_constant.rb
+test/test_rdoc_context.rb
+test/test_rdoc_include.rb
+test/test_rdoc_markup.rb
+test/test_rdoc_markup_attribute_manager.rb
+test/test_rdoc_markup_to_html.rb
+test/test_rdoc_markup_to_html_crossref.rb
+test/test_rdoc_normal_module.rb
+test/test_rdoc_parser.rb
+test/test_rdoc_parser_c.rb
+test/test_rdoc_parser_perl.rb
+test/test_rdoc_parser_ruby.rb
+test/test_rdoc_require.rb
+test/test_rdoc_ri_attribute_formatter.rb
+test/test_rdoc_ri_default_display.rb
+test/test_rdoc_ri_driver.rb
+test/test_rdoc_ri_formatter.rb
+test/test_rdoc_ri_html_formatter.rb
+test/test_rdoc_ri_overstrike_formatter.rb
+test/test_rdoc_task.rb
+test/test_rdoc_top_level.rb
+test/xref_data.rb
+test/xref_test_case.rb
View
47 benchmark/app/rdoc-2.4.3/README.txt
@@ -0,0 +1,47 @@
+= \RDoc
+
+* {RDoc Project Page}[http://rubyforge.org/projects/rdoc/]
+* {RDoc Documentation}[http://rdoc.rubyforge.org/]
+* {RDoc Bug Tracker}[http://rubyforge.org/tracker/?atid=2472&group_id=627&func=browse]
+
+== 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.
+
+== SYNOPSIS:
+
+ gem 'rdoc'
+ require 'rdoc/rdoc'
+ # ... see RDoc
+
+== BUGS:
+
+The markup engine has lots of little bugs. In particular:
+* Escaping does not work for all markup.
+* Typesetting is not always correct.
+* Some output formats (ri, for example) do not correctly handle all of the
+ markup.
+
+RDoc has some subtle bugs processing classes that are split across multiple
+files (bugs that may or may not manifest depending on the order in which
+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].
+
+If you find a bug, please report it at the RDoc project's
+tracker[http://rubyforge.org/tracker/?group_id=627] on RubyForge:
+
+== LICENSE:
+
+RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers.
+Portions (c) 2007-2009 Eric Hodel. Portions copyright others, see individual
+files for details.
+
+It is free software, and may be redistributed under the terms specified in the
+README file of the Ruby distribution.
View
58 benchmark/app/rdoc-2.4.3/RI.txt
@@ -0,0 +1,58 @@
+= RI
+== Background
++ri+ is a tool that allows Ruby documentation to be viewed on the command-line.
+It is part of RDoc and is expected to work on any platform supported by Ruby.
+
++ri+ will be a bit slow the first time that it runs (or any time that the
+underlying documentation changes) because it builds a cache in the +.ri+
+directory within the user's home directory in order to make future accesses
+faster.
+
+== Usage
+To see information for a class, do:
+ ri class_name
+
+For example, for the +Array+ class, do
+ ri Array
+
+To see information for an instance method, do:
+ ri class_name#method_name
+
+For example, for Array's +join+ method, do:
+ ri Array#join
+
+To see information for a class method, do:
+ ri class_name.method_name
+
+For example, for Module's +private+ method, do:
+ ri Module.private
+
+To search for all methods containing +read+, do:
+ ri read
+
+To search for all methods starting with +read+, do:
+ ri '^read'
+
+To search for all +read+ methods, do:
+ ri '^read$'
+
+== Options
++ri+ supports a variety of options, all of which can be viewed via +--help+.
+Of particular interest, are:
+[-d directory]
+ List of directories from which to source documentation in addition to
+ the standard directories. May be repeated. This can be used to specify
+ the location of site-specific documentation (which can be generated with
+ RDoc).
+[-i]
+ This makes +ri+ go into interactive mode. When +ri+ is in interactive mode,
+ it will allow the user to disambiguate lists of methods in case multiple
+ methods match against a method search string. It also will allow the user
+ to enter in a method name (with auto-completion, if readline is supported)
+ when viewing a class.
+[-T]
+ Send output to stdout, rather than to a pager.
+
+All options also can be specified through the +RI+ environment variable.
+Command-line options always override those specified in the +RI+ environment
+variable.
View
71 benchmark/app/rdoc-2.4.3/Rakefile
@@ -0,0 +1,71 @@
+require 'hoe'
+
+$rdoc_rakefile = true
+
+$:.unshift 'lib'
+require 'rdoc'
+
+Hoe.new "rdoc", RDoc::VERSION do |rdoc|
+ rdoc.developer 'Eric Hodel', 'drbrain@segment7.net'
+ rdoc.developer 'Dave Thomas', ''
+ rdoc.developer 'Phil Hagelberg', 'technomancy@gmail.com'
+ rdoc.developer 'Tony Strauss', 'tony.strauss@designingpatterns.com'
+ rdoc.remote_rdoc_dir = ''
+ rdoc.testlib = :minitest
+
+ rdoc.extra_dev_deps << ['minitest', '~> 1.3']
+ rdoc.spec_extras['required_rubygems_version'] = '>= 1.3'
+ rdoc.spec_extras['homepage'] = 'http://rdoc.rubyforge.org'
+end
+
+# These tasks expect to have the following directory structure:
+#
+# git/git.rubini.us/code # Rubinius git HEAD checkout
+# svn/ruby/trunk # ruby subversion HEAD checkout
+# svn/rdoc/trunk # RDoc subversion HEAD checkout
+#
+# If you don't have this directory structure, set RUBY_PATH and/or
+# RUBINIUS_PATH.
+
+diff_options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
+rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc' --exclude '*.rej' --exclude '*.orig'"
+
+rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
+ruby_dir = ENV['RUBY_PATH'] || '../../ruby/trunk'
+
+desc "Updates Ruby HEAD with the currently checked-out copy of RDoc."
+task :update_ruby do
+ sh "rsync #{rsync_options} bin/rdoc #{ruby_dir}/bin/rdoc"
+ sh "rsync #{rsync_options} bin/ri #{ruby_dir}/bin/ri"
+ sh "rsync #{rsync_options} lib/ #{ruby_dir}/lib"
+ sh "rsync #{rsync_options} test/ #{ruby_dir}/test/rdoc"
+end
+
+desc "Diffs Ruby HEAD with the currently checked-out copy of RDoc."
+task :diff_ruby do
+ options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
+
+ sh "diff #{diff_options} bin/rdoc #{ruby_dir}/bin/rdoc; true"
+ sh "diff #{diff_options} bin/ri #{ruby_dir}/bin/ri; true"
+ sh "diff #{diff_options} lib/rdoc.rb #{ruby_dir}/lib/rdoc.rb; true"
+ sh "diff #{diff_options} lib/rdoc #{ruby_dir}/lib/rdoc; true"
+ sh "diff #{diff_options} test #{ruby_dir}/test/rdoc; true"
+end
+
+desc "Updates Rubinius HEAD with the currently checked-out copy of RDoc."
+task :update_rubinius do
+ sh "rsync #{rsync_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb"
+ sh "rsync #{rsync_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb"
+ sh "rsync #{rsync_options} lib/ #{rubinius_dir}/lib"
+ sh "rsync #{rsync_options} test/ #{rubinius_dir}/test/rdoc"
+end
+
+desc "Diffs Rubinius HEAD with the currently checked-out copy of RDoc."
+task :diff_rubinius do
+ sh "diff #{diff_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb; true"
+ sh "diff #{diff_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb; true"
+ sh "diff #{diff_options} lib/rdoc.rb #{rubinius_dir}/lib/rdoc.rb; true"
+ sh "diff #{diff_options} lib/rdoc #{rubinius_dir}/lib/rdoc; true"
+ sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true"
+end
+
View
35 benchmark/app/rdoc-2.4.3/bin/rdoc
@@ -0,0 +1,35 @@
+#!/usr/bin/env ruby
+#
+# RDoc: Documentation tool for source code
+# (see lib/rdoc/rdoc.rb for more information)
+#
+# Copyright (c) 2003 Dave Thomas
+# Released under the same terms as Ruby
+#
+# $Revision: 15033 $
+
+require 'rdoc/rdoc'
+
+begin
+ r = RDoc::RDoc.new
+ r.document ARGV
+rescue Interrupt
+ $stderr.puts
+ $stderr.puts "Interrupted"
+ exit 1
+rescue SystemExit
+ raise
+rescue Exception => e
+ if $DEBUG_RDOC then
+ $stderr.puts e.message
+ $stderr.puts "#{e.backtrace.join "\n\t"}"
+ $stderr.puts
+ else
+ $stderr.puts "uh-oh! RDoc had a problem:"
+ $stderr.puts e.message
+ $stderr.puts
+ $stderr.puts "run with --debug for full backtrace"
+ end
+ exit 1
+end
+
View
5 benchmark/app/rdoc-2.4.3/bin/ri
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+
+require 'rdoc/ri/driver'
+
+RDoc::RI::Driver.run ARGV
View
398 benchmark/app/rdoc-2.4.3/lib/rdoc.rb
@@ -0,0 +1,398 @@
+$DEBUG_RDOC = nil
+
+# :main: README.txt
+
+##
+# = \RDoc - Ruby Documentation System
+#
+# This package contains RDoc and RDoc::Markup. RDoc is an application that
+# produces documentation for one or more Ruby source files. It works similarly
+# to JavaDoc, parsing the source, and extracting the definition for classes,
+# modules, and methods (along with includes and requires). It associates with
+# these optional documentation contained in the immediately preceding comment
+# block, and then renders the result using a pluggable output formatter.
+# RDoc::Markup is a library that converts plain text into various output
+# formats. The markup library is used to interpret the comment blocks that
+# RDoc uses to document methods, classes, and so on.
+#
+# == Roadmap
+#
+# * If you want to use RDoc to create documentation for your Ruby source files,
+# read on.
+# * If you want to include extensions written in C, see RDoc::Parser::C
+# * If you want to drive RDoc programmatically, see RDoc::RDoc.
+# * If you want to use the library to format text blocks into HTML, have a look
+# at RDoc::Markup.
+# * If you want to try writing your own HTML output template, see
+# RDoc::Generator::HTML
+#
+# == Summary
+#
+# Once installed, you can create documentation using the +rdoc+ command
+#
+# % rdoc [options] [names...]
+#
+# For an up-to-date option summary, type
+# % rdoc --help
+#
+# A typical use might be to generate documentation for a package of Ruby
+# source (such as RDoc itself).
+#
+# % rdoc
+#
+# This command generates documentation for all the Ruby and C source
+# files in and below the current directory. These will be stored in a
+# documentation tree starting in the subdirectory +doc+.
+#
+# You can make this slightly more useful for your readers by having the
+# index page contain the documentation for the primary file. In our
+# case, we could type
+#
+# % rdoc --main rdoc.rb
+#
+# You'll find information on the various formatting tricks you can use
+# in comment blocks in the documentation this generates.
+#
+# RDoc uses file extensions to determine how to process each file. File names
+# ending +.rb+ and +.rbw+ are assumed to be Ruby source. Files
+# ending +.c+ are parsed as C files. All other files are assumed to
+# contain just Markup-style markup (with or without leading '#' comment
+# markers). If directory names are passed to RDoc, they are scanned
+# recursively for C and Ruby source files only.
+#
+# == \Options
+#
+# rdoc can be passed a variety of command-line options. In addition,
+# options can be specified via the +RDOCOPT+ environment variable, which
+# functions similarly to the +RUBYOPT+ environment variable.
+#
+# % export RDOCOPT="-S"
+#
+# will make rdoc default to inline method source code. Command-line options
+# always will override those in +RDOCOPT+.
+#
+# Run:
+#
+# rdoc --help
+#
+# for full details on rdoc's options.
+#
+# == Documenting Source Code
+#
+# Comment blocks can be written fairly naturally, either using <tt>#</tt> on
+# successive lines of the comment, or by including the comment in
+# a =begin/=end block. If you use the latter form, the =begin line must be
+# flagged with an RDoc tag:
+#
+# =begin rdoc
+# Documentation to be processed by RDoc.
+#
+# ...
+# =end
+#
+# RDoc stops processing comments if it finds a comment line containing
+# a <tt>--</tt>. This can be used to separate external from internal
+# comments, or to stop a comment being associated with a method, class, or
+# module. Commenting can be turned back on with a line that starts with a
+# <tt>++</tt>.
+#
+# ##
+# # Extract the age and calculate the date-of-birth.
+# #--
+# # FIXME: fails if the birthday falls on February 29th
+# #++
+# # The DOB is returned as a Time object.
+#
+# def get_dob(person)
+# # ...
+# end
+#
+# Names of classes, files, and any method names containing an
+# underscore or preceded by a hash character are automatically hyperlinked
+# from comment text to their description.
+#
+# Method parameter lists are extracted and displayed with the method
+# description. If a method calls +yield+, then the parameters passed to yield
+# will also be displayed:
+#
+# def fred
+# ...
+# yield line, address
+#
+# This will get documented as:
+#
+# fred() { |line, address| ... }
+#
+# You can override this using a comment containing ':yields: ...' immediately
+# after the method definition
+#
+# def fred # :yields: index, position
+# # ...
+#
+# yield line, address
+#
+# which will get documented as
+#
+# fred() { |index, position| ... }
+#
+# +:yields:+ is an example of a documentation directive. These appear
+# immediately after the start of the document element they are modifying.
+#
+# RDoc automatically cross-references words with underscores or camel-case.
+# To suppress cross-references, prefix the word with a \\ character. To
+# include special characters like "\\n", you'll need to use two \\
+# characters like "\\\\\\n".
+#
+# == \Markup
+#
+# * The markup engine looks for a document's natural left margin. This is
+# used as the initial margin for the document.
+#
+# * Consecutive lines starting at this margin are considered to be a
+# paragraph.
+#
+# * If a paragraph starts with a "*", "-", or with "<digit>.", then it is
+# taken to be the start of a list. The margin in increased to be the first
+# non-space following the list start flag. Subsequent lines should be
+# indented to this new margin until the list ends. For example:
+#
+# * this is a list with three paragraphs in
+# the first item. This is the first paragraph.
+#
+# And this is the second paragraph.
+#
+# 1. This is an indented, numbered list.
+# 2. This is the second item in that list
+#
+# This is the third conventional paragraph in the
+# first list item.
+#
+# * This is the second item in the original list
+#
+# * You can also construct labeled lists, sometimes called description
+# or definition lists. Do this by putting the label in square brackets
+# and indenting the list body:
+#
+# [cat] a small furry mammal
+# that seems to sleep a lot
+#
+# [ant] a little insect that is known
+# to enjoy picnics
+#
+# A minor variation on labeled lists uses two colons to separate the
+# label from the list body:
+#
+# cat:: a small furry mammal
+# that seems to sleep a lot
+#
+# ant:: a little insect that is known
+# to enjoy picnics
+#
+# This latter style guarantees that the list bodies' left margins are
+# aligned: think of them as a two column table.
+#
+# * Any line that starts to the right of the current margin is treated
+# as verbatim text. This is useful for code listings. The example of a
+# list above is also verbatim text.
+#
+# * A line starting with an equals sign (=) is treated as a
+# heading. Level one headings have one equals sign, level two headings
+# have two,and so on.
+#
+# * A line starting with three or more hyphens (at the current indent)
+# generates a horizontal rule. The more hyphens, the thicker the rule
+# (within reason, and if supported by the output device)
+#
+# * You can use markup within text (except verbatim) to change the
+# appearance of parts of that text. Out of the box, RDoc::Markup
+# supports word-based and general markup.
+#
+# Word-based markup uses flag characters around individual words:
+#
+# [<tt>\*word*</tt>] displays word in a *bold* font
+# [<tt>\_word_</tt>] displays word in an _emphasized_ font
+# [<tt>\+word+</tt>] displays word in a +code+ font
+#
+# General markup affects text between a start delimiter and and end
+# delimiter. Not surprisingly, these delimiters look like HTML markup.
+#
+# [<tt>\<b>text...</b></tt>] displays word in a *bold* font
+# [<tt>\<em>text...</em></tt>] displays word in an _emphasized_ font
+# [<tt>\<i>text...</i></tt>] displays word in an <i>italicized</i> font
+# [<tt>\<tt>text...\</tt></tt>] displays word in a +code+ font
+#
+# Unlike conventional Wiki markup, general markup can cross line
+# boundaries. You can turn off the interpretation of markup by
+# preceding the first character with a backslash. This only works for
+# simple markup, not HTML-style markup.
+#
+# * Hyperlinks to the web starting http:, mailto:, ftp:, or www. are
+# recognized. An HTTP url that references an external image file is
+# converted into an inline \<IMG..>. Hyperlinks starting 'link:' are
+# assumed to refer to local files whose path is relative to the --op
+# directory.
+#
+# Hyperlinks can also be of the form <tt>label</tt>[url], in which
+# case the label is used in the displayed text, and +url+ is
+# used as the target. If +label+ contains multiple words,
+# put it in braces: <em>{multi word label}[</em>url<em>]</em>.
+#
+# Example hyperlinks:
+#
+# link:RDoc.html
+# http://rdoc.rubyforge.org
+# mailto:user@example.com
+# {RDoc Documentation}[http://rdoc.rubyforge.org]
+# {RDoc Markup}[link:RDoc/Markup.html]
+#
+# == Directives
+#
+# [+:nodoc:+ / +:nodoc:+ all]
+# This directive prevents documentation for the element from
+# being generated. For classes and modules, the methods, aliases,
+# constants, and attributes directly within the affected class or
+# module also will be omitted. By default, though, modules and
+# classes within that class of module _will_ be documented. This is
+# turned off by adding the +all+ modifier.
+#
+# module MyModule # :nodoc:
+# class Input
+# end
+# end
+#
+# module OtherModule # :nodoc: all
+# class Output
+# end
+# end
+#
+# In the above code, only class <tt>MyModule::Input</tt> will be documented.
+# The +:nodoc:+ directive is global across all files for the class or module
+# to which it applies, so use +:stopdoc:+/+:startdoc:+ to suppress
+# documentation only for a particular set of methods, etc.
+#
+# [+:doc:+]
+# Forces a method or attribute to be documented even if it wouldn't be
+# otherwise. Useful if, for example, you want to include documentation of a
+# particular private method.
+#
+# [+:notnew:+]
+# Only applicable to the +initialize+ instance method. Normally RDoc
+# assumes that the documentation and parameters for +initialize+ are
+# actually for the +new+ method, and so fakes out a +new+ for the class.
+# The +:notnew:+ modifier stops this. Remember that +initialize+ is private,
+# so you won't see the documentation unless you use the +-a+ command line
+# option.
+#
+# Comment blocks can contain other directives:
+#
+# [<tt>:section: title</tt>]
+# Starts a new section in the output. The title following +:section:+ is
+# used as the section heading, and the remainder of the comment containing
+# the section is used as introductory text. Subsequent methods, aliases,
+# attributes, and classes will be documented in this section. A :section:
+# comment block may have one or more lines before the :section: directive.
+# These will be removed, and any identical lines at the end of the block are
+# also removed. This allows you to add visual cues such as:
+#
+# # ----------------------------------------
+# # :section: My Section
+# # This is the section that I wrote.
+# # See it glisten in the noon-day sun.
+# # ----------------------------------------
+#
+# [+:call-seq:+]
+# Lines up to the next blank line in the comment are treated as the method's
+# calling sequence, overriding the default parsing of method parameters and
+# yield arguments.
+#
+# [+:include:+ _filename_]
+# \Include the contents of the named file at this point. The file will be
+# searched for in the directories listed by the +--include+ option, or in
+# the current directory by default. The contents of the file will be
+# shifted to have the same indentation as the ':' at the start of
+# the :include: directive.
+#
+# [+:title:+ _text_]
+# Sets the title for the document. Equivalent to the <tt>--title</tt>
+# command line parameter. (The command line parameter overrides any :title:
+# directive in the source).
+#
+# [+:enddoc:+]
+# Document nothing further at the current level.
+#
+# [+:main:+ _name_]
+# Equivalent to the <tt>--main</tt> command line parameter.
+#
+# [+:stopdoc:+ / +:startdoc:+]
+# Stop and start adding new documentation elements to the current container.
+# For example, if a class has a number of constants that you don't want to
+# document, put a +:stopdoc:+ before the first, and a +:startdoc:+ after the
+# last. If you don't specify a +:startdoc:+ by the end of the container,
+# disables documentation for the entire class or module.
+#
+# == Other stuff
+#
+# RDoc is currently being maintained by Eric Hodel <drbrain@segment7.net>
+#
+# Dave Thomas <dave@pragmaticprogrammer.com> is the original author of RDoc.
+#
+# == Credits
+#
+# * The Ruby parser in rdoc/parse.rb is based heavily on the outstanding
+# work of Keiju ISHITSUKA of Nippon Rational Inc, who produced the Ruby
+# parser for irb and the rtags package.
+#
+# * Code to diagram classes and modules was written by Sergey A Yanovitsky
+# (Jah) of Enticla.
+#
+# * Charset patch from MoonWolf.
+#
+# * Rich Kilmer wrote the kilmer.rb output template.
+#
+# * Dan Brickley led the design of the RDF format.
+#
+# == License
+#
+# RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. It
+# is free software, and may be redistributed under the terms specified
+# in the README file of the Ruby distribution.
+#
+# == Warranty
+#
+# This software is provided "as is" and without any express or implied
+# warranties, including, without limitation, the implied warranties of
+# merchantibility and fitness for a particular purpose.
+
+module RDoc
+
+ ##
+ # Exception thrown by any rdoc error.
+
+ class Error < RuntimeError; end
+
+ RDocError = Error # :nodoc:
+
+ ##
+ # RDoc version you are using
+
+ VERSION = '2.4.3'
+
+ ##
+ # Name of the dotfile that contains the description of files to be processed
+ # in the current directory
+
+ DOT_DOC_FILENAME = ".document"
+
+ GENERAL_MODIFIERS = %w[nodoc].freeze
+
+ CLASS_MODIFIERS = GENERAL_MODIFIERS
+
+ ATTR_MODIFIERS = GENERAL_MODIFIERS
+
+ CONSTANT_MODIFIERS = GENERAL_MODIFIERS
+
+ METHOD_MODIFIERS = GENERAL_MODIFIERS +
+ %w[arg args yield yields notnew not-new not_new doc]
+
+end
+
View
54 benchmark/app/rdoc-2.4.3/lib/rdoc/alias.rb
@@ -0,0 +1,54 @@
+require 'rdoc/code_object'
+
+##
+# Represent an alias, which is an old_name/new_name pair associated with a
+# particular context
+
+class RDoc::Alias < RDoc::CodeObject
+
+ ##
+ # Allow comments to be overridden
+
+ attr_writer :comment
+
+ ##
+ # Aliased name
+
+ attr_accessor :new_name
+
+ ##
+ # Aliasee's name
+
+ attr_accessor :old_name
+
+ ##
+ # Source file token stream
+
+ attr_accessor :text
+
+ ##
+ # Creates a new Alias with a token stream of +text+ that aliases +old_name+
+ # to +new_name+ and has +comment+
+
+ def initialize(text, old_name, new_name, comment)
+ super()
+ @text = text
+ @old_name = old_name
+ @new_name = new_name
+ self.comment = comment
+ end
+
+ def inspect # :nodoc:
+ "#<%s:0x%x %s.alias_method %s, %s>" % [
+ self.class, object_id,
+ parent.name, @old_name, @new_name,
+ ]
+ end
+
+ def to_s # :nodoc:
+ "alias: #{self.old_name} -> #{self.new_name}\n#{self.comment}"
+ end
+
+end
+
+
View
10 benchmark/app/rdoc-2.4.3/lib/rdoc/anon_class.rb
@@ -0,0 +1,10 @@
+require 'rdoc/class_module'
+
+##
+# An anonymous class like:
+#
+# c = Class.new do end
+
+class RDoc::AnonClass < RDoc::ClassModule
+end
+
View
190 benchmark/app/rdoc-2.4.3/lib/rdoc/any_method.rb
@@ -0,0 +1,190 @@
+require 'rdoc/code_object'
+require 'rdoc/tokenstream'
+
+##
+# AnyMethod is the base class for objects representing methods
+
+class RDoc::AnyMethod < RDoc::CodeObject
+
+ ##
+ # Method name
+
+ attr_writer :name
+
+ ##
+ # public, protected, private
+
+ attr_accessor :visibility
+
+ ##
+ # Parameters yielded by the called block
+
+ attr_accessor :block_params
+
+ ##
+ # Don't rename \#initialize to \::new
+
+ attr_accessor :dont_rename_initialize
+
+ ##
+ # Is this a singleton method?
+
+ attr_accessor :singleton
+
+ ##
+ # Source file token stream
+
+ attr_reader :text
+
+ ##
+ # Array of other names for this method
+
+ attr_reader :aliases
+
+ ##
+ # Fragment reference for this method
+
+ attr_reader :aref
+
+ ##
+ # The method we're aliasing
+
+ attr_accessor :is_alias_for
+
+ ##
+ # Parameters for this method
+
+ attr_overridable :params, :param, :parameters, :parameter
+
+ ##
+ # Different ways to call this method
+
+ attr_accessor :call_seq
+
+ include RDoc::TokenStream
+
+ ##
+ # Resets method fragment reference counter
+
+ def self.reset
+ @@aref = 'M000000'
+ end
+
+ reset
+
+ def initialize(text, name)
+ super()
+ @text = text
+ @name = name
+ @token_stream = nil
+ @visibility = :public
+ @dont_rename_initialize = false
+ @block_params = nil
+ @aliases = []
+ @is_alias_for = nil
+ @call_seq = nil
+
+ @aref = @@aref
+ @@aref = @@aref.succ
+ end
+
+ ##
+ # Order by #singleton then #name
+
+ def <=>(other)
+ [@singleton ? 0 : 1, @name] <=> [other.singleton ? 0 : 1, other.name]
+ end
+
+ ##
+ # Adds +method+ as an alias for this method
+
+ def add_alias(method)
+ @aliases << method
+ end
+
+ ##
+ # HTML id-friendly method name
+
+ def html_name
+ @name.gsub(/[^a-z]+/, '-')
+ end
+
+ def inspect # :nodoc:
+ alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
+ "#<%s:0x%x %s%s%s (%s)%s>" % [
+ self.class, object_id,
+ parent_name,
+ singleton ? '::' : '#',
+ name,
+ visibility,
+ alias_for,
+ ]
+ end
+
+ ##
+ # Full method name including namespace
+
+ def full_name
+ "#{@parent.full_name}#{pretty_name}"
+ end
+
+ ##
+ # Method name
+
+ def name
+ return @name if @name
+
+ @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq
+ end
+
+ ##
+ # Pretty parameter list for this method
+
+ def param_seq
+ params = params.gsub(/\s*\#.*/, '')
+ params = params.tr("\n", " ").squeeze(" ")
+ params = "(#{params})" unless p[0] == ?(
+
+ if block = block_params then # yes, =
+ # If this method has explicit block parameters, remove any explicit
+ # &block
+ params.sub!(/,?\s*&\w+/)
+
+ block.gsub!(/\s*\#.*/, '')
+ block = block.tr("\n", " ").squeeze(" ")
+ if block[0] == ?(
+ block.sub!(/^\(/, '').sub!(/\)/, '')
+ end
+ params << " { |#{block}| ... }"
+ end
+
+ params
+ end
+
+ ##
+ # Path to this method
+
+ def path
+ "#{@parent.path}##{@aref}"
+ end
+
+ ##
+ # Method name with class/instance indicator
+
+ def pretty_name
+ "#{singleton ? '::' : '#'}#{@name}"
+ end
+
+ def to_s # :nodoc:
+ "#{self.class.name}: #{full_name} (#{@text})\n#{@comment}"
+ end
+
+ ##
+ # Type of method (class or instance)
+
+ def type
+ singleton ? 'class' : 'instance'
+ end
+
+end
+
View
79 benchmark/app/rdoc-2.4.3/lib/rdoc/attr.rb
@@ -0,0 +1,79 @@
+require 'rdoc/code_object'
+
+##
+# An attribute created by \#attr, \#attr_reader, \#attr_writer or
+# \#attr_accessor
+
+class RDoc::Attr < RDoc::CodeObject
+
+ ##
+ # Name of the attribute
+
+ attr_accessor :name
+
+ ##
+ # Is the attribute readable, writable or both?
+
+ attr_accessor :rw
+
+ ##
+ # Source file token stream
+
+ attr_accessor :text
+
+ ##
+ # public, protected, private
+
+ attr_accessor :visibility
+
+ def initialize(text, name, rw, comment)
+ super()
+ @text = text
+ @name = name
+ @rw = rw
+ @visibility = :public
+ self.comment = comment
+ end
+
+ ##
+ # Attributes are ordered by name
+
+ def <=>(other)
+ self.name <=> other.name
+ end
+
+ ##
+ # An HTML id-friendly representation of #name
+
+ def html_name
+ @name.gsub(/[^a-z]+/, '-')
+ end
+
+ def inspect # :nodoc:
+ attr = case rw
+ when 'RW' then :attr_accessor
+ when 'R' then :attr_reader
+ when 'W' then :attr_writer
+ else
+ " (#{rw})"
+ end
+
+ "#<%s:0x%x %s.%s :%s>" % [
+ self.class, object_id,
+ parent_name, attr, @name,
+ ]
+ end
+
+ ##
+ # URL path for this attribute
+
+ def path
+ "#{@parent.path}##{@name}"
+ end
+
+ def to_s # :nodoc:
+ "attr: #{self.name} #{self.rw}\n#{self.comment}"
+ end
+
+end
+
View
41 benchmark/app/rdoc-2.4.3/lib/rdoc/cache.rb
@@ -0,0 +1,41 @@
+require 'thread'
+require 'singleton'
+
+##
+# A generic, thread-safe in-memory cache. It's used for caching
+# RDoc::TemplatePage objects when generating RDoc output.
+
+class RDoc::Cache
+
+ include Singleton
+
+ ##
+ # Creates a new, empty cache
+
+ def initialize
+ @contents = {}
+ @lock = Mutex.new
+ end
+
+ ##
+ # Checks whether there's a value in the cache with key +key+. If so, then
+ # that value will be returned. Otherwise, the given block will be run, and
+ # its return value will be put into the cache, and returned.
+
+ def cache(key)
+ @lock.synchronize do
+ @contents[key] ||= yield
+ end
+ end
+
+ ##
+ # Clears the contents of the cache
+
+ def clear
+ @lock.synchronize do
+ @contents.clear
+ end
+ end
+
+end
+
View
87 benchmark/app/rdoc-2.4.3/lib/rdoc/class_module.rb
@@ -0,0 +1,87 @@
+require 'rdoc/context'
+
+##
+# ClassModule is the base class for objects representing either a class or a
+# module.
+
+class RDoc::ClassModule < RDoc::Context
+
+ attr_accessor :diagram
+
+ ##
+ # Creates a new ClassModule with +name+ with optional +superclass+
+
+ def initialize(name, superclass = 'Object')
+ @diagram = nil
+ @full_name = nil
+ @name = name
+ @superclass = superclass
+ super()
+ end
+
+ ##
+ # Finds a class or module with +name+ in this namespace or its descendents
+
+ def find_class_named(name)
+ return self if full_name == name
+ @classes.each_value {|c| return c if c.find_class_named(name) }
+ nil
+ end
+
+ ##
+ # Return the fully qualified name of this class or module
+
+ def full_name
+ @full_name ||= if RDoc::ClassModule === @parent then
+ "#{@parent.full_name}::#{@name}"
+ else
+ @name
+ end
+ end
+
+ ##
+ # 'module' or 'class'
+
+ def type
+ module? ? 'module' : 'class'
+ end
+
+ ##
+ # Does this object represent a module?
+
+ def module?
+ false
+ end
+
+ ##
+ # Path to this class or module
+
+ def path
+ http_url RDoc::RDoc.current.generator.class_dir
+ end
+
+ ##
+ # Get the superclass of this class. Attempts to retrieve the superclass
+ # object, returns the name if it is not known.
+
+ def superclass
+ raise NoMethodError, "#{full_name} is a module" if module?
+
+ RDoc::TopLevel.find_class_named(@superclass) || @superclass
+ end
+
+ ##
+ # Set the superclass of this class to +superclass+
+
+ def superclass=(superclass)
+ raise NoMethodError, "#{full_name} is a module" if module?
+
+ @superclass = superclass if @superclass.nil? or @superclass == 'Object'
+ end
+
+ def to_s # :nodoc:
+ "#{self.class}: #{full_name} #{@comment} #{super}"
+ end
+
+end
+
View
152 benchmark/app/rdoc-2.4.3/lib/rdoc/code_object.rb
@@ -0,0 +1,152 @@
+require 'rdoc'
+
+##
+# We contain the common stuff for contexts (which are containers) and other
+# elements (methods, attributes and so on)
+
+class RDoc::CodeObject
+
+ ##
+ # Our comment
+
+ attr_reader :comment
+
+ ##
+ # Do we document our children?
+
+ attr_reader :document_children
+
+ ##
+ # Do we document ourselves?
+
+ attr_reader :document_self
+
+ ##
+ # Are we done documenting (ie, did we come across a :enddoc:)?
+
+ attr_accessor :done_documenting
+
+ ##
+ # Force documentation of this CodeObject
+
+ attr_accessor :force_documentation
+
+ ##
+ # Our parent CodeObject
+
+ attr_accessor :parent
+
+ ##
+ # Which section are we in
+
+ attr_accessor :section
+
+ ##
+ # We are the model of the code, but we know that at some point we will be
+ # worked on by viewers. By implementing the Viewable protocol, viewers can
+ # associated themselves with these objects.
+
+ attr_accessor :viewer
+
+ ##
+ # There's a wee trick we pull. Comment blocks can have directives that
+ # override the stuff we extract during the parse. So, we have a special
+ # class method, attr_overridable, that lets code objects list those
+ # directives. When a comment is assigned, we then extract out any matching
+ # directives and update our object
+
+ def self.attr_overridable(name, *aliases)
+ @overridables ||= {}
+
+ attr_accessor name
+
+ aliases.unshift name
+
+ aliases.each do |directive_name|
+ @overridables[directive_name.to_s] = name
+ end
+ end
+
+ ##
+ # Creates a new CodeObject that will document itself and its children
+
+ def initialize
+ @comment = nil
+ @document_children = true
+ @document_self = true
+ @done_documenting = false
+ @force_documentation = false
+ @parent = nil
+ end
+
+ ##
+ # Replaces our comment with +comment+, unless it is empty.
+
+ def comment=(comment)
+ @comment = comment unless comment.empty?
+ end
+
+ ##
+ # Enables or disables documentation of this CodeObject's children. Calls
+ # remove_classes_and_modules when disabling.
+
+ def document_children=(document_children)
+ @document_children = document_children
+ remove_classes_and_modules unless document_children
+ end
+
+ ##
+ # Enables or disables documentation of this CodeObject. Calls
+ # remove_methods_etc when disabling.
+
+ def document_self=(document_self)
+ @document_self = document_self
+ remove_methods_etc unless document_self
+ end
+
+ ##
+ # File name of our parent
+
+ def parent_file_name
+ @parent ? @parent.base_name : '(unknown)'
+ end
+
+ ##
+ # Name of our parent
+
+ def parent_name
+ @parent ? @parent.full_name : '(unknown)'
+ end
+
+ ##
+ # Callback called upon disabling documentation of children. See
+ # #document_children=
+
+ def remove_classes_and_modules
+ end
+
+ ##
+ # Callback called upon disabling documentation of ourself. See
+ # #document_self=
+
+ def remove_methods_etc
+ end
+
+ ##
+ # Enable capture of documentation
+
+ def start_doc
+ @document_self = true
+ @document_children = true
+ end
+
+ ##
+ # Disable capture of documentation
+
+ def stop_doc
+ @document_self = false
+ @document_children = false
+ end
+
+end
+
View
23 benchmark/app/rdoc-2.4.3/lib/rdoc/code_objects.rb
@@ -0,0 +1,23 @@
+# We represent the various high-level code constructs that appear in Ruby
+# programs: classes, modules, methods, and so on.
+
+require 'rdoc/code_object'
+require 'rdoc/context'
+require 'rdoc/top_level'
+
+require 'rdoc/class_module'
+require 'rdoc/normal_class'
+require 'rdoc/normal_module'
+require 'rdoc/anon_class'
+require 'rdoc/single_class'
+
+require 'rdoc/any_method'
+require 'rdoc/alias'
+require 'rdoc/ghost_method'
+require 'rdoc/meta_method'
+
+require 'rdoc/attr'
+require 'rdoc/constant'
+require 'rdoc/require'
+require 'rdoc/include'
+
View
36 benchmark/app/rdoc-2.4.3/lib/rdoc/constant.rb
@@ -0,0 +1,36 @@
+require 'rdoc/code_object'
+
+##
+# A constant
+
+class RDoc::Constant < RDoc::CodeObject
+
+ ##
+ # The constant's name
+
+ attr_accessor :name
+
+ ##
+ # The constant's value
+
+ attr_accessor :value
+
+ ##
+ # Creates a new constant with +name+, +value+ and +comment+
+
+ def initialize(name, value, comment)
+ super()
+ @name = name
+ @value = value
+ self.comment = comment
+ end
+
+ ##
+ # Path to this constant
+
+ def path
+ "#{@parent.path}##{@name}"
+ end
+
+end
+
View
712 benchmark/app/rdoc-2.4.3/lib/rdoc/context.rb
@@ -0,0 +1,712 @@
+require 'thread'
+require 'rdoc/code_object'
+
+##
+# A Context is something that can hold modules, classes, methods, attributes,
+# aliases, requires, and includes. Classes, modules, and files are all
+# Contexts.
+
+class RDoc::Context < RDoc::CodeObject
+
+ ##
+ # Types of methods
+
+ TYPES = %w[class instance]
+
+ ##
+ # Method visibilities
+
+ VISIBILITIES = [:public, :protected, :private]
+
+ ##
+ # Aliased methods
+
+ attr_reader :aliases
+
+ ##
+ # attr* methods
+
+ attr_reader :attributes
+
+ ##
+ # Constants defined
+
+ attr_reader :constants
+
+ ##
+ # Current section of documentation
+
+ attr_reader :current_section
+
+ ##
+ # Files this context is found in
+
+ attr_reader :in_files
+
+ ##
+ # Modules this context includes
+
+ attr_reader :includes
+
+ ##
+ # Methods defined in this context
+
+ attr_reader :method_list
+
+ ##
+ # Name of this class excluding namespace. See also full_name
+
+ attr_reader :name
+
+ ##
+ # Files this context requires
+
+ attr_reader :requires
+
+ ##
+ # Sections in this context
+
+ attr_reader :sections
+
+ ##
+ # Aliases that haven't been resolved to a method
+
+ attr_accessor :unmatched_alias_lists
+
+ ##
+ # Current visibility of this context
+
+ attr_reader :visibility
+
+ ##
+ # A per-comment section of documentation like:
+ #
+ # # :SECTION: The title
+ # # The body
+
+ class Section
+
+ ##
+ # Section comment
+
+ attr_reader :comment
+
+ ##
+ # Context this Section lives in
+
+ attr_reader :parent
+
+ ##
+ # Section sequence number (for linking)
+
+ attr_reader :sequence
+
+ ##
+ # Section title
+
+ attr_reader :title
+
+ @@sequence = "SEC00000"
+ @@sequence_lock = Mutex.new
+
+ ##
+ # Creates a new section with +title+ and +comment+
+
+ def initialize(parent, title, comment)
+ @parent = parent
+ @title = title
+
+ @@sequence_lock.synchronize do
+ @@sequence.succ!
+ @sequence = @@sequence.dup
+ end
+
+ set_comment comment
+ end
+
+ ##
+ # Sections are equal when they have the same #sequence
+
+ def ==(other)
+ self.class === other and @sequence == other.sequence
+ end
+
+ def inspect # :nodoc:
+ "#<%s:0x%x %s %p>" % [
+ self.class, object_id,
+ @sequence, title
+ ]
+ end
+
+ ##
+ # Set the comment for this section from the original comment block If
+ # the first line contains :section:, strip it and use the rest.
+ # Otherwise remove lines up to the line containing :section:, and look
+ # for those lines again at the end and remove them. This lets us write
+ #
+ # # blah blah blah
+ # #
+ # # :SECTION: The title
+ # # The body
+
+ def set_comment(comment)
+ return unless comment
+
+ if comment =~ /^#[ \t]*:section:.*\n/ then
+ start = $`
+ rest = $'
+
+ if start.empty?
+ @comment = rest
+ else
+ @comment = rest.sub(/#{start.chomp}\Z/, '')
+ end
+ else
+ @comment = comment
+ end
+
+ @comment = nil if @comment.empty?
+ end
+
+ end
+
+ ##
+ # Creates an unnamed empty context with public visibility
+
+ def initialize
+ super
+
+ @in_files = []
+
+ @name ||= "unknown"
+ @comment ||= ""
+ @parent = nil
+ @visibility = :public
+
+ @current_section = Section.new self, nil, nil
+ @sections = [@current_section]
+
+ initialize_methods_etc
+ initialize_classes_and_modules
+ end
+
+ ##
+ # Sets the defaults for classes and modules
+
+ def initialize_classes_and_modules
+ @classes = {}
+ @modules = {}
+ end
+
+ ##
+ # Sets the defaults for methods and so-forth
+
+ def initialize_methods_etc
+ @method_list = []
+ @attributes = []
+ @aliases = []
+ @requires = []
+ @includes = []
+ @constants = []
+
+ # This Hash maps a method name to a list of unmatched aliases (aliases of
+ # a method not yet encountered).
+ @unmatched_alias_lists = {}
+ end
+
+ ##
+ # Contexts are sorted by full_name
+
+ def <=>(other)
+ full_name <=> other.full_name
+ end
+
+ ##
+ # Adds +an_alias+ that is automatically resolved
+
+ def add_alias(an_alias)
+ meth = find_instance_method_named(an_alias.old_name)
+
+ if meth then
+ add_alias_impl an_alias, meth
+ else
+ add_to @aliases, an_alias
+ unmatched_alias_list = @unmatched_alias_lists[an_alias.old_name] ||= []
+ unmatched_alias_list.push an_alias
+ end
+
+ an_alias
+ end
+
+ ##
+ # Adds +an_alias+ pointing to +meth+
+
+ def add_alias_impl(an_alias, meth)
+ new_meth = RDoc::AnyMethod.new an_alias.text, an_alias.new_name
+ new_meth.is_alias_for = meth
+ new_meth.singleton = meth.singleton
+ new_meth.params = meth.params
+ new_meth.comment = "Alias for \##{meth.name}"
+ meth.add_alias new_meth
+ add_method new_meth
+ end
+
+ ##
+ # Adds +attribute+
+
+ def add_attribute(attribute)
+ add_to @attributes, attribute
+ end
+
+ ##
+ # Adds a class named +name+ with +superclass+.
+ #
+ # Given <tt>class Container::Item</tt> RDoc assumes +Container+ is a module
+ # unless it later sees <tt>class Container</tt>. add_class automatically
+ # upgrades +name+ to a class in this case.
+
+ def add_class(class_type, name, superclass = 'Object')
+ klass = add_class_or_module @classes, class_type, name, superclass
+
+ # If the parser encounters Container::Item before encountering
+ # Container, then it assumes that Container is a module. This may not
+ # be the case, so remove Container from the module list if present and
+ # transfer any contained classes and modules to the new class.
+
+ RDoc::TopLevel.lock.synchronize do
+ mod = RDoc::TopLevel.modules_hash.delete klass.full_name
+
+ if mod then
+ klass.classes_hash.update mod.classes_hash
+ klass.modules_hash.update mod.modules_hash
+ klass.method_list.concat mod.method_list
+
+ @modules.delete klass.name
+ end
+
+ RDoc::TopLevel.classes_hash[klass.full_name] = klass
+ end
+
+ klass
+ end
+
+ ##
+ # Instantiates a +class_type+ named +name+ and adds it the modules or
+ # classes Hash +collection+.
+
+ def add_class_or_module(collection, class_type, name, superclass = nil)
+ full_name = if RDoc::TopLevel === self then # HACK
+ name
+ else
+ "#{self.full_name}::#{name}"
+ end
+ mod = collection[name]
+
+ if mod then
+ mod.superclass = superclass unless mod.module?
+ else
+ all = nil
+
+ RDoc::TopLevel.lock.synchronize do
+ all = if class_type == RDoc::NormalModule then
+ RDoc::TopLevel.modules_hash
+ else
+ RDoc::TopLevel.classes_hash
+ end
+
+ mod = all[full_name]
+ end
+
+ unless mod then
+ mod = class_type.new name, superclass
+ else
+ # If the class has been encountered already, check that its
+ # superclass has been set (it may not have been, depending on the
+ # context in which it was encountered).
+ if class_type == RDoc::NormalClass then
+ mod.superclass = superclass unless mod.superclass
+ end
+ end
+
+ unless @done_documenting then
+ RDoc::TopLevel.lock.synchronize do
+ all[full_name] = mod
+ end
+ collection[name] = mod
+ end
+
+ mod.section = @current_section
+ mod.parent = self
+ end
+
+ mod
+ end
+
+ ##
+ # Adds +constant+
+
+ def add_constant(constant)
+ add_to @constants, constant
+ end
+
+ ##
+ # Adds included module +include+
+
+ def add_include(include)
+ add_to @includes, include
+ end
+
+ ##
+ # Adds +method+
+
+ def add_method(method)
+ method.visibility = @visibility
+ add_to @method_list, method
+
+ unmatched_alias_list = @unmatched_alias_lists[method.name]
+ if unmatched_alias_list then
+ unmatched_alias_list.each do |unmatched_alias|
+ add_alias_impl unmatched_alias, method
+ @aliases.delete unmatched_alias
+ end
+
+ @unmatched_alias_lists.delete method.name
+ end
+ end
+
+ ##
+ # Adds a module named +name+. If RDoc already knows +name+ is a class then
+ # that class is returned instead. See also #add_class
+
+ def add_module(class_type, name)
+ return @classes[name] if @classes.key? name
+
+ add_class_or_module @modules, class_type, name, nil
+ end
+
+ ##
+ # Adds +require+ to this context's top level
+
+ def add_require(require)
+ if RDoc::TopLevel === self then
+ add_to @requires, require
+ else
+ parent.add_require require
+ end
+ end
+
+ ##
+ # Adds +thing+ to the collection +array+
+
+ def add_to(array, thing)
+ array << thing if @document_self and not @done_documenting
+ thing.parent = self
+ thing.section = @current_section
+ end
+
+ ##
+ # Array of classes in this context
+
+ def classes
+ @classes.values
+ end
+
+ ##
+ # All classes and modules in this namespace
+
+ def classes_and_modules
+ classes + modules
+ end
+
+ ##
+ # Hash of classes keyed by class name
+
+ def classes_hash
+ @classes
+ end
+
+ ##
+ # Is part of this thing was defined in +file+?
+
+ def defined_in?(file)
+ @in_files.include?(file)
+ end
+
+ ##
+ # Iterator for attributes
+
+ def each_attribute # :yields: attribute
+ @attributes.each {|a| yield a}
+ end
+
+ ##
+ # Iterator for classes and modules
+
+ def each_classmodule(&block) # :yields: module
+ classes_and_modules.sort.each(&block)
+ end
+
+ ##
+ # Iterator for constants
+
+ def each_constant # :yields: constant
+ @constants.each {|c| yield c}
+ end
+
+ ##
+ # Iterator for included modules
+
+ def each_include # :yields: include
+ @includes.each do |i| yield i end
+ end
+
+ ##
+ # Iterator for methods
+
+ def each_method # :yields: method
+ @method_list.sort.each {|m| yield m}
+ end
+ </