mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import RDoc 3.5.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
918f625a5e
commit
cc2a16d94d
49 changed files with 2119 additions and 273 deletions
|
@ -149,17 +149,45 @@ class RDoc::Task < Rake::TaskLib
|
|||
# Create an RDoc task with the given name. See the RDoc::Task class overview
|
||||
# for documentation.
|
||||
|
||||
def initialize(name = :rdoc) # :yield: self
|
||||
if name.is_a? Hash then
|
||||
invalid_options = name.keys.map { |k| k.to_sym } -
|
||||
[:rdoc, :clobber_rdoc, :rerdoc]
|
||||
def initialize name = :rdoc # :yield: self
|
||||
defaults
|
||||
|
||||
unless invalid_options.empty? then
|
||||
raise ArgumentError, "invalid options: #{invalid_options.join(", ")}"
|
||||
end
|
||||
end
|
||||
check_names name
|
||||
|
||||
@name = name
|
||||
|
||||
yield self if block_given?
|
||||
|
||||
define
|
||||
end
|
||||
|
||||
##
|
||||
# Ensures that +names+ only includes names for the :rdoc, :clobber_rdoc and
|
||||
# :rerdoc. If other names are given an ArgumentError is raised.
|
||||
|
||||
def check_names names
|
||||
return unless Hash === names
|
||||
|
||||
invalid_options =
|
||||
names.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc]
|
||||
|
||||
unless invalid_options.empty? then
|
||||
raise ArgumentError, "invalid options: #{invalid_options.join ', '}"
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Task description for the clobber rdoc task or its renamed equivalent
|
||||
|
||||
def clobber_task_description
|
||||
"Remove RDoc HTML files"
|
||||
end
|
||||
|
||||
##
|
||||
# Sets default task values
|
||||
|
||||
def defaults
|
||||
@name = :rdoc
|
||||
@rdoc_files = Rake::FileList.new
|
||||
@rdoc_dir = 'html'
|
||||
@main = nil
|
||||
|
@ -167,14 +195,12 @@ class RDoc::Task < Rake::TaskLib
|
|||
@template = nil
|
||||
@generator = nil
|
||||
@options = []
|
||||
yield self if block_given?
|
||||
define
|
||||
end
|
||||
|
||||
##
|
||||
# All source is inline now. This method is deprecated
|
||||
|
||||
def inline_source() # :nodoc:
|
||||
def inline_source # :nodoc:
|
||||
warn "RDoc::Task#inline_source is deprecated"
|
||||
true
|
||||
end
|
||||
|
@ -190,13 +216,13 @@ class RDoc::Task < Rake::TaskLib
|
|||
# Create the tasks defined by this task lib.
|
||||
|
||||
def define
|
||||
desc "Build RDoc HTML files"
|
||||
desc rdoc_task_description
|
||||
task rdoc_task_name
|
||||
|
||||
desc "Rebuild RDoc HTML files"
|
||||
desc rerdoc_task_description
|
||||
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
|
||||
|
||||
desc "Remove RDoc HTML files"
|
||||
desc clobber_task_description
|
||||
task clobber_task_name do
|
||||
rm_r @rdoc_dir rescue nil
|
||||
end
|
||||
|
@ -215,11 +241,9 @@ class RDoc::Task < Rake::TaskLib
|
|||
@before_running_rdoc.call if @before_running_rdoc
|
||||
args = option_list + @rdoc_files
|
||||
|
||||
if Rake.application.options.trace then
|
||||
$stderr.puts "rdoc #{args.join ' '}"
|
||||
end
|
||||
$stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
|
||||
require 'rdoc/rdoc'
|
||||
RDoc::RDoc.new.document(args)
|
||||
RDoc::RDoc.new.document args
|
||||
end
|
||||
|
||||
self
|
||||
|
@ -247,6 +271,20 @@ class RDoc::Task < Rake::TaskLib
|
|||
@before_running_rdoc = block
|
||||
end
|
||||
|
||||
##
|
||||
# Task description for the rdoc task or its renamed equivalent
|
||||
|
||||
def rdoc_task_description
|
||||
'Build RDoc HTML files'
|
||||
end
|
||||
|
||||
##
|
||||
# Task description for the rerdoc task or its renamed description
|
||||
|
||||
def rerdoc_task_description
|
||||
"Rebuild RDoc HTML files"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def rdoc_target
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue