Module: Rake

Defined in:
lib/hoe/rake.rb

Defined Under Namespace

Modules: TaskManager Classes: SshDirPublisher, Task

Class Method Summary collapse

Class Method Details

.all_tasksObject

Simple shortcut for Rake.application.all_tasks



42
43
44
# File 'lib/hoe/rake.rb', line 42

def self.all_tasks
  Rake.application.all_tasks
end

.clear_tasks(*tasks) ⇒ Object

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.



50
51
52
53
54
55
56
57
58
59
# 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) ⇒ Object

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


69
70
71
72
73
# File 'lib/hoe/rake.rb', line 69

def self.undo(*names)
  names.each do |name|
    all_tasks[name].actions.delete_at(-1)
  end
end