Recipe 15.21. Documenting Your Web SiteProblemYou want to document the controllers, models, and helpers of your web application so that the developers responsible for maintaining the application can understand how it works. SolutionAs with any other Ruby program, you document a Rails application by adding specially-formatted commands to your code. Here's how to add
The When you've finished adding documentation comments to your application, go to your Rails application's root directory and issue the rake appdoc command:
This Rake task runs RDoc for your Rails application and generates a directory called doc/app. This directory contains a DiscussionYour RDoc comments can contain markup and special directives: you can describe your arguments in definition lists, and hide a class or method from documentation with the :nodoc: directive. This is covered in Recipe 17.11. The only difference between Rails applications and other Ruby programs is that Rails comes with a Rakefile that defines an appdoc task. You don't have to find or write one yourself. You probably already put inline comments inside your methods, describing the action as it happens. Since the RDoc documentation contains a formatted version of the original source code, these comments will be visible to people going through the RDoc. These comments are formatted as Ruby source code, though, not as RDoc markup. See Also
|
Sunday, October 25, 2009
Recipe 15.21. Documenting Your Web Site
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment