Class: SimpleDeploy::Notifier::Campfire
- Inherits:
-
Object
- Object
- SimpleDeploy::Notifier::Campfire
- Defined in:
- lib/simple_deploy/notifier/campfire.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Campfire
constructor
A new instance of Campfire.
- #send(message) ⇒ Object
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 = SimpleDeploy.config @logger = SimpleDeploy.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 = Esbit::Campfire.new @subdomain, @token @rooms = @campfire.rooms end end |
Instance Method Details
#send(message) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/simple_deploy/notifier/campfire.rb', line 26 def send() @logger.info "Sending Campfire notifications." @room_ids.split(',').each do |room_id| room = @rooms.find { |r| r.id == room_id.to_i } if room @logger.debug "Sending notification to Campfire room #{room.name}." room.say else @logger.warn "Could not find a room for id #{room_id}" end end @logger.info "Campfire notifications complete." end |