Class: Travis::Stalker::Charlie

Inherits:
Object
  • Object
show all
Defined in:
lib/travis/stalker/charlie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pusher_token, projects = [], regex = false) ⇒ Charlie

Initialize a new connection to travis feed

publisher_token - pusher token id projects - Array of projects to stalk regex - if true then accept partial matches



18
19
20
21
22
23
24
# File 'lib/travis/stalker/charlie.rb', line 18

def initialize(pusher_token, projects=[], regex=false)
  @projects = projects
  @regex    = regex
  @socket   = PusherClient::Socket.new(pusher_token)

  Travis::Stalker.log(regex: regex, projects: projects)
end

Instance Attribute Details

#projectsObject

Returns the value of attribute projects.



10
11
12
# File 'lib/travis/stalker/charlie.rb', line 10

def projects
  @projects
end

Instance Method Details

#regex?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/travis/stalker/charlie.rb', line 26

def regex?
  @regex
end

#startObject



30
31
32
33
34
35
36
# File 'lib/travis/stalker/charlie.rb', line 30

def start
  @socket.subscribe('common')
  @socket['common'].bind('build:finished') do |payload|
    notify(payload_to_notification(JSON.parse(payload)))
  end
  @socket.connect
end