module Rake

Public Class Methods

all_tasks() click to toggle source

Simple shortcut for Rake.application.all_tasks

# File lib/hoe/rake.rb, line 42
def self.all_tasks
  Rake.application.all_tasks
end
clear_tasks(*tasks) click to toggle source

Hooks into rake and allows us to clear out a task by name or regexp. Use this if you want to completely override a task instead of extend it.

# File lib/hoe/rake.rb, line 50
def self.clear_tasks(*tasks)
  tasks.flatten.each do |name|
    case name
    when Regexp then
      all_tasks.delete_if { |k, _| k =~ name }
    else
      all_tasks.delete(name)
    end
  end
end
undo(*names) click to toggle source

Removes the last action added to a task. Use this when two libraries define the same task and you only want one of the actions.

require 'hoe'
require 'tasks/rails'
Rake.undo("test") # rolls out rails' test task
# File lib/hoe/rake.rb, line 69
def self.undo(*names)
  names.each do |name|
    all_tasks[name].actions.delete_at(-1)
  end
end