Thanks Jamis.  I appreciate the thorough explanation.  Exactly what I
was looking for.

Sean


On Jun 13, 12:53 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
> Sean,
>
> There are only two ways to alter existing tasks. The first is to do as  
> mongrel_cluster does and simply redefine them. Any time you declare a  
> task with the same name as a pre-existing task, it overrides the older  
> one. The older definition is, essentially, lost, replaced whole-sale  
> with the new one.
>
> The second is to extend them, but extension of existing tasks is not  
> done like you would do in an object-oriented language. You extend  
> existing tasks with the use of before and after hooks. In other words,  
> if you want deploy:restart to restart mongrel AND restart ferret,  
> you'd leave the mongrel_cluster definition of deploy:restart alone,  
> and write a ferret:restart task:
>
>    namespace :ferret do
>      task :restart do
>        run "something that restarts ferret"
>      end
>    end
>
> Then, you'd chain ferret:restart to deploy:restart:
>
>    after "deploy:restart", "ferret:restart"
>
> Then, any time you invoke deploy:restart, ferret:restart will  
> automatically fire immediately afterwards. This has the additional  
> benefit of letting you restart just ferret if you ever need to, since  
> you can just invoke ferret:restart directly.
>
> - Jamis
>
> On Jun 13, 2008, at 10:32 AM, Sean wrote:
>
>
>
> > First, of all, thank you Jamis, et al. for capistrano.
>
> > I'm interested in understanding how I to extend vs. override the
> > default deploy tasks.  For instance, I noticed in the Palmtree gem,
> > the author writes:
>
> >  # We need to override the core deployment tasks so
> >  # they use mongrel cluster instead.
> >  namespace :deploy do
> >    desc <<-DESC
> >    Restart the Mongrel processes on the app server by calling
> > mongrel:cluster:restart.
> >    DESC
> >    task :restart, :roles => :app, :except => { :no_release => true }
> > do
> >      mongrel.cluster.restart
> >    end
> >    ....
>
> > So, since the palmtree code is included after the original capiostrano
> > code, the restart task (which gets called by default for every deploy)
> > now uses the mongrel code above.  Why?  Simply because this code is
> > included after the capistrano code?
>
> > What if I want to extend the default deploy tasks to include other
> > server needs.  For instance, if I want to restart a Solr search daemon
> > AND restart a mongrel cluster?
>
> > I do understand that I can write :after_update_code tasks and the
> > like, but I'm more interested to understand how I can extend the
> > deploy: restart task to do multiple things (i.e restart mongrel,
> > restart ferret, restart mylife).
>
> > Thanks,
>
> > Sean
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to