11#!ruby
2- #
3- # Darkfish RDoc HTML Generator
4- # $Id: darkfish.rb 35 2008-09-22 15:14:43Z deveiant $
5- #
6- # Author: Michael Granger <[email protected] > 7- #
8- # == License
9- #
10- # Copyright (c) 2007, 2008, The FaerieMUD Consortium
11- # All rights reserved.
12- #
13- # Permission is hereby granted, free of charge, to any person obtaining a copy
14- # of this software and associated documentation files (the "Software"), to deal
15- # in the Software without restriction, including without limitation the rights
16- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17- # copies of the Software, and to permit persons to whom the Software is
18- # furnished to do so, subject to the following conditions:
19- #
20- # The above copyright notice and this permission notice shall be included in
21- # all copies or substantial portions of the Software.
22- #
23- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29- # THE SOFTWARE.
30- #
312
323require 'rubygems'
33- gem 'rdoc' , '>= 2.0.0 '
4+ gem 'rdoc' , '>= 2.3 '
345
356require 'pp'
367require 'pathname'
4213require 'rdoc/generator/xml'
4314require 'rdoc/generator/html'
4415
45- ### A erb-based RDoc HTML generator
16+ #
17+ # Darkfish RDoc HTML Generator
18+ #
19+ # $Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
20+ #
21+ # == Author/s
22+ # * Michael Granger ([email protected] ) 23+ #
24+ # == Contributors
25+ # * Mahlon E. Smith ([email protected] ) 26+ # * Eric Hodel ([email protected] ) 27+ #
28+ # == License
29+ #
30+ # Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
31+ #
32+ # Redistribution and use in source and binary forms, with or without
33+ # modification, are permitted provided that the following conditions are met:
34+ #
35+ # * Redistributions of source code must retain the above copyright notice,
36+ # this list of conditions and the following disclaimer.
37+ #
38+ # * Redistributions in binary form must reproduce the above copyright notice,
39+ # this list of conditions and the following disclaimer in the documentation
40+ # and/or other materials provided with the distribution.
41+ #
42+ # * Neither the name of the author/s, nor the names of the project's
43+ # contributors may be used to endorse or promote products derived from this
44+ # software without specific prior written permission.
45+ #
46+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
49+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
50+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
52+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
53+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56+ #
4657class RDoc ::Generator ::Darkfish < RDoc ::Generator ::XML
4758
48- RDoc ::RDoc . add_generator self
59+ RDoc ::RDoc . add_generator ( self )
4960
5061 include ERB ::Util
5162
5263 # Subversion rev
53- SVNRev = %$Rev: 35 $
64+ SVNRev = %$Rev: 52 $
5465
5566 # Subversion ID
56- SVNId = %$Id: darkfish.rb 35 2008-09-22 15:14:43Z deveiant $
67+ SVNId = %$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $
5768
5869 # Path to this file's parent directory. Used to find templates and other
5970 # resources.
6071 GENERATOR_DIR = Pathname . new ( __FILE__ ) . expand_path . dirname
6172
6273 # Release Version
63- VERSION = '1.1.5'
74+ VERSION = '1.1.6'
75+
76+ # Directory where generated classes live relative to the root
77+ CLASS_DIR = nil
78+
79+ # Directory where generated files live relative to the root
80+ FILE_DIR = nil
6481
6582
6683 #################################################################
@@ -78,7 +95,7 @@ def self::for( options )
7895 #################################################################
7996
8097 ### Initialize a few instance variables before we start
81- def initialize ( options )
98+ def initialize ( options )
8299 @template = nil
83100 @template_dir = GENERATOR_DIR + 'template/darkfish'
84101
@@ -170,8 +187,7 @@ def generate_xhtml( options, files, classes )
170187 # Make a hash of file info keyed by path
171188 files_by_path = files . inject ( { } ) { |hash , fileinfo |
172189 hash [ fileinfo [ :full_path ] ] = fileinfo
173- hash [ fileinfo [ :full_path ] ] [ :outfile ] =
174- fileinfo [ :full_path ] + '.html'
190+ hash [ fileinfo [ :full_path ] ] [ :outfile ] = fileinfo [ :full_path ] + '.html'
175191 hash
176192 }
177193
@@ -261,6 +277,7 @@ def generate_class_files( options, files, classes )
261277 rel_prefix = outputdir . relative_path_from ( outfile . dirname )
262278 svninfo = self . get_svninfo ( classinfo )
263279
280+ debug_msg " rendering #{ outfile } "
264281 self . render_template ( templatefile , binding ( ) , outfile )
265282 end
266283 end
@@ -272,13 +289,15 @@ def generate_file_files( options, files, classes )
272289 debug_msg "Generating file documentation in #@outputdir "
273290 templatefile = @template_dir + 'filepage.rhtml'
274291
292+ modsort = self . get_sorted_module_list ( classes )
293+
275294 files . sort_by { |k , v | k } . each do |path , fileinfo |
276295 outfile = @outputdir + fileinfo [ :outfile ]
277296 debug_msg " working on %s (%s)" % [ path , outfile ]
278297 rel_prefix = @outputdir . relative_path_from ( outfile . dirname )
279298 context = binding ( )
280299
281- debug_msg " rending #{ outfile } "
300+ debug_msg " rendering #{ outfile } "
282301 self . render_template ( templatefile , binding ( ) , outfile )
283302 end
284303 end
@@ -301,7 +320,7 @@ def time_delta_string( seconds )
301320 end
302321
303322
304- # %q$Id: darkfish.rb 35 2008-09-22 15:14:43Z deveiant $"
323+ # %q$Id: darkfish.rb 52 2009-01-07 02:08:11Z deveiant $"
305324 SVNID_PATTERN = /
306325 \$ Id:\s
307326 (\S +)\s # filename
0 commit comments