如何使README_FOR_APP的内容显示在doc/app/index.html中 [英] How make contents of README_FOR_APP appear in doc/app/index.html
问题描述
当我执行rake doc:app
时,我希望doc/README_FOR_APP
的内容出现在doc/app/index.html
中.
I'd like the contents of doc/README_FOR_APP
appear in doc/app/index.html
, when I do rake doc:app
.
当前的内容是:
这是Rails应用程序文档的API文档.
This is the API documentation for Rails Application Documentation.
要查看README_FOR_APP
,我必须单击左侧页面列表中的README_FOR_APP
.
To see README_FOR_APP
, I have to click on README_FOR_APP
in the pages list on the left.
我查看了如何重命名或移动Rails的方法README_FOR_APP ,但是OP断言他已经已经看到了我想要的行为.
I've looked at How to Rename or Move Rails's README_FOR_APP but the OP asserts that he's already seeing the behaviour I want.
我正在使用Rails 3.1.3.
I'm using rails 3.1.3.
推荐答案
首先,在您的项目中创建一个新的rake文件(例如lib/tasks/documentation.rake
).然后重新定义rake任务:
Firstly, create a new rake file (e.g lib/tasks/documentation.rake
) in your project. Then redefine the rake task:
Rake::Task["doc:app"].clear
Rake::Task["doc/app"].clear
Rake::Task["doc/app/index.html"].clear
namespace :doc do
Rake::RDocTask.new('app') do |rdoc|
rdoc.rdoc_dir = 'doc/app'
rdoc.title = 'YOUR_TITLE'
rdoc.main = 'doc/README_FOR_APP' # define README_FOR_APP as index
rdoc.options << '--charset' << 'utf-8'
rdoc.rdoc_files.include('app/**/*.rb')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.include('doc/README_FOR_APP')
end
end
这篇关于如何使README_FOR_APP的内容显示在doc/app/index.html中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!