lib/rdoc/task.rb in rdoc-6.5.1.1 vs lib/rdoc/task.rb in rdoc-6.6.0
- old
+ new
@@ -48,10 +48,13 @@
# clobber target.
#
# [rerdoc]
# Rebuild the rdoc files from scratch, even if they are not out of date.
#
+# [rdoc:coverage]
+# Print RDoc coverage report for all rdoc files.
+#
# Simple Example:
#
# require 'rdoc/task'
#
# RDoc::Task.new do |rdoc|
@@ -88,12 +91,12 @@
# require 'rdoc/task'
#
# RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
# :rerdoc => "rdoc:force")
#
-# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt> and
-# <tt>:rdoc:force</tt>.
+# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt>,
+# <tt>:rdoc:force</tt>, and <tt>:rdoc:coverage</tt>.
class RDoc::Task < Rake::TaskLib
##
# Name of the main, top level task. (default is :rdoc)
@@ -246,10 +249,22 @@
$stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
RDoc::RDoc.new.document args
end
+ namespace rdoc_task_name do
+ desc coverage_task_description
+ task coverage_task_name do
+ @before_running_rdoc.call if @before_running_rdoc
+ opts = option_list << "-C"
+ args = opts + @rdoc_files
+
+ $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
+ RDoc::RDoc.new.document args
+ end
+ end
+
self
end
##
# List of options that will be supplied to RDoc
@@ -286,10 +301,17 @@
def rerdoc_task_description
"Rebuild RDoc HTML files"
end
+ ##
+ # Task description for the coverage task or its renamed description
+
+ def coverage_task_description
+ "Print RDoc coverage report"
+ end
+
private
def rdoc_target
"#{rdoc_dir}/created.rid"
end
@@ -311,9 +333,13 @@
def rerdoc_task_name
case name
when Hash then (name[:rerdoc] || "rerdoc").to_s
else "re#{name}"
end
+ end
+
+ def coverage_task_name
+ "coverage"
end
end
# :stopdoc: