我正在使用 Ruby on Rails 3.0.7,我想安装并使用新的 RDoc 模板(而不是默认模板)来记录我的应用程序。
我想选择以下其中一项:
所以,
- 我在哪里可以获得上述模板之一吗?
- 我怎样才能安装它?
- 我应该在
.rake
文件中放入哪些代码才能使用所选模板生成文档?
简而言之,我是这方面的新手。
此时,我在 Gemfile 中声明了以下内容:
gem "rdoc", "~> 3.6.1"
并运行 bundle install
命令。
UPDATE I for @dmarkow
我安装了 horo gem 并将以下代码插入到我的 .rake
文件中
RDoc::Task.new do |rdoc|
rdoc.title = "My Awesome docs"
rdoc.rdoc_dir = 'doc'
rdoc.options << '-f' << 'horo'
rdoc.options << '--main' << 'README'
end
如果我运行命令 rdoc -f horo --main README.rdoc *.rdoc lib ext
我得到这个:
file '*.rdoc' not found
file 'ext' not found
uh-oh! RDoc had a problem:
Directory doc already exists, but it looks like it isn't an RDoc directory.
Because RDoc doesn't want to risk destroying any of your existing files,
you'll need to specify a different output directory name (using the --op <dir>
option)
如果我运行命令 rake doc:app
我得到这个:
WARNING: Deprecated reference to top-level constant 'Task' found at: <my_application_projectfolder>/Rakefile:7:in `<top (required)>'
Use --classic-namespace on rake command
or 'require "rake/classic_namespace"' in Rakefile
rake aborted!
wrong number of arguments (0 for 2)
更新II for @dmarkow
我删除了 doc
目录:
如果我运行命令 rdoc -f horo --main README.rdoc *.rdoc lib ext
我得到了这个:
file '*.rdoc' not found
file 'ext' not found
No newer files.
Files: 0
Classes: 0 (0 undocumented)
Modules: 0 (0 undocumented)
Constants: 0 (0 undocumented)
Attributes: 0 (0 undocumented)
Methods: 0 (0 undocumented)
Total: 0 (0 undocumented)
0.00% documented
在文档目录中它创建了一个 created.rid
文件。
如果我运行命令rake doc:app
,我会得到与以下更新相同的结果。
我必须做什么?我仍然需要在 Gemfile 中保留 gem "rdoc", "~> 3.6.1"
吗?
I am using Ruby on Rails 3.0.7 and I would like to install and use a new RDoc template (instead of the default) in order to documenting my application.
I would like to choose one of following:
So,
- Where I can get one of the above templates?
- How can I install that?
- What code should I put in a
.rake
file to generate the documentation with the chosen template?
In few words, I am a newbie in this matters.
At this time in my Gemfile I have stated the following:
gem "rdoc", "~> 3.6.1"
and run the bundle install
command.
UPDATE I for @dmarkow
I installed the horo gem and inserted the following code in a my .rake
file
RDoc::Task.new do |rdoc|
rdoc.title = "My Awesome docs"
rdoc.rdoc_dir = 'doc'
rdoc.options << '-f' << 'horo'
rdoc.options << '--main' << 'README'
end
If I run the command rdoc -f horo --main README.rdoc *.rdoc lib ext
I get this:
file '*.rdoc' not found
file 'ext' not found
uh-oh! RDoc had a problem:
Directory doc already exists, but it looks like it isn't an RDoc directory.
Because RDoc doesn't want to risk destroying any of your existing files,
you'll need to specify a different output directory name (using the --op <dir>
option)
If I run the command rake doc:app
I get this:
WARNING: Deprecated reference to top-level constant 'Task' found at: <my_application_projectfolder>/Rakefile:7:in `<top (required)>'
Use --classic-namespace on rake command
or 'require "rake/classic_namespace"' in Rakefile
rake aborted!
wrong number of arguments (0 for 2)
UPDATE II for @dmarkow
I removed the doc
directory:
If I run the command rdoc -f horo --main README.rdoc *.rdoc lib ext
I get this:
file '*.rdoc' not found
file 'ext' not found
No newer files.
Files: 0
Classes: 0 (0 undocumented)
Modules: 0 (0 undocumented)
Constants: 0 (0 undocumented)
Attributes: 0 (0 undocumented)
Methods: 0 (0 undocumented)
Total: 0 (0 undocumented)
0.00% documented
In the documentation directory it creates a created.rid
file.
If I run the command rake doc:app
I get the same as in the following UPDATE.
What I have to do? I have still to keep the gem "rdoc", "~> 3.6.1"
in my Gemfile?
发布评论
评论(2)
我更喜欢汉娜,或者汉娜新风格。
Hanna 很好,但它是基于旧的 rdoc 版本。 Hanna-nouveau 基于原始 Hanna,但它适用于 rdoc 3(使用 rdoc 3.12 进行测试)。
它看起来像
您可能会在 http://gems.rubypla.net/todonotes/0.1.0/
详细信息可以在 https://github.com/rdoc/hanna-nouveau。 自述文件包含有关安装和使用的信息。
更新 2014
Hanna-nouveau 不适用于 rdoc 4。
您可以做什么:安装旧的 rdoc 版本(我使用 3.12)。无需卸载最实际的版本。您可以根据以下情况调用 rdoc 版本:
使用
_3.12_
加载 rdoc 版本 3.12。使用-f hanna
hanna-nouveau 。I prefer Hanna, resp Hanna-nouveau.
Hanna was fine, but it is based on an old rdoc-version. Hanna-nouveau base on the original Hanna, but it works with rdoc 3 (tested with rdoc 3.12).
It looks like
You may see another example in http://gems.rubypla.net/todonotes/0.1.0/
Details can be found at https://github.com/rdoc/hanna-nouveau. The Readme contains information about installation and usage.
Update 2014
Hanna-nouveau does not work with rdoc 4.
What you can do: Install an old rdoc-version (I use 3.12). There is no need to uninstall the most actual version. You can call rdoc version depending:
With
_3.12_
the rdoc-version 3.12 is loaded. With-f hanna
hanna-nouveau is used.http://api.rubyonrails.org 使用的是“Horo”模板。您可以在这里找到它,以及使用它的说明(它是通过 gem 安装的):
https://github.com /tenderlove/horo
The one used at http://api.rubyonrails.org is the "Horo" template. You can find it here, along with instructions for using it (it's installed via a gem):
https://github.com/tenderlove/horo