Documentation for the plugins you use


#1

I wanted a concise way to see the rdocs for all the plugins I use in my
project. I threw together a quick program to generate it for me, and I
thought you guys might be interested. It creates a plugins.html in your
application’s root directory, with links to rdoc that it generates in
each plugin’s own directory. I just added a frame to the rdoc-generated
index.html in my own project and pointed it to this plugins.html.

I put this script in my application’s scripts directory and invoke it
with:

ruby script/document_plugins

Regards,

Jeff

document_plugins.rb:

require ‘rdoc/rdoc’

dir = Dir.new(“vendor/plugins”)
outfile = File.new(“plugins.html”, “w”)
file_start=<<‘FILESTART’

<?xml version="1.0" encoding="iso-8859-1"?> Plugins

Plugins

FILESTART

outfile.write(file_start)

Dir.glob(“vendor/plugins/*”).each do |relPath|
plugin = File.split(relPath).last
puts relPath + “, " + plugin
outfile.write(” <a href="#{relPath}/doc/rdoc/index.html"
target="_plugins">#{plugin}
\n");

origDir = Dir.pwd
begin
Dir.chdir(relPath)
r = RDoc::RDoc.new
r.document ["–op",“doc/rdoc”, “-S”, “–main”, “README”] +
Dir.glob("*")

rescue RDoc::RDocError => e
  $stderr.puts e.message
ensure
  Dir.chdir origDir
end

end

file_end=<<‘FILEEND’

FILEEND

outfile.write(file_end)


end of document_plugins.rb

index.html (add to project’s root directory)

<?xml version="1.0" encoding="iso-8859-1"?> RDoc Documentation Click here for a non-frames version of this page.