Method: CapistranoNotification#add

Defined in:
lib/capistrano-notification.rb

#add(notification) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/capistrano-notification.rb', line 75

def add(notification)
  task_name = notification.name.downcase.gsub(' ', '_')

  namespace :deploy do
    namespace :notify do
      desc "Notify #{name} of the deployment."
      task task_name, :roles => :app, :except => {:no_release => true} do
        if notification.valid?
          notification.run
        else
          $stderr.puts notification.errors.full_messages
        end
      end
    end
  end

  after 'deploy', "deploy:notify:#{task_name}"
end