generate_file_files()
public
Generate a documentation file for each file
Show source
def generate_file_files
setup
page_file = @template_dir + 'page.rhtml'
fileinfo_file = @template_dir + 'fileinfo.rhtml'
filepage_file = @template_dir + 'filepage.rhtml' unless
page_file.exist? or fileinfo_file.exist?
return unless
page_file.exist? or fileinfo_file.exist? or filepage_file.exist?
debug_msg "Generating file documentation in #{@outputdir}"
out_file = nil
current = nil
@files.each do |file|
current = file
if file.text? and page_file.exist? then
generate_page file
next
end
template_file = nil
out_file = @outputdir + file.path
debug_msg " working on %s (%s)" % [file.full_name, out_file]
rel_prefix = @outputdir.relative_path_from out_file.dirname
search_index_rel_prefix = rel_prefix
search_index_rel_prefix += @asset_rel_path if @file_output
asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path
unless filepage_file then
if file.text? then
next unless page_file.exist?
template_file = page_file
@title = file.page_name
else
next unless fileinfo_file.exist?
template_file = fileinfo_file
@title = "File: #{file.base_name}"
end
end
@title += " - #{@options.title}"
template_file ||= filepage_file
render_template template_file, out_file do |io| binding end
end
rescue => e
error =
RDoc::Error.new "error generating #{out_file}: #{e.message} (#{e.class})"
error.set_backtrace e.backtrace
raise error
end