Skip to content

Commit

Permalink
use shout-bot instead of IRC gem for IRC publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjolicoeur committed Apr 25, 2010
1 parent be4a5db commit c4c96eb
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 781 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
@@ -0,0 +1,6 @@
[submodule "lib/vendor/addressable"]
path = lib/vendor/addressable
url = git://github.com/sporkmonger/addressable.git
[submodule "lib/vendor/shout-bot"]
path = lib/vendor/shout-bot
url = git://github.com/sr/shout-bot.git
1 change: 1 addition & 0 deletions Changelog.txt
Expand Up @@ -10,6 +10,7 @@ in the publisher output and log file
are included in Publisher's formatted_message
* Require a version of the ActionMailer gem from the 2.x branch. The new 3.0 branch
line isn't currently compatible with Cerberus
* IRC publisher how uses Shout-Bot instead of the older IRC library code

== Version 0.7.6
Bugfixes and updates to RSS publisher
Expand Down
21 changes: 8 additions & 13 deletions lib/cerberus/publisher/irc.rb
@@ -1,5 +1,5 @@
require 'rubygems'
require 'IRC'
require 'shout-bot'
require 'cerberus/publisher/base'

class Cerberus::Publisher::IRC < Cerberus::Publisher::Base
Expand All @@ -9,19 +9,14 @@ def self.publish(state, manager, options)
subject,body = Cerberus::Publisher::Base.formatted_message(state, manager, options)
message = subject + "\n" + '*' * subject.length + "\n" + body

port = irc_options[:port] || 6667
nick = irc_options[:nick] || 'cerberus'
server = irc_options[:server]
channel = '#' + irc_options[:channel]
bot = IRC.new(irc_options[:nick] || 'cerberus', irc_options[:server], irc_options[:port] || 6667)

silence_stream(STDOUT) do
IRCEvent.add_callback('endofmotd') do |event|
bot.add_channel(channel)
message.split("\n").each do |line|
bot.send_message(channel, line)
end
bot.send_quit
end
bot.connect

ShoutBot.shout("irc://#{nick}@#{server}:#{port}/#{channel}") do |channel|
message.split("\n").each { |line| channel.say line }
end

end
end
1 change: 1 addition & 0 deletions lib/vendor/addressable
Submodule addressable added at e07dd1
23 changes: 0 additions & 23 deletions lib/vendor/irc/README

This file was deleted.

164 changes: 0 additions & 164 deletions lib/vendor/irc/lib/IRC.rb

This file was deleted.

33 changes: 0 additions & 33 deletions lib/vendor/irc/lib/IRCChannel.rb

This file was deleted.

0 comments on commit c4c96eb

Please sign in to comment.