rdoc: how to generate rdoc & ri documentation of standard library?

A

Andreas Schwarz

Hi,

how can I generate rdoc & ri documentation of the standard library? I
tried "cd /usr/local/lib/ruby; rdoc", but had to cancel it because rdoc
tried eating up all my RAM (120MB when I killed it). Is this normal, or
am I doing something wrong?

Andreas
 
D

Dave Thomas

how can I generate rdoc & ri documentation of the standard library? I
tried "cd /usr/local/lib/ruby; rdoc", but had to cancel it because rdoc
tried eating up all my RAM (120MB when I killed it). Is this normal, or
am I doing something wrong?

If you just let it run in the standard library, it will document
absolutely everything it finds (which is probably not what you want, as
most of the larger library modules have tons of internal classes and
methods which don't really belong in the documentation). I ran that
here last night, and it took about 15 minutes to complete.

To get something more meaningful, start in the Ruby source tree (not
the installed library) and issue the command

rdoc --ri *.c lib/*.rb

That will document (in ri form) the built-in functions and all the
direct standard library classes. It'll take a minute or two, but when
it's done, you'll be able to say

ri Array
ri CGI
ri Tempfile::eek:pen

and so on. In fact, on my box, you'll have at least some kind of
documentation for 325 classes and 2300 methods.

To get standard rdoc documentation in HTML format, run command

rdoc --op <somedir> *.c lib/*.rb

If you're on a Unix box, I recommend using the prettier output:

export LESS="-REX" # allow escape sequences through
ri -f ansi Array


STANDARD DISCLAIMER:

This is still a work in progress. Many of the library files have not
yet been documented in RDoc format. Some of the constructs in these
files cause RDoc to issue warnings. We're working on it.


Cheers

Dave
 
A

Andreas Schwarz

Dave said:
To get something more meaningful, start in the Ruby source tree (not
the installed library) and issue the command

rdoc --ri *.c lib/*.rb

That will document (in ri form) the built-in functions and all the
direct standard library classes. It'll take a minute or two, but when
it's done, you'll be able to say

ri Array
ri CGI
ri Tempfile::eek:pen

Ok, thanks. Where do I have to put the ri data to make it available to
all users? I tried "rdoc -o -o /usr/local/share/ri/1.8/system ...", but
rdoc still wrote the data to /root/.ri/.

Maybe it would make sense to add a ri rule to the ruby makefile?

Andreas
 
T

ts

A> Ok, thanks. Where do I have to put the ri data to make it available to
A> all users? I tried "rdoc -o -o /usr/local/share/ri/1.8/system ...", but
A> rdoc still wrote the data to /root/.ri/.

rdoc --help can be helpfull :)

svg% rdoc --help

RDoc V1.0pr1: 2003/12/01 07:12:48 (1.1)

[...]
--ri-site, -R generate output for use by 'ri.' The files are
stored in a site-wide directory, making them accessible
to others, so special privileges are needed.

[...]
svg%


Guy Decoux
 
I

Ian Macdonald

To get something more meaningful, start in the Ruby source tree (not
the installed library) and issue the command

rdoc --ri *.c lib/*.rb

That will document (in ri form) the built-in functions and all the
direct standard library classes. It'll take a minute or two, but when
it's done, you'll be able to say

ri Array
ri CGI
ri Tempfile::eek:pen

If I issue the command line above, I get class entries for Array and
Hash (and probably others) that contain no methods. If I amend the
command line to 'rdoc --ri *.c' (i.e. excluding 'lib/*.rb'), the Array
and Hash entries get populated with their methods.

A bug?

Ian
--
Ian Macdonald | Natural laws have no pity.
System Administrator |
(e-mail address removed) |
http://www.caliban.org |
|
 
D

Dave Thomas

If I issue the command line above, I get class entries for Array and
Hash (and probably others) that contain no methods. If I amend the
command line to 'rdoc --ri *.c' (i.e. excluding 'lib/*.rb'), the Array
and Hash entries get populated with their methods.

A bug?

Hmm.. Perhaps, but not in RDoc, exactly... The class TSort extends
class Array, but flags it :nodoc: so it doesn't get documented
internally. tsort should probably have used stopdoc instead.


Cheers

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top