Class: RDoc::Generator::Darkfish
- Inherits:
-
XML
- Object
- XML
- RDoc::Generator::Darkfish
- Includes:
- ERB::Util
- Defined in:
- lib/rdoc/generator/darkfish.rb
Overview
A erb-based RDoc HTML generator
Constant Summary collapse
- SVNRev =
Subversion rev
%$Rev: 24 $- SVNId =
Subversion ID
%$Id: darkfish.rb 24 2008-08-14 00:59:07Z deveiant $- GENERATOR_DIR =
Path to this file’s parent directory. Used to find templates and other resources.
Pathname.new( __FILE__ )..dirname
- VERSION =
Darkfish Version (update this in )
'1.1.2'
Instance Attribute Summary collapse
-
#outputdir ⇒ Object
readonly
The output directory.
Class Method Summary collapse
-
.for(options) ⇒ Object
Standard generator factory method.
Instance Method Summary collapse
-
#debug_msg(*msg) ⇒ Object
Output progress information if debugging is enabled.
-
#gen_sub_directories ⇒ Object
Create the directories the generated docs will live in if they don’t already exist.
-
#generate(toplevels) ⇒ Object
Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information.
-
#generate_xhtml(options, files, classes) ⇒ Object
Generate output.
-
#initialize(*args) ⇒ Darkfish
constructor
Initialize a few instance variables before we start.
-
#load_html_template ⇒ Object
No-opped.
-
#write_style_sheet ⇒ Object
Copy over the stylesheet into the appropriate place in the output directory.
Constructor Details
#initialize(*args) ⇒ Darkfish
Initialize a few instance variables before we start
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rdoc/generator/darkfish.rb', line 79 def initialize( *args ) @template = nil @template_dir = GENERATOR_DIR + 'template/darkfish' @files = [] @classes = [] @hyperlinks = {} @basedir = Pathname.pwd. super end |
Instance Attribute Details
#outputdir ⇒ Object (readonly)
The output directory
98 99 100 |
# File 'lib/rdoc/generator/darkfish.rb', line 98 def outputdir @outputdir end |
Class Method Details
.for(options) ⇒ Object
Standard generator factory method
69 70 71 |
# File 'lib/rdoc/generator/darkfish.rb', line 69 def self::for( ) new( ) end |
Instance Method Details
#debug_msg(*msg) ⇒ Object
Output progress information if debugging is enabled
102 103 104 105 |
# File 'lib/rdoc/generator/darkfish.rb', line 102 def debug_msg( *msg ) return unless $DEBUG $stderr.puts( *msg ) end |
#gen_sub_directories ⇒ Object
Create the directories the generated docs will live in if they don’t already exist.
110 111 112 |
# File 'lib/rdoc/generator/darkfish.rb', line 110 def gen_sub_directories @outputdir.mkpath end |
#generate(toplevels) ⇒ Object
Build the initial indices and output objects based on an array of TopLevel objects containing the extracted information.
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/rdoc/generator/darkfish.rb', line 130 def generate( toplevels ) @outputdir = Pathname.new( .op_dir ).( @basedir ) @files, @classes = RDoc::Generator::Context.build_indicies( toplevels, ) # Now actually write the output generate_xhtml( , @files, @classes ) rescue StandardError => err debug_msg "%s: %s\n %s" % [ err.class.name, err., err.backtrace.join("\n ") ] raise end |
#generate_xhtml(options, files, classes) ⇒ Object
Generate output
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/rdoc/generator/darkfish.rb', line 149 def generate_xhtml( , files, classes ) files = gen_into( @files ) classes = gen_into( @classes ) # Make a hash of class info keyed by class name classes_by_classname = classes.inject({}) {|hash, classinfo| hash[ classinfo['full_name'] ] = classinfo hash[ classinfo['full_name'] ][:outfile] = classinfo['full_name'].gsub( /::/, '/' ) + '.html' hash } # Make a hash of files_by_path = files.inject({}) {|hash, fileinfo| hash[ fileinfo['full_path'] ] = fileinfo hash[ fileinfo['full_path'] ][:outfile] = fileinfo['full_path'] + '.html' hash } self.write_style_sheet self.generate_index( , files_by_path, classes_by_classname ) self.generate_class_files( , files_by_path, classes_by_classname ) self.generate_file_files( , files_by_path, classes_by_classname ) end |
#load_html_template ⇒ Object
No-opped
144 145 |
# File 'lib/rdoc/generator/darkfish.rb', line 144 def load_html_template # :nodoc: end |
#write_style_sheet ⇒ Object
Copy over the stylesheet into the appropriate place in the output directory.
117 118 119 120 121 122 123 |
# File 'lib/rdoc/generator/darkfish.rb', line 117 def write_style_sheet debug_msg "Copying over static files" staticfiles = %w[rdoc.css js images] staticfiles.each do |path| FileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG ) end end |