Browsing gem docs

This little script generates a simple web page containing a table of
(name, title, link-to-rdocs) for each installed gem. Could something
like this be incorporated into gem so that each time a gem is installed
you get a nice links page?

#!/usr/bin/env ruby

require "amrita/template"
include Amrita

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

tmpl = TemplateText.new <<END
<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.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

This little script generates a simple web page containing a table of
(name, title, link-to-rdocs) for each installed gem. Could something
like this be incorporated into gem so that each time a gem is installed
you get a nice links page?

Try:

gem_server

from your shell. By default it listen on port 8808 (try
http://machine.with.gems:8808/ in
your browser)

···

On 8/1/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

Stoyan Zhekov wrote:

This little script generates a simple web page containing a table of
(name, title, link-to-rdocs) for each installed gem. Could something
like this be incorporated into gem so that each time a gem is installed
you get a nice links page?

Try:

gem_server

from your shell. By default it listen on port 8808 (try
http://machine.with.gems:8808/ in
your browser)

Very nice, but why does it depend on a web server? It's just a static
page, AFAICT. Does it do something more?

I'd really just like to have a bookmark in my browser so I can quickly
go to all my installed gem docs. Running a server to do that seems a
little excessive....

But at least now I realize I should have used gemspec files as input
rather than regexes.

···

On 8/1/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

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

Chad Fowler wrote:

gem_server also allows you to serve gems (not just docs), so you can
use a gem_server as a remote gem source. That's why the web server is
there.

AH, great! The remote gem source functionality is something I remember
asking for a while back. Thanks!

I'll add the static docs links page to the TODO list.

Ok, low priority for me.

···

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