Not sure exactly what you are after but you may be able to do what you want by only executing the code (or adding more hooks) on start of the invocation of the tasks from the command line.
Ie: on :start, :only => [:deploy, "my:custom:task"] do the.thing.i.want.to.do.in.this.case # and/or after "deploy:update_code","this:other:thing" end In the case above "this:other:thing" would only run during a basic deploy OR if "my:custom:task" was passed on the command line. Note that it won't run if you did cap deploy:migrations Because :deploy in the array only matches 'deploy'; if you wanted it to run then you also have to specify "deploy:migrations" in the array passed via the implicit hash. There is an internal call stack that you might be able to abuse; but I prefer the declarative nature of using on :start I try to keep capistrano magic out of the tasks themselves. On Jun 12, 2012, at 12:11 AM, shrinath_m2 <[email protected]> wrote: > Assume I run "cap -S blah=bar my_custom_task" > > Assume the following code in the recipe: > > task :my_custom_task do > task2 > end > > task :task2 do > # I want to know the name of the requested task (my_custom_task) here... > end > > Possible? > > In real scenario, I want to know if deploy was called or any of my custom > tasks were called. > > Thanks, > Shrinath M > -- > * You received this message because you are subscribed to the Google Groups > "Capistrano" group. > * To post to this group, send email to [email protected] > * To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/capistrano?hl=en -- * You received this message because you are subscribed to the Google Groups "Capistrano" group. * To post to this group, send email to [email protected] * To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
