Sha256: b383242bdc1adc95da97d2cbc1e266d51d48d6b7569183c85dababadd9e99699

Contents?: true

Size: 755 Bytes

Versions: 8

Compression:

Stored size: 755 Bytes

Contents

module Conveyor
  module Output
    class Campfire
      include Singleton
      
      def initialize
        @config = Conveyor::Foreman.instance.config[:campfire]
        @host = Socket.gethostname
        
        if enabled?
          @campfire = Tinder::Campfire.new @config[:subdomain], :token => @config[:token]
        end
      end
      
      def write(name, msgtype, *msg)
        return false if !enabled? or msgtype != :announce
        
        room = @campfire.find_room_by_name(@config[:room])
        Array(msg).each do |m|
          room.speak "[#{@host}::#{name}] #{m}"
        end
      end
      
      def enabled?
        !@config[:subdomain].empty? && !@config[:token].empty? && !@config[:room].empty?
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gina-conveyor-0.2.3 lib/conveyor/output/campfire.rb
gina-conveyor-0.2.2 lib/conveyor/output/campfire.rb
gina-conveyor-0.2.1 lib/conveyor/output/campfire.rb
gina-conveyor-0.2.0 lib/conveyor/output/campfire.rb
gina-conveyor-0.1.3 lib/conveyor/output/campfire.rb
gina-conveyor-0.1.2 lib/conveyor/output/campfire.rb
gina-conveyor-0.1.1 lib/conveyor/output/campfire.rb
gina-conveyor-0.1.0 lib/conveyor/output/campfire.rb