Class: Rake::RDocTask
Constant Summary
Constants included from FileUtilsExt
Constants included from FileUtils
FileUtils::LN_SUPPORTED, FileUtils::RUBY
Instance Attribute Summary collapse
-
#external ⇒ Object
Returns the value of attribute external.
-
#inline_source ⇒ Object
Returns the value of attribute inline_source.
-
#main ⇒ Object
Returns the value of attribute main.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#rdoc_dir ⇒ Object
Returns the value of attribute rdoc_dir.
-
#rdoc_files ⇒ Object
Returns the value of attribute rdoc_files.
-
#template ⇒ Object
Returns the value of attribute template.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#before_running_rdoc(&block) ⇒ Object
The block passed to this method will be called just before running the RDoc generator.
- #define ⇒ Object
-
#initialize(name = :rdoc) {|_self| ... } ⇒ RDocTask
constructor
A new instance of RDocTask.
- #option_list ⇒ Object
- #option_string ⇒ Object
- #quote(str) ⇒ Object
Methods inherited from TaskLib
Methods included from FileUtilsExt
#nowrite, #rake_check_options, #rake_merge_option, #rake_output_message, #verbose, #when_writing
Methods included from FileUtils
#ruby, #safe_ln, #sh, #split_all
Methods included from Cloneable
Constructor Details
#initialize(name = :rdoc) {|_self| ... } ⇒ RDocTask
Returns a new instance of RDocTask.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/rake/rdoctask.rb', line 112 def initialize(name = :rdoc) # :yield: self if name.is_a?(Hash) = name.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc] if !.empty? raise ArgumentError, "Invalid option(s) passed to RDocTask.new: #{.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 |
Instance Attribute Details
#external ⇒ Object
Returns the value of attribute external
106 107 108 |
# File 'lib/rake/rdoctask.rb', line 106 def external @external end |
#inline_source ⇒ Object
Returns the value of attribute inline_source
108 109 110 |
# File 'lib/rake/rdoctask.rb', line 108 def inline_source @inline_source end |
#main ⇒ Object
Returns the value of attribute main
94 95 96 |
# File 'lib/rake/rdoctask.rb', line 94 def main @main end |
#name ⇒ Object
Returns the value of attribute name
84 85 86 |
# File 'lib/rake/rdoctask.rb', line 84 def name @name end |
#options ⇒ Object
Returns the value of attribute options
103 104 105 |
# File 'lib/rake/rdoctask.rb', line 103 def @options end |
#rdoc_dir ⇒ Object
Returns the value of attribute rdoc_dir
87 88 89 |
# File 'lib/rake/rdoctask.rb', line 87 def rdoc_dir @rdoc_dir end |
#rdoc_files ⇒ Object
Returns the value of attribute rdoc_files
100 101 102 |
# File 'lib/rake/rdoctask.rb', line 100 def rdoc_files @rdoc_files end |
#template ⇒ Object
Returns the value of attribute template
97 98 99 |
# File 'lib/rake/rdoctask.rb', line 97 def template @template end |
#title ⇒ Object
Returns the value of attribute title
90 91 92 |
# File 'lib/rake/rdoctask.rb', line 90 def title @title end |
Instance Method Details
#before_running_rdoc(&block) ⇒ Object
The block passed to this method will be called just before running the RDoc generator. It is allowed to modify RDocTask attributes inside the block.
194 195 196 |
# File 'lib/rake/rdoctask.rb', line 194 def before_running_rdoc(&block) @before_running_rdoc = block end |
#define ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/rake/rdoctask.rb', line 134 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 |
#option_list ⇒ Object
169 170 171 172 173 174 175 176 177 |
# File 'lib/rake/rdoctask.rb', line 169 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 |
#option_string ⇒ Object
187 188 189 |
# File 'lib/rake/rdoctask.rb', line 187 def option_string option_list.join(' ') end |
#quote(str) ⇒ Object
179 180 181 182 183 184 185 |
# File 'lib/rake/rdoctask.rb', line 179 def quote(str) if @external "'#{str}'" else str end end |