Forum: Ruby on Rails Multiple after_deploys in deploy.rb

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E813e0a366e5d5ddc302fa57a0fc2fab?d=identicon&s=25 Curtis Spencer (Guest)
on 2007-04-10 20:45
(Received via mailing list)
Hi,

  I am using Capistrano to do a deploy to servers with different roles.
  I want call after_deploy in the following manner.

  task :after_deploy, :roles => [:rolea] do
    run "task a"
  end

  task :after_deploy, :roles => [:roleb] do
    run "task b"
  end

The problem seems that the second after_deploy clobbers the first even
though they are meant for different roles.  I do a workaround now by
making role a use after_symlink, but now I am adding a few more roles
and I am running out of after_* to workaround.  Is there a way to do the
following

  task :after_deploy do
    if current_server.role == :rolea
      run "task a"
    elsif current_server.role == :roleb
      run "task b"
    end
  end


Thanks in advance for the help.

-Curtis
This topic is locked and can not be replied to.