From: Joel VanderWerf Date: 2008-07-08T07:08:19+09:00 Subject: Re: ruby gems doc indexer Roger Pack wrote: > Don't know if this would be useful for anyone, but I wrote a utility to > create an html index of the rdoc's of installed rubygems on your system. Nice to have direct links to the home page, as well as local docs. That's a missing feature in my own indexer, but I like the table in mine. (Yes, I know about gem server.) Feel free to adapt from the following (which I run every so often after updating gems). The title field is not very useful, because most rdoc users don't know about that option. require "amrita/template" include Amrita Dir.chdir "/usr/local/lib/ruby/gems/1.8/doc" tmpl = TemplateText.new <Gem Docs
NameTitleGem Docs
END links = Dir['*/rdoc/index.html'] linkdata = links.sort_by{|s|s.downcase}.map do |link| { :name => link[/(.*?)\//,1], :title => File.open(link).grep(//)[0][/<title>(.*?)<\/title>/,1], :gemdocs => a(:href=>link) { link } } end data = { :table1 => linkdata } tmpl.prettyprint = true tmpl.expand(File.open("index.html", "w"), data) puts "rebuilding fast-ri index..." system "fastri-server -Bb" puts "done" -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407