Sha256: c1446e5df8b0d39f159ba3a705b61ff8933f76da88be1050d376da7158f1b46c

Contents?: true

Size: 1.48 KB

Versions: 12

Compression:

Stored size: 1.48 KB

Contents

require 'simple_deploy/notifier/campfire'

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

    def send_deployment_complete_message
      message = "Deployment to #{@stack_name} 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,
                                            :config      => @config
          campfire.send message
        end
      end
    end

    private

    def stack
      @stack ||= Stackster::Stack.new :environment => @environment,
                                      :name        => @stack_name,
                                      :config      => @config.environment(@environment),
                                      :logger      => @logger
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
simple_deploy-0.5.4 lib/simple_deploy/notifier.rb
simple_deploy-0.5.3 lib/simple_deploy/notifier.rb
simple_deploy-0.5.2 lib/simple_deploy/notifier.rb
simple_deploy-0.5.1 lib/simple_deploy/notifier.rb
simple_deploy-0.5.0 lib/simple_deploy/notifier.rb
simple_deploy-0.4.8 lib/simple_deploy/notifier.rb
simple_deploy-0.4.7 lib/simple_deploy/notifier.rb
simple_deploy-0.4.6 lib/simple_deploy/notifier.rb
simple_deploy-0.4.5 lib/simple_deploy/notifier.rb
simple_deploy-0.4.5.rc.0 lib/simple_deploy/notifier.rb
simple_deploy-0.4.4 lib/simple_deploy/notifier.rb
simple_deploy-0.4.3 lib/simple_deploy/notifier.rb