耙子中止!不知道如何构建任务 'doc:app'
Rake aborted! Don't know how to build task 'doc:app'
我应该能够使用 rake doc:app
为我的应用程序构建文档的 official documentation indicates,但是当我 运行 Rails 5 中的命令时,我得到以下信息输出:
bwerth@bwerth-VirtualBox:~/rails/gep$ rake doc:app
rake aborted!
Don't know how to build task 'doc:app' (see --tasks)
(See full trace by running task with --trace)
此功能在版本 5 中 removed from Rails,理由如下:
...In our experience applications do not generate APIs using doc:app...If a team absolutely needs to generate application documentation
for internal purposes, they can still easily write their own task...
通过在 /lib/tasks/documentation.rake 创建一个文件可以很容易地恢复功能,其中包含以下内容,取自 last version of the official task:
# /lib/tasks/documentation.rake
require 'rdoc/task'
namespace :doc do
RDoc::Task.new("app") { |rdoc|
rdoc.rdoc_dir = 'doc/app'
rdoc.template = ENV['template'] if ENV['template']
rdoc.title = ENV['title'] || 'Rails Application Documentation'
rdoc.options << '--line-numbers'
rdoc.options << '--charset' << 'utf-8'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('app/**/*.rb')
rdoc.rdoc_files.include('lib/**/*.rb')
}
Rake::Task['doc:app'].comment = "Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")"
end
不过,在这一点上,从命令行 运行 这样的事情似乎更容易:
rdoc --main README.md --title 'My Fancy Title' README.md app/**/*.rb lib/**/*.rb
我应该能够使用 rake doc:app
为我的应用程序构建文档的 official documentation indicates,但是当我 运行 Rails 5 中的命令时,我得到以下信息输出:
bwerth@bwerth-VirtualBox:~/rails/gep$ rake doc:app
rake aborted!
Don't know how to build task 'doc:app' (see --tasks)
(See full trace by running task with --trace)
此功能在版本 5 中 removed from Rails,理由如下:
...In our experience applications do not generate APIs using doc:app...If a team absolutely needs to generate application documentation for internal purposes, they can still easily write their own task...
通过在 /lib/tasks/documentation.rake 创建一个文件可以很容易地恢复功能,其中包含以下内容,取自 last version of the official task:
# /lib/tasks/documentation.rake
require 'rdoc/task'
namespace :doc do
RDoc::Task.new("app") { |rdoc|
rdoc.rdoc_dir = 'doc/app'
rdoc.template = ENV['template'] if ENV['template']
rdoc.title = ENV['title'] || 'Rails Application Documentation'
rdoc.options << '--line-numbers'
rdoc.options << '--charset' << 'utf-8'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('app/**/*.rb')
rdoc.rdoc_files.include('lib/**/*.rb')
}
Rake::Task['doc:app'].comment = "Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")"
end
不过,在这一点上,从命令行 运行 这样的事情似乎更容易:
rdoc --main README.md --title 'My Fancy Title' README.md app/**/*.rb lib/**/*.rb