Sha256: cb6b2f108d150bd53c8df97ab193b12ac3598fd1473d3f1e8f9e7527d02dcf2c

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'capistrano'
require 'haller'

Haller::CAPISTRANO_THUMB_URL =
  'https://raw.github.com/smashingboxes/capistrano-haller/master/resources/capistrano-logo.png'

configuration = if Capistrano::Configuration.respond_to?(:instance)
  Capistrano::Configuration.instance(:must_exist)
else
  Capistrano.configuration(:must_exist)
end

configuration.load do
  namespace :hall_notify do
    desc "Notify a hall channel of deployment"
    task :notify_hall_room do
      if not exists?(:hall_room_key) or hall_room_key.empty?
        logger.important("You must set hall_room_key for hall notifications to work!")
      else
        begin
          Haller.new(hall_room_key,
            sender_icon_url: Haller::CAPISTRANO_THUMB_URL,
            ).send_message( exists?(:hall_message) ? hall_message : "Branch #{branch} was deployed to #{rails_env}.")
        rescue Haller::HallApiError => e
          logger.important("Could not contact hall API for deployment notification.")
        end
      end
    end
    after 'deploy', 'hall_notify:notify_hall_room'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-haller-0.0.4 lib/capistrano/haller.rb