Sha256: 914b35ae483e8f7d013e728250324be22d7949db8a1a2e662c47f3fcd81a8253
Contents?: true
Size: 622 Bytes
Versions: 1
Compression:
Stored size: 622 Bytes
Contents
require 'json' require 'json/add/rails' class Github < Mongrel::HttpHandler def initialize(bot, config); @bot = bot; @config = config; puts "Github enabled"; end def process(request, response) response.start(200) do |head,out| head["Content-Type"] = "text/plain" post = CGI.parse(request.body.read) json = JSON.parse(post['payload'].join(',')) json['commits'].each do |c| @bot.say(@config['irc']['channel'],"[#{json['repository']['name']}] New commit by #{c.last['author']['name']} : #{c.last['message'].gsub(/\n(.*)/, '...')} - #{c.last['url']}") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
irc_cat-0.2.0 | lib/irc_cat/http_server/github.rb |