Class: Yard::Fence::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/yard/fence/rake_task.rb

Overview

Rake task to prepare for YARD documentation generation. This handles both cleaning the docs directory (if YARD_FENCE_CLEAN_DOCS=true) and preparing the tmp/yard-fence files with sanitized markdown.

This is separated from the gem’s load-time to ensure these operations only happen when explicitly running documentation tasks, not during other rake tasks like ‘build` or `release`.

Examples:

Usage in Rakefile

require "yard/fence/rake_task"
Yard::Fence::RakeTask.new

# This creates a `yard:fence:prepare` task that is automatically added
# as a prerequisite to the yard task.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "yard:fence:prepare") {|task| ... } ⇒ RakeTask

Initialize the rake task.

Parameters:

  • name (String, Symbol) (defaults to: "yard:fence:prepare")

    the task name (default: “yard:fence:prepare”)

Yields:

  • (task)

    optional block to configure the task



31
32
33
34
35
36
37
38
# File 'lib/yard/fence/rake_task.rb', line 31

def initialize(name = "yard:fence:prepare")
  super()
  @name = name.to_s

  yield self if block_given?

  define_tasks
end

Instance Attribute Details

#nameString

Returns the name of the prepare task (default: “yard:fence:prepare”).

Returns:

  • (String)

    the name of the prepare task (default: “yard:fence:prepare”)



25
26
27
# File 'lib/yard/fence/rake_task.rb', line 25

def name
  @name
end