# Calling a task in rant at any time (not just as a prerequisi

**URL:** <https://www.ruby-forum.com/t/calling-a-task-in-rant-at-any-time-not-just-as-a-prerequisi/100444>\
**Category:** Ruby\
**Created:** [July 28, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/calling-a-task-in-rant-at-any-time-not-just-as-a-prerequisi/100444 "2006-07-28T22:46:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwv549](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ac8455/32.png) [@bwv549](https://www.ruby-forum.com/u/bwv549)\
**Post date:** [July 28, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/calling-a-task-in-rant-at-any-time-not-just-as-a-prerequisi/100444/1 "2006-07-28T22:46:54Z")

</div>

In rant, we call a task by denoting it as a dependancy:

task :test =\> [:build] do # calls :build before :test  
-whatever-  
end

How do you call a task at the end of (or inside) a block?

task :myaction do  
-some action-  
end

task :otheraction do  
-some stuff here-  
\*\*\* how to call :myaction here? \*\*  
end (\*\* or here? \*\*)

Thanks

---

<div class="post-metadata">

**Author:** ![bwv549](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ac8455/32.png) [@bwv549](https://www.ruby-forum.com/u/bwv549)\
**Post date:** [July 29, 2006, 12:43am UTC](https://www.ruby-forum.com/t/calling-a-task-in-rant-at-any-time-not-just-as-a-prerequisi/100444/2 "2006-07-29T00:43:23Z")

</div>

In Rake, I put the contents of the :myaction  
task into a method. Then invoke the method  
from either task.

Beats the hell out of make or ant…
