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.
I.e.
ruby gem_rdoc_indexer.rb
creates file all_gems_rdocs.html
with contents
···
---------------
All installed gems: (core)
abstract-1.0.0: homepage (no rdoc)
actionmailer-1.3.3: homepage rdoc README
....
with links to the rdoc's and README's.
example output file:
http://ruby-roger-useful-functions.googlecode.com/svn/trunk/gem_rdocs_indexer/all_gems_rdocs_index.html
how to get:
code:
http://ruby-roger-useful-functions.googlecode.com/svn/trunk/gem_rdocs_indexer/gem_rdoc_indexer.rb
Any feedback welcome.
Question: is there a designated place where rdoc's for the core lib's
are installed, locally?
Also, is it possible to get the specs for say version 1.0 of a gem, and
also the specs for version 2.0? Currently this isn't handled perfectly.
Thanks!
-R
--
Posted via http://www.ruby-forum.com/.
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 <<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)
puts "rebuilding fast-ri index..."
system "fastri-server -Bb"
puts "done"
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
How is this different from running `gem server` and navigating to that URL in your browser?
···
On Jul 7, 2008, at 14:44 PM, 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.
Eric Hodel 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.
How is this different from running `gem server` and navigating to that
URL in your browser?
In all honesty, I didn't know gem server existed, and, also honestly, it
didn't make sense for me that gem server would be necessary for browsing
an index of rdoc's.
My 'wish' would be something like this run automatically after
installing new rdoc's:
gem install package
...
package installed
updated index gem_rdoc_index.html
It just makes more sense than having to run a server to browse rdoc's.
Thoughts?
I'd be happy to code it up as a patch
-R
···
On Jul 7, 2008, at 14:44 PM, Roger Pack wrote:
--
Posted via http://www.ruby-forum.com/\.
How is this different from running `gem server` and navigating to that
URL in your browser?
In all honesty, I didn't know gem server existed, and, also honestly, it
didn't make sense for me that gem server would be necessary for browsing
an index of rdoc's.
Also it has a link to the README, which is nice. Typically maintainers
show their README in the rdoc's index with their own rdoc's, but don't
set it up that way for the gem, for some reason.
-R
···
--
Posted via http://www.ruby-forum.com/\.
`gem server` is already a well-known way to access documentation. It provides a --daemon option so you can start it and forget about it. (It updates itself as new gems are installed.)
This is an entirely new way of accessing the same information that isn't going to be well-known. Furthermore, the path to this file is either going to be in an obscure location to support multiple users, or only accessible by one user.
I don't want to maintain two different ways of accessing the same information.
···
On Jul 7, 2008, at 15:27 PM, Roger Pack wrote:
Eric Hodel wrote:
On Jul 7, 2008, at 14:44 PM, 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.
How is this different from running `gem server` and navigating to that
URL in your browser?
In all honesty, I didn't know gem server existed, and, also honestly, it
didn't make sense for me that gem server would be necessary for browsing
an index of rdoc's.
My 'wish' would be something like this run automatically after
installing new rdoc's:
gem install package
...
package installed
updated index gem_rdoc_index.html
It just makes more sense than having to run a server to browse rdoc's.
Thoughts?
I'd be happy to code it up as a patch
Eric Hodel wrote:
This is an entirely new way of accessing the same information that
isn't going to be well-known. Furthermore, the path to this file is
either going to be in an obscure location to support multiple users,
or only accessible by one user.
I don't want to maintain two different ways of accessing the same
information.
For the single user at home, this is an ideal solution. I have no desire
to use gem server just to view RDOCs. Robert, your code works like
a charm and I think it is extremely useful. Thanks so much for sharing.
vince
···
--
Posted via http://www.ruby-forum.com/\.
`gem server` is already a well-known way to access documentation. It
provides a --daemon option so you can start it and forget about it.
(It updates itself as new gems are installed.)
Yeah that works too. Either way is fine. My personal preference is the
more light weight one. If it were up to me I'd deprecate the server and
go more in that direction.
But that's just me.
Some clarifying thoughts:
Twould be nice to have a link there to the code itself, as well as the
rdoc's [for perusal], and the README's. And to the normal rdoc's for
ruby should they happen to be installed.
Thanks!
-R
···
--
Posted via http://www.ruby-forum.com/\.
You do realize that gem server that serves up the docs is just a
simple WEBrick server right? I use it all the time. It's super
simple to crank up and kill off.
But to each his own.
--Jeremy
···
On Tue, Jul 8, 2008 at 8:03 PM, Vince Angeloni <nospam7272@mac.com> wrote:
Eric Hodel wrote:
This is an entirely new way of accessing the same information that
isn't going to be well-known. Furthermore, the path to this file is
either going to be in an obscure location to support multiple users,
or only accessible by one user.
I don't want to maintain two different ways of accessing the same
information.
For the single user at home, this is an ideal solution. I have no desire
to use gem server just to view RDOCs. Robert, your code works like
a charm and I think it is extremely useful. Thanks so much for sharing.
vince
--
Posted via http://www.ruby-forum.com/\.
--
http://jeremymcanally.com/
http://entp.com
Read my books:
Ruby in Practice (http://manning.com/mcanally/\)
My free Ruby e-book (http://humblelittlerubybook.com/\)
Or, my blogs:
http://rubyinpractice.com
Some clarifying thoughts:
Twould be nice to have a link there to the code itself, as well as the
rdoc's [for perusal], and the README's. And to the normal rdoc's for
ruby should they happen to be installed.
Twould be nice to have some access to any existing 'changelog', too,
from gem server, and also to the unpacked gem files themselves [which
would satisfy that]. Not sure if that's possible.
-=R
···
--
Posted via http://www.ruby-forum.com/\.