How make contents of README_FOR_APP appear in doc/app/index.html

自古美人都是妖i 提交于 2019-12-12 13:03:45

问题


I'd like the contents of doc/README_FOR_APP appear in doc/app/index.html, when I do rake doc:app.

Currently, the content is:

This is the API documentation for Rails Application Documentation.

To see README_FOR_APP, I have to click on README_FOR_APP in the pages list on the left.

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.

I'm using rails 3.1.3.


回答1:


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


来源:https://stackoverflow.com/questions/8415676/how-make-contents-of-readme-for-app-appear-in-doc-app-index-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!