为Rails应用程序创建Rdoc [英] creating Rdoc for a rails app

查看:87
本文介绍了为Rails应用程序创建Rdoc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的rails(2.3.8)项目生成一个文档.当我尝试

I would like to generate a documentation to my rails (2.3.8) project. When I tried

rake doc:rails
rake doc:rerails

它为所有类创建文档,包括标准ruby类和供应商目录(插件等)中的所有ruby文件.

It creates documentation for all the classes including standard ruby classes and all the ruby files in vendor directory (plugins etc..)

如何仅为ruby类和以下目录中的文件创建rdoc文档

How can I create rdoc documentation only for ruby classes, files in following directories

  1. 应用程序文件夹(所有模型,控制器和视图)
  2. 配置文件夹
  3. lib文件夹

推荐答案

我将此添加到了Rakefile;

I added this to my Rakefile;

RDoc::Task.new :rdoc do |rdoc|
  rdoc.main = "README.rdoc"

  rdoc.rdoc_files.include("README.rdoc", "doc/*.rdoc", "app/**/*.rb", "lib/*.rb", "config/**/*.rb")
  #change above to fit needs

  rdoc.title = "App Documentation"
  rdoc.options << "--all" 
end

然后运行;

rake rdoc

查看RDoc :: Task文档以获取更多 http://rdoc.rubyforge.org/RDoc/Task.html

Check out the RDoc::Task docs for more http://rdoc.rubyforge.org/RDoc/Task.html

诚然,我使用的是Rails 3应用程序,但我认为它的工作原理相同.

Admittedly I am on a rails 3 app, but I think this works the same.

这篇关于为Rails应用程序创建Rdoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