Class: YARD::Rake::YardocTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- YARD::Rake::YardocTask
- Defined in:
- lib/yard/rake/yardoc_task.rb
Overview
The rake task to run CLI::Yardoc and generate documentation.
Instance Attribute Summary collapse
-
#after ⇒ Proc
Runs a
Proc
after the task. -
#before ⇒ Proc
Runs a
Proc
before the task. -
#files ⇒ Array<String>
The Ruby source files (and any extra documentation files separated by ‘-’) to process.
-
#name ⇒ String
The name of the task.
-
#options ⇒ Hash
Options to pass to CLI::Yardoc.
-
#verifier ⇒ Proc
An optional lambda to run against all objects being generated.
Instance Method Summary collapse
-
#define ⇒ void
protected
Defines the rake task.
-
#initialize(name = :yard) {|_self| ... } ⇒ YardocTask
constructor
Creates a new task with name
name
.
Constructor Details
#initialize(name = :yard) {|_self| ... } ⇒ YardocTask
Creates a new task with name name
.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/yard/rake/yardoc_task.rb', line 42 def initialize(name = :yard) @name = name @options = [] @files = [] yield self if block_given? self. += ENV['OPTS'].split(/[ ,]/) if ENV['OPTS'] self.files += ENV['FILES'].split(/[ ,]/) if ENV['FILES'] define end |
Instance Attribute Details
#after ⇒ Proc
Runs a Proc
after the task
28 29 30 |
# File 'lib/yard/rake/yardoc_task.rb', line 28 def after @after end |
#before ⇒ Proc
Runs a Proc
before the task
24 25 26 |
# File 'lib/yard/rake/yardoc_task.rb', line 24 def before @before end |
#files ⇒ Array<String>
The Ruby source files (and any extra documentation files separated by ‘-’) to process
20 21 22 |
# File 'lib/yard/rake/yardoc_task.rb', line 20 def files @files end |
#name ⇒ String
The name of the task
11 12 13 |
# File 'lib/yard/rake/yardoc_task.rb', line 11 def name @name end |
#options ⇒ Hash
Options to pass to CLI::Yardoc
15 16 17 |
# File 'lib/yard/rake/yardoc_task.rb', line 15 def @options end |
#verifier ⇒ Proc
Returns an optional lambda to run against all objects being generated. Any object that the lambda returns false for will be excluded from documentation.
34 35 36 |
# File 'lib/yard/rake/yardoc_task.rb', line 34 def verifier @verifier end |
Instance Method Details
#define ⇒ void (protected)
This method returns an undefined value.
Defines the rake task
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/yard/rake/yardoc_task.rb', line 58 def define desc "Generate YARD Documentation" task(name) do before.call if before.is_a?(Proc) yardoc = YARD::CLI::Yardoc.new yardoc.[:verifier] = verifier if verifier yardoc.run *( + files) after.call if after.is_a?(Proc) end end |