[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

rdoc/ri feature request

John Joyce

12/1/2007 6:10:00 PM

I know it's selfish, but...
I would like rdoc to have the ability to build a landing page/portal
locally accessible in a browser.
That way there would be quick, easy to navigate docs available from
one aggregate place.
In addition to this, the ability to configure it to rebuild at
intervals/events. For example, after a gem is installed, or every
Monday morning at 3:00 would be convenient. Ideally, this would be
daemonized and maybe simply take advantage of platform-available
tools (such as chron on *nix's and whatever is available on Windows).

1 Answer

Joel VanderWerf

12/1/2007 7:51:00 PM

0

John Joyce wrote:
> I know it's selfish, but...
> I would like rdoc to have the ability to build a landing page/portal
> locally accessible in a browser.
> That way there would be quick, easy to navigate docs available from one
> aggregate place.
> In addition to this, the ability to configure it to rebuild at
> intervals/events. For example, after a gem is installed, or every Monday
> morning at 3:00 would be convenient. Ideally, this would be daemonized
> and maybe simply take advantage of platform-available tools (such as
> chron on *nix's and whatever is available on Windows).

There's the gem server ("gem help server" for details), but I prefer a
static page, so I just do the following after updating or installing
gems and cleanup:

$ cat gem-update-docs
#!/usr/bin/env ruby

require "amrita/template"
include Amrita

Dir.chdir "/usr/local/lib/ruby/gems/1.8/doc"

tmpl = TemplateText.new <<END
<title>Gem Docs</title>
<table border="1">
<tr><th>Name</th><th>Title</th><th>Gem Docs</tr>
<tr id=table1>
<td id="name"></td>
<td id="title"></td>
<td><a id="gemdocs"></a></td>
</tr>
</table>
END

links = Dir['*/rdoc/index.html']

linkdata = links.sort_by{|s|s.downcase}.map do |link|
{
:name => link[/(.*?)\//,1],
:title =>
File.open(link).grep(/<title>/)[0][/<title>(.*?)<\/title>/,1],
:gemdocs => a(:href=>link) { link }
}
end

data = {
:table1 => linkdata
}

tmpl.prettyprint = true
tmpl.expand(File.open("index.html", "w"), data)

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407