2.7. What's Up, RDoc?
One problem with developing against Edge Rails is that the online documentation repositories are no longer accurate. Luckily all the Rails documentation is generated automatically, and it's a snap to regenerate it locally for your purposes. You can do this with the following Rake command:
$rake doc:rails
However, if you'd like more control over the process, all you need to do is invoke the RDoc generator with some appropriate options. From the top-level directory of your Rails project, run the following command:
$ rdoc --op doc/apidocs/ -x test/ -x /railties/lib/rails_generator/ generators/components/controller/templates/controller.rb --all -- tab-width 2 --title 'Rails Edge API documentation'
This one will crank for as much as 5 to 10 minutes, depending on how powerful your computer is. The following table describes what you've done.
Command Option | Description |
---|---|
--op doc/apidocs | Creates an output directory. If an output directory already exists that RDoc doesn't recognize as an rdoc directory, it will halt. |
-x test | Excludes the vendor/test directory. You can have more than one -x flag in the command if there are several things you don't want documented. The second flag, /railties/lib/rails_generator/generators/components/controller/templates/controller.rb, removes ... |
Get Professional Ruby on Rails™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.