Sha256: 5aef141c22f6dc7bde87ab924be5c40a3733151d4a93fb918a29b5d5ccb7e325
Contents?: true
Size: 830 Bytes
Versions: 1
Compression:
Stored size: 830 Bytes
Contents
module Perkins #this should be a daemon #it will listen incoming messages #it will run the propper repo with runner commands #it will pass the message to other daemon to notify #it will deploy ? class Listener attr_accessor :app def run! #chan't use the same $redis conn because it fails #TODO: reconnect with same settings redis_conn = Redis.new() redis_conn.subscribe('perkins:commits') do |on| on.message do |channel, msg| exec_runner(channel, msg) end end end def exec_runner(channel, msg) data = JSON.parse(msg) puts "##{channel} - [#{data['name']}]: #{data['sha']}" repo = Perkins::Repo.find(data["id"]) #Thread.new do Worker.perform(repo, data['sha'], data['branch'] ) #end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
perkins-0.0.1 | lib/perkins/listener.rb |