Sha256: 68a8fc939af84471d5bb559a7cb65b4473f91c036130a92a855da2dd25b7b1dd

Contents?: true

Size: 1.35 KB

Versions: 23

Compression:

Stored size: 1.35 KB

Contents

require 'simple_deploy/notifier/campfire'

module SimpleDeploy
  class Notifier
    def initialize(args)
      @config = SimpleDeploy.config
      @stack_name = args[:stack_name]
      @environment = args[:environment]
      @notifications = @config.notifications || {}
    end

    def send_deployment_start_message
      message = "Deployment to #{@stack_name} in #{@config.region} started."
      send message
    end

    def send_deployment_complete_message
      message = "Deployment to #{@stack_name} in #{@config.region} complete."
      attributes = stack.attributes

      if attributes['app_github_url']
        message += " App: #{attributes['app_github_url']}/commit/#{attributes['app']}"
      end

      if attributes['chef_repo_github_url']
        message += " Chef: #{attributes['chef_repo_github_url']}/commit/#{attributes['chef_repo']}"
      end

      send message
    end

    def send(message)
      @notifications.keys.each do |notification|
        case notification
        when 'campfire'
          campfire = Notifier::Campfire.new :stack_name  => @stack_name,
                                            :environment => @environment
          campfire.send message
        end
      end
    end

    private

    def stack
      @stack ||= Stack.new :name        => @stack_name,
                           :environment => @environment
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
simple_deploy-0.10.1 lib/simple_deploy/notifier.rb
simple_deploy-0.10.0 lib/simple_deploy/notifier.rb
simple_deploy-0.10.0.beta.3 lib/simple_deploy/notifier.rb
simple_deploy-0.10.0.beta.2 lib/simple_deploy/notifier.rb
simple_deploy-0.10.0.beta.1 lib/simple_deploy/notifier.rb
simple_deploy-0.9.2 lib/simple_deploy/notifier.rb
simple_deploy-0.9.1 lib/simple_deploy/notifier.rb
simple_deploy-0.9.0 lib/simple_deploy/notifier.rb
simple_deploy-0.8.2 lib/simple_deploy/notifier.rb
simple_deploy-0.8.2.beta1 lib/simple_deploy/notifier.rb
simple_deploy-0.8.1.beta1 lib/simple_deploy/notifier.rb
simple_deploy-0.8.0 lib/simple_deploy/notifier.rb
simple_deploy-0.7.8 lib/simple_deploy/notifier.rb
simple_deploy-0.7.7 lib/simple_deploy/notifier.rb
simple_deploy-0.7.7.beta.1 lib/simple_deploy/notifier.rb
simple_deploy-0.7.6 lib/simple_deploy/notifier.rb
simple_deploy-0.7.6.beta.6 lib/simple_deploy/notifier.rb
simple_deploy-0.7.6.beta.5 lib/simple_deploy/notifier.rb
simple_deploy-0.7.6.beta.3 lib/simple_deploy/notifier.rb
simple_deploy-0.7.6.beta.1 lib/simple_deploy/notifier.rb