我不明白如何指示 RDoc 解析我在 lib/tasks/*.rake 中的 .rake 文件。我是 RDoc 的新手,但我希望能够记录每个 rake 命令。此外,RDoc html 似乎没有提到每个任务上方的“desc”字段中的文本。我究竟做错了什么?
lib/tasks/documentation.rake
Rake::Task["doc:app"].clear
Rake::Task["doc/app"].clear
Rake::Task["doc/app/index.html"].clear
# == This should do something
# Where in rdoc do I see the 'desc' text below?
desc 'Generate RDoc documentation'
namespace :doc do
Rake::RDocTask.new('app') do |rdoc|
rdoc.rdoc_dir = 'doc/app'
rdoc.title = 'Appname'
rdoc.main = 'doc/README_FOR_APP' # define README_FOR_APP as index
rdoc.options << '--charset' << 'utf-8'
rdoc.options << '--verbose'
rdoc.rdoc_files.include('lib/**/*.rake') # just look at rakes for this example...
rdoc.rdoc_files.include('doc/README_FOR_APP')
end
end
lib/tasks/mp3_task.rake
require 'download/mp3_download.rb'
# This task calls the download_mp3() function
desc "Download Mp3"
task :download_mp3 => :environment do
# Here is where I log to stdout
puts 'in Download mp3 rake'
clip = Clip.find(clipId)
# This downloads the file and returns a tuple
path, filename = downloadMp3(clip.episode.url)
end
然后我运行 'rake doc:app' 并得到这个输出:
Parsing sources...
20% [ 1/ 5] lib/tasks/documentation.rake
40% [ 2/ 5] lib/tasks/mp3_tasks.rake
60% [ 3/ 5] lib/tasks/scrape_tasks.rake
80% [ 4/ 5] lib/tasks/twitter_tasks.rake
100% [ 5/ 5] doc/README_FOR_APP
Generating Darkfish format into /Users/y/railsapp/doc/app...
Files: 5
Classes: 0 (0 undocumented)
Modules: 0 (0 undocumented)
Constants: 0 (0 undocumented)
Attributes: 0 (0 undocumented)
Methods: 0 (0 undocumented)
Total: 0 (0 undocumented)
0.00% documented
Elapsed: 0.2s
最终的 html 太空了,太可悲了。我什至没有在 .rake 文件中显示的功能。我把文档放在错误的地方了吗?看来他们应该住在 rake 任务定义旁边,对吧?