Module: Rake
- Defined in:
- lib/ext/rake.rb
Defined Under Namespace
Modules: TaskManager Classes: RemoteTask, Task
Class Method Summary collapse
-
.all_tasks ⇒ Object
Simple shortcut for Rake.application.all_tasks.
-
.clear_tasks(*tasks) ⇒ Object
Hooks into rake and allows us to clear out a task by name or regexp.
-
.undo(*names) ⇒ Object
Removes the last action added to a task.
Class Method Details
.all_tasks ⇒ Object
Simple shortcut for Rake.application.all_tasks
10 11 12 |
# File 'lib/ext/rake.rb', line 10 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.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ext/rake.rb', line 17 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
35 36 37 38 39 |
# File 'lib/ext/rake.rb', line 35 def self.undo(*names) names.each do |name| all_tasks[name].actions.delete_at(-1) end end |