3

我希望 的内容doc/README_FOR_APP出现在 中doc/app/index.html,当我这样做时rake doc:app

目前,内容为:

这是 Rails 应用程序文档的 API 文档。

要查看,我必须在左侧的页面列表中README_FOR_APP单击。README_FOR_APP

我已经查看了如何重命名或移动 Rails 的 README_FOR_APP但 OP 断言他已经看到了我想要的行为。

我正在使用导轨 3.1.3。

4

1 回答 1

8

lib/tasks/documentation.rake首先,在您的项目中创建一个新的 rake 文件(例如)。然后重新定义 rake 任务:

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
于 2012-01-23T01:14:08.237 回答