Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:cpjolicoeur/cerberus
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjolicoeur committed Aug 5, 2009
2 parents a5ba52f + aac7b18 commit ad29852
Show file tree
Hide file tree
Showing 267 changed files with 28,896 additions and 30 deletions.
3 changes: 2 additions & 1 deletion Changelog.txt
@@ -1,10 +1,11 @@
= Cerberus Changelog

== Version 0.7
New config options, Bazaar SCM support, bugfixes
New config options, Bazaar SCM support, removed GMailer bugfixes

* added support for bazaar scm
* fixed bug with ActionMailer 2.3.3
* removed GMailer library. Use default Mail publisher instead
* added 'build_dir' option for setting custom build directory
* added 'setup_script' option for a custom script to be run before build command
* Projects using the Git SCM were not getting the full diff output in their
Expand Down
4 changes: 0 additions & 4 deletions Rakefile
Expand Up @@ -52,10 +52,6 @@ GEM_SPEC = Gem::Specification.new do |s|
s.add_dependency 'actionmailer', '>= 1.3.3'
s.add_dependency 'activesupport', '>= 1.4.2'
s.add_dependency 'rake', '>= 0.7.3'
s.add_dependency 'xmpp4r', '>= 0.3.1'
s.add_dependency 'Ruby-IRC', '>= 1.0.7'
s.add_dependency 'gmailer', '>= 0.1.7'
s.add_dependency 'twitter4r', '>= 0.3.0'

s.files = Dir.glob("{bin,lib,test}/**/*").delete_if { |item| item.include?('__workdir') }
s.files += %w(License.txt Readme.markdown Changelog.txt Rakefile)
Expand Down
4 changes: 1 addition & 3 deletions Readme.markdown
Expand Up @@ -35,10 +35,7 @@ Main advantages of Cerberus over other solutions include:
* rake - 0.7.3 or higher (optional)
* actionmailer - 1.3.3 or higher (optional)
* activesupport - 1.4.2 or higher (optional)
* xmpp4r - 0.3.1 or higher (optional)
* Ruby-IRC - 1.0.7 or higher (optional)
* gmailer - 0.1.7 or higher (optional)
* twitter4r - 0.3.0 or higher (optional)

## Usage

Expand Down Expand Up @@ -89,6 +86,7 @@ Cerberus currently supports the following SCM tools:
* Darcs
* Perforce
* CVS
* Bazaar

Cerberus currently supports the following notification systems:

Expand Down
1 change: 1 addition & 0 deletions Todo.txt
Expand Up @@ -9,6 +9,7 @@

* Ruby 1.9 compatibility
* Update or split-out the bin_path setting
* add test suite for Bazaar SCM
* make --verbose option work with all SCM, Builders and Publishers
* update rake builder to only check exit status or aborted msg
* Add smart algorithm for calculating of person's name who broke release
Expand Down
2 changes: 1 addition & 1 deletion lib/cerberus/builder/rake.rb
Expand Up @@ -6,6 +6,6 @@ def initialize(config)
end

def successful?
$?.exitstatus == 0 and not @output.include?("#{@cmd} aborted!") and @output.include?("0 failures, 0 errors")
$?.exitstatus == 0 and not @output.include?("#{@cmd} aborted!")
end
end
3 changes: 1 addition & 2 deletions lib/cerberus/component_lazy_loader.rb
Expand Up @@ -45,8 +45,7 @@ def self.guess_type(path)

