class Rake::RDocTask
:rdoc:force
.
This will create the tasks :rdoc
, :rdoc_clean
and
Rake::RDocTask.new(:rdoc => “rdoc”, :clobber_rdoc => “rdoc:clean”, :rerdoc => “rdoc:force”)
For example::rerdoc
options, you can customize the task names to your liking.
first argument. With the :rdoc
, :clobber_rdoc
and
If you wish to have completely different task names, then pass a Hash as
:rerdoc_dev.
The tasks would then be named :rdoc_dev, :clobber_rdoc_dev, and
end
rd.options << “–all”
rd.rdoc_files.include(“README.rdoc”, “lib/*/.rb”)
rd.main = “README.doc”
Rake::RDocTask.new(:rdoc_dev) do |rd|
development set of documentation including private methods:
generating two sets of documentation. For instance, if you want to have a
You may wish to give the task a different name, such as if you are
== Specifying different task names
attributes list for the RDocTask class for available customization options.
The rd
object passed to the block is an RDocTask object. See the
end
rd.rdoc_files.include(“README.rdoc”, “lib/*/.rb”)
rd.main = “README.rdoc”
Rake::RDocTask.new do |rd|
Simple Example:
of date.
Rebuild the rdoc files from scratch, even if they are not out
[:rerdoc]
added to the main clobber target.
Delete all the rdoc files. This target is automatically
[:clobber_rdoc]
Main task for this RDOC task.
[rdoc]
The RDocTask will create the following targets:
a project.
Create a documentation task that will generate the RDoc files for
in RDoc 2.4.2+. Use require ‘rdoc/task’ to require it.
NOTE: Rake::RDocTask is deprecated in favor of RDoc:Task which is included
def before_running_rdoc(&block)
RDoc generator. It is allowed to modify RDocTask attributes inside the
The block passed to this method will be called just before running the
def before_running_rdoc(&block) @before_running_rdoc = block end
def clobber_task_name
def clobber_task_name case name when Hash (name[:clobber_rdoc] || "clobber_rdoc").to_s else "clobber_#{name}" end end
def define
def define if rdoc_task_name != "rdoc" desc "Build the RDOC HTML Files" else desc "Build the #{rdoc_task_name} HTML Files" end task rdoc_task_name desc "Force a rebuild of the RDOC files" task rerdoc_task_name => [clobber_task_name, rdoc_task_name] desc "Remove rdoc products" task clobber_task_name do rm_r rdoc_dir rescue nil end task :clobber => [clobber_task_name] directory @rdoc_dir task rdoc_task_name => [rdoc_target] file rdoc_target => @rdoc_files + [Rake.application.rakefile] do rm_r @rdoc_dir rescue nil @before_running_rdoc.call if @before_running_rdoc args = option_list + @rdoc_files if @external argstring = args.join(' ') sh %{ruby -Ivendor vendor/rd #{argstring}} else require 'rdoc/rdoc' RDoc::RDoc.new.document(args) end end self end
def initialize(name = :rdoc) # :yield: self
for documentation.
Create an RDoc task with the given name. See the RDocTask class overview
def initialize(name = :rdoc) # :yield: self if name.is_a?(Hash) invalid_options = name.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc] if !invalid_options.empty? raise ArgumentError, "Invalid option(s) passed to RDocTask.new: #{invalid_options.join(", ")}" end end @name = name @rdoc_files = Rake::FileList.new @rdoc_dir = 'html' @main = nil @title = nil @template = nil @external = false @inline_source = true @options = [] yield self if block_given? define end
def option_list
def option_list result = @options.dup result << "-o" << @rdoc_dir result << "--main" << quote(main) if main result << "--title" << quote(title) if title result << "-T" << quote(template) if template result << "--inline-source" if inline_source && !@options.include?("--inline-source") && !@options.include?("-S") result end
def option_string
def option_string option_list.join(' ') end
def quote(str)
def quote(str) if @external "'#{str}'" else str end end
def rdoc_target
def rdoc_target "#{rdoc_dir}/index.html" end
def rdoc_task_name
def rdoc_task_name case name when Hash (name[:rdoc] || "rdoc").to_s else name.to_s end end
def rerdoc_task_name
def rerdoc_task_name case name when Hash (name[:rerdoc] || "rerdoc").to_s else "re#{name}" end end