如何使README_FOR_APP的内容出现在doc/app/index.html中

she*_*onh 3 ruby-on-rails rdoc

当我这样做时,我想要doc/README_FOR_APP出现的内容.doc/app/index.htmlrake doc:app

目前,内容是:

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

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

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

我正在使用rails 3.1.3.

Rob*_*bin 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
Run Code Online (Sandbox Code Playgroud)