我无法理解如何指示RDoc在lib / tasks / *。rake中解析我的.rake文件。我是RDoc的新手,但我希望能够记录每个rake命令。此外,看起来RDoc html似乎没有提到每个任务上方“desc”字段中的文本。我做错了什么?
LIB /任务/ 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 /任务/ 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任务定义的旁边,对吗?