Module: CapistranoNotification

Defined in:
lib/capistrano-notification.rb,
lib/capistrano-notification/version.rb

Defined Under Namespace

Classes: Base, IRC

Constant Summary collapse

VERSION =
'0.1.1'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(config) ⇒ Object



6
7
8
9
# File 'lib/capistrano-notification.rb', line 6

def self.extended(config)
  config.set :local_user, ENV['USER'] || ENV['USERNAME'] || 'unknown'
  config.set :deploy_target, config.fetch(:stage, config.fetch(:rails_env, 'production'))
end

Instance Method Details

#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

#irc(opts = {}, &block) ⇒ Object



71
72
73
# File 'lib/capistrano-notification.rb', line 71

def irc(opts = {}, &block)
  add IRC.new(opts, &block)
end