Class: SimpleDeploy::Notifier::Campfire

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_deploy/notifier/campfire.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Campfire

Returns a new instance of Campfire.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/simple_deploy/notifier/campfire.rb', line 7

def initialize(args)
  @stack_name = args[:stack_name]
  @environment = args[:environment]
  @config = args[:config]
  @logger = @config.logger

  attributes = stack.attributes
  @subdomain = attributes['campfire_subdomain']
  @room_ids = attributes['campfire_room_ids'] ||= ''
  @logger.debug "Campfire subdomain '#{@subdomain}'."
  @logger.debug "Campfire room ids '#{@room_ids}'."

  if @subdomain
    @token = @config.notifications['campfire']['token']
    @campfire = Tinder::Campfire.new @subdomain, :token => @token,
                                                 :ssl_options => { :verify => false }
  end
end

Instance Method Details

#send(message) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/simple_deploy/notifier/campfire.rb', line 26

def send(message)
  @logger.info "Sending Campfire notifications."
  @room_ids.split(',').each do |room_id|
    @logger.debug "Sending notification to Campfire room #{room_id}."
    room = @campfire.find_room_by_id room_id.to_i
    room.speak message
  end
  @logger.info "Campfire notifications complete."
end