module Publisher
TYPES = {
:mail => 'Mail', #Cerberus::Publisher
:gmailer => 'Gmailer',
:mail => 'Mail',
:jabber => 'Jabber',
:irc => 'IRC',
:rss => 'RSS',
Expand Down
17 changes: 0 additions & 17 deletions lib/cerberus/publisher/gmailer.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/cerberus/publisher/twitter.rb
Expand Up @@ -13,7 +13,6 @@ def Time.parse(args)
class Cerberus::Publisher::Twitter < Cerberus::Publisher::Base
def self.publish(state, manager, options)
begin
gem 'twitter4r', '>=0.3.0'
require 'twitter'

twitter_options = options[:publisher, :twitter]
Expand Down
5 changes: 5 additions & 0 deletions lib/cerberus/utils.rb
@@ -1,5 +1,10 @@
require 'yaml'

# Load in vendor libraries
for dir in Dir[File.join(File.dirname(__FILE__), '..', 'vendor', '*')]
$: << File.join(dir, 'lib')
end

module Cerberus
module Utils
def say(msg)
Expand Down
23 changes: 23 additions & 0 deletions lib/vendor/irc/README
@@ -0,0 +1,23 @@
= Ruby-IRC

Framework for IRC clients

== What is it?

Ruby-IRC is a simple framework for creating clients for IRC. It will
monitor multiple IO sockets for data. Allows user defined handlers
for IRC events.

== A simple usage example

bot = IRC.new("Nickname", "server.example.com", "6667", "Realname")
IRCEvent.add_callback('endofmotd') { |event| bot.add_channel('#eris') }
IRCEvent.add_callback('join') { |event|
bot.send_message(event.channel, "Hello #{event.from}")
}
bot.connect

== Author
Chris Boyer

email: cboyer@musiciansfriend.com
164 changes: 164 additions & 0 deletions lib/vendor/irc/lib/IRC.rb
@@ -0,0 +1,164 @@

require 'socket'
require 'IRCConnection'
require 'IRCEvent'
require 'IRCChannel'
require 'IRCUser'
require 'IRCUtil'



# Class IRC is a master class that handles connection to the irc
# server and pasring of IRC events, through the IRCEvent class.
class IRC
@channels = nil
# Create a new IRC Object instance
def initialize( nick, server, port, realname='RBot', options = {})
@nick = nick
@server = server
@port = port
@realname = realname
@channels = Array.new(0)
# Some good default Event handlers. These can and will be overridden by users.
# Thses make changes on the IRCbot object. So they need to be here.

# Topic events can come on two tags, so we create one proc to handle them.
topic_proc = Proc.new { |event|
self.channels.each { |chan|
if chan == event.channel
chan.topic = event.message
end
}
}

IRCEvent.add_handler('332', topic_proc)
IRCEvent.add_handler('topic', topic_proc)
@@options = options;

end

attr_reader :nick, :server, :port

# Join a channel, adding it to the list of joined channels
def add_channel channel
join(channel)
self
end

# Returns a list of channels joined
def channels
@channels
end

# Alias for IRC.connect
def start
self.connect
end

# Open a connection to the server using the IRC Connect
# method. Events yielded from the IRCConnection handler are
# processed and then control is returned to IRCConnection
def connect
quithandler = lambda { send_quit(); IRCConnection.quit }
trap("INT", quithandler)
trap("TERM", quithandler)

IRCConnection.handle_connection(@server, @port, @nick, @realname, @@options) do
# Log in information moved to IRCConnection
@threads = []
IRCConnection.main do |event|
if event.kind_of?(Array)
event.each {|event|
thread_event(event)
}
else
thread_event(event)
end
# Memory leak patch thanks to Patrick Sinclair
@threads.delete_if {|thr| thr.stop? }
end
@threads.each {|thr| thr.join }
end
end

# Joins a channel on a server.
def join(channel)
if (IRCConnection.send_to_server("JOIN #{channel}"))
@channels.push(IRCChannel.new(channel));
end
end

# Leaves a channel on a server
def part(channel)
if (IRCConnection.send_to_server("PART #{channel}"))
@channels.delete_if {|chan| chan.name == channel }
end
end

# kicks a user from a channel (does not check for operator privledge)
def kick(channel, user, message)
IRCConnection.send_to_server("KICK #{channel} #{user} :#{message || user || 'kicked'}")
end

# sets the topic of the given channel
def set_topic(channel, topic)
IRCConnection.send_to_server("TOPIC #{channel} :#{topic}");
end

# Sends a private message, or channel message
def send_message(to, message)
IRCConnection.send_to_server("privmsg #{to} :#{message}");
end

# Sends a notice
def send_notice(to, message)
IRCConnection.send_to_server("NOTICE #{to} :#{message}");
end

# performs an action
def send_action(to, action)
send_ctcp(to, 'ACTION', action);
end

# send CTCP
def send_ctcp(to, type, message)
IRCConnection.send_to_server("privmsg #{to} :\001#{type} #{message}");
end

# Quits the IRC Server
def send_quit
IRCConnection.send_to_server("QUIT : Quit ordered by user")
end

# Ops selected user.
def op(channel, user)
IRCConnection.send_to_server("MODE #{channel} +o #{user}")
end

# Changes the current nickname
def ch_nick(nick)
IRCConnection.send_to_server("NICK #{nick}")
@nick = nick
end

# Removes operator status from a user
def deop(channel, user)
IRCConnection.send_to_server("MODE #{channel} -o #{user}")
end

# Changes target users mode
def mode(channel, user, mode)
IRCConnection.send_to_server("MODE #{channel} #{mode} #{user}")
end

# Retrievs user information from the server
def get_user_info(user)
IRCConnection.send_to_server("WHO #{user}")
end
private
def thread_event (event)
@threads << Thread.new(event) {|localevent|
localevent.process
}
end
end
33 changes: 33 additions & 0 deletions lib/vendor/irc/lib/IRCChannel.rb
@@ -0,0 +1,33 @@
require "IRCUser"

# Represents an IRC Channel
class IRCChannel
def initialize(name)
@name = name
@users = Array.new(0)
end
attr_reader :name

# set the topic on this channel
def topic=(topic)
@topic = topic
end

# get the topic on this channel
def topic
if @topic
return @topic
end
return "No Topic set"
end

# add a user to this channel's userlist
def add_user(username)
@users.push(IRCUser.create_user(username))
end

# returns the current user list for this channel
def users
@users
end
end

0 comments on commit ad29852

Please sign in to comment.