executing a task without triggered "chained callbacks" ?

74 views
Skip to first unread message

henrique matias

unread,
Apr 26, 2013, 7:52:47 AM4/26/13
to capis...@googlegroups.com
Hello Folks,

On my deploy.rb i have a few tasks which are chained to others, but some times i would like to execute them without triggering the chained ones...

Am trying to find a "magic parameter" on docs, but perhaps am not the beset doc explorer ( :

peace

Lee Hambley

unread,
Apr 26, 2013, 7:55:36 AM4/26/13
to capis...@googlegroups.com
You have to change them so that you have my_task, no prerequisites, and something like my_task_with_prerequisites
--
--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com 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 unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Lee Hambley
--

henrique matias

unread,
Apr 26, 2013, 7:58:45 AM4/26/13
to capis...@googlegroups.com
nice one.

so i can have a task my_task_with_prerequisites and then inside of it, just call:

my_namespace.my_task_without_prequisites


that's rings me a refactor bell !

thanks a lot!

henrique matias

unread,
Apr 26, 2013, 7:59:38 AM4/26/13
to capis...@googlegroups.com
am going to end up, having a "deploy" branch, without my rails app, just with clean capistrano tasks / CapFile..

so i can have pure capistrano magic, and a readme file explainaing everything, otherwise will be hell to remember the correct procedures on mondays...

thanks a lot!

Lee Hambley

unread,
Apr 26, 2013, 8:32:31 AM4/26/13
to capis...@googlegroups.com
Have fun! Friday Refactorfest!

Donovan Bray

unread,
Apr 26, 2013, 12:01:16 PM4/26/13
to capis...@googlegroups.com
What I do is create my call chains based on a top level task like deploy or deploy:migrations

on :start, :only => :deploy do
  after "deploy:update_code", :bar
  before :bar, :foo
end

task :bar do
   logger.info "bar"
end

task :foo do
  logger.info "foo"
end

You can call foo and bar independently outside of a deploy. But during a deploy they will run in the correct order. 
--

Donovan Bray

unread,
Apr 26, 2013, 12:17:00 PM4/26/13
to capis...@googlegroups.com
I've used this method to change which roles to use not to avoid callbacks as I mentioned how I deal with that earlier. But if you do use this remember you can make the body of the task a method and call the same method inside your different task and they will work based on the context of the task they are called inside. 

def logfoo
  logger.info "foo"
end

after :foo, :bar
task :foo do
  logfoo
end

task :bar do
  logger.info "bar"
end

task :foo_no_bar do
  logfoo
end

henrique matias

unread,
Apr 26, 2013, 3:11:01 PM4/26/13
to capis...@googlegroups.com
super sexy !

thanks a lot ! 
Reply all
Reply to author
Forward
0 new messages