From 473174b57078b0611716c81e0c90d04ff3aea8bd Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 10 Feb 2010 15:55:13 -0600 Subject: [PATCH 01/21] Fix regexp to recognize revno from merged revisions --- lib/cerberus/scm/bzr.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cerberus/scm/bzr.rb b/lib/cerberus/scm/bzr.rb index 23b8ad1..f0ec7c2 100644 --- a/lib/cerberus/scm/bzr.rb +++ b/lib/cerberus/scm/bzr.rb @@ -64,7 +64,7 @@ def extract_last_commit_info # message: # sidfugsdiufgsdifusdg - @revision = lastlog.match(/^revno: (\d+)$/)[1].to_i + @revision = lastlog.match(/^revno: (\d+).*$/)[1].to_i @author = lastlog.match(/^committer: (.+)$/)[1] @date = Time.parse(lastlog.match(/^timestamp: (.+)$/)[1]) @message = lastlog.match(/message:\n (.*)/m)[1] From de3b8df6c9f20d7e5fe877b537cd9ed8255aff7f Mon Sep 17 00:00:00 2001 From: Peter Fitzgibbons Date: Mon, 5 Apr 2010 22:34:28 -0500 Subject: [PATCH 02/21] Fix cleanup issue on IntegrationTest --- test/integration_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration_test.rb b/test/integration_test.rb index 349cc66..32f9682 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -121,6 +121,6 @@ def test_hook # File.rm_f tmp_file run_cerb("build hooks") assert_equal some_number.to_s, IO.read(tmp_file).strip - File.rm_f tmp_file + FileUtils.rm_f tmp_file end end From 525fef39b59fa13ab8005ab8a6a4dc103272e9d9 Mon Sep 17 00:00:00 2001 From: Peter Fitzgibbons Date: Tue, 6 Apr 2010 06:05:26 -0500 Subject: [PATCH 03/21] * Updated output/reporting of :setup_script during Manager#run. Results are included in Publisher's formatted_message * Update site options.page --- Changelog.txt | 7 +++++++ doc/site/src/credits.page | 1 + doc/site/src/options.page | 1 + lib/cerberus/manager.rb | 8 +++++--- lib/cerberus/publisher/base.rb | 2 +- test/functional_test.rb | 15 +++++++++++++++ test/irc_publisher_test.rb | 1 + test/mock/manager.rb | 2 +- 8 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index cf2d2c5..34754e6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,12 @@ = Cerberus Changelog +== Version 0.7.7 +Update to Setup Script configuration + +* Updated output/reporting of :setup_script during Manager#run. Results +are included in Publisher's formatted_message +* Update site options.page + == Version 0.7.6 Bugfixes and updates to RSS publisher diff --git a/doc/site/src/credits.page b/doc/site/src/credits.page index 0b4427c..0ba118d 100644 --- a/doc/site/src/credits.page +++ b/doc/site/src/credits.page @@ -20,3 +20,4 @@ The following people made notable contributions to the Cerberus tool: * [Paul Hinze](http://phinze.com/) - Bazaar SCM support * [McClain Looney](http://github.com/mlooney) - Mercurial Support * [Michael](http://github.com/iconoclast) - RSS Publisher updates +* [Peter Fitzgibbons](http://github.com/pjfitzgibbons) - Setup Script support \ No newline at end of file diff --git a/doc/site/src/options.page b/doc/site/src/options.page index c53c12c..5824349 100644 --- a/doc/site/src/options.page +++ b/doc/site/src/options.page @@ -54,6 +54,7 @@ scm: password: view: #for perforce only branch: #for git only +setup_script: builder: type: rake: diff --git a/lib/cerberus/manager.rb b/lib/cerberus/manager.rb index 7b3aec2..a5b61c9 100644 --- a/lib/cerberus/manager.rb +++ b/lib/cerberus/manager.rb @@ -79,7 +79,7 @@ def run end class BuildCommand - attr_reader :builder, :success, :scm, :status + attr_reader :builder, :success, :scm, :status, :setup_script_output DEFAULT_CONFIG = {:scm => {:type => 'svn'}, :log => {:enable => true}, @@ -114,7 +114,9 @@ def run if @scm.has_changes? or @config[:force] or @status.previous_build_successful.nil? Dir.chdir File.join(@config[:application_root], @config[:build_dir] || '') - `#{@config[:setup_script]}` if @config[:setup_script] +# require 'rubygems'; require 'ruby-debug'; Debugger.start +# debugger if caller.join.include? "functional_test.rb:201" + @setup_script_output = `#{@config[:setup_script]}` if @config[:setup_script] build_successful = @builder.run @status.keep(build_successful, @scm.current_revision, @builder.brokeness) @@ -126,7 +128,7 @@ def run time = Time.now.strftime("%Y%m%d%H%M%S") file_name = "#{log_dir}/#{time}-#{@status.current_state.to_s}.log" - body = [ scm.last_commit_message, builder.output ].join("\n\n") + body = [ @setup_script_output, scm.last_commit_message, builder.output ].join("\n\n") IO.write(file_name, body) end diff --git a/lib/cerberus/publisher/base.rb b/lib/cerberus/publisher/base.rb index 54d08ab..95d8e11 100644 --- a/lib/cerberus/publisher/base.rb +++ b/lib/cerberus/publisher/base.rb @@ -38,7 +38,7 @@ def self.formatted_message(state, manager, options) if options[:changeset_url] body << options[:changeset_url] + manager.scm.current_revision.to_s + "\n" end - body += [ manager.builder.output, generated_by ] + body += [ manager.setup_script_output, manager.builder.output, generated_by ].compact return subject, body.join("\n") end diff --git a/test/functional_test.rb b/test/functional_test.rb index bd27f73..8d7a5da 100644 --- a/test/functional_test.rb +++ b/test/functional_test.rb @@ -190,6 +190,21 @@ def test_custom_task_for_rake assert_match /Task 'custom2' has been invoked/, output end + def test_build_setup_script + add_application('rake_cust', SVN_URL, { + 'builder' => {'rake' => {'task' => 'custom1'}}, + 'setup_script' => "echo 'setup script has been invoked' ", + } + ) + + build = Cerberus::BuildAllCommand.new + build.run + assert_equal 1, ActionMailer::Base.deliveries.size + output = ActionMailer::Base.deliveries[0].body + assert_match /setup script has been invoked/, output + assert_match /Task 'custom1' has been invoked/, output + end + def test_logs_disabled add_application('rake_cust', SVN_URL, 'log' => {'enable' => false}) build = Cerberus::BuildAllCommand.new diff --git a/test/irc_publisher_test.rb b/test/irc_publisher_test.rb index bb43bc1..981f48b 100644 --- a/test/irc_publisher_test.rb +++ b/test/irc_publisher_test.rb @@ -14,6 +14,7 @@ def test_publisher Cerberus::Publisher::IRC.publish(build_status(true), build, options) assert IRCConnection.connected +puts "IRC Messages:\n#{IRCConnection.messages.inspect}" assert IRCConnection.messages.first.include?('JOIN') assert_equal 7, IRCConnection.messages.size end diff --git a/test/mock/manager.rb b/test/mock/manager.rb index b0d78c1..f768f19 100644 --- a/test/mock/manager.rb +++ b/test/mock/manager.rb @@ -1,5 +1,5 @@ class DummyManager - attr_reader :builder, :scm + attr_reader :builder, :scm, :setup_script_output DummyScm = Struct.new(:last_commit_message, :current_revision, :last_author) DummyBuilder = Struct.new(:output) From 2d15835bae6bc37c98949e6d320d87f46044f8da Mon Sep 17 00:00:00 2001 From: phinze Date: Wed, 21 Apr 2010 07:42:36 -0500 Subject: [PATCH 04/21] make hg test not require certain user config --- test/functional_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional_test.rb b/test/functional_test.rb index bd27f73..8131657 100644 --- a/test/functional_test.rb +++ b/test/functional_test.rb @@ -373,7 +373,7 @@ def test_ok curr_dir = Dir.pwd Dir.chdir HG_REPO `hg add #{test_case_name}` - `hg commit -m 'somepatch'` + `hg commit -m 'somepatch' --config ui.username='Fake User '` Dir.chdir curr_dir build = Cerberus::BuildCommand.new('hgapp') From b5d69672f749c6dec0d3c0e37b97f0001bb2f102 Mon Sep 17 00:00:00 2001 From: phinze Date: Wed, 21 Apr 2010 07:43:58 -0500 Subject: [PATCH 05/21] Change use of ftools to fileutils, fixing test --- test/integration_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration_test.rb b/test/integration_test.rb index 349cc66..32f9682 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -121,6 +121,6 @@ def test_hook # File.rm_f tmp_file run_cerb("build hooks") assert_equal some_number.to_s, IO.read(tmp_file).strip - File.rm_f tmp_file + FileUtils.rm_f tmp_file end end From ab09282f46a28e538ccb9a17ed83372989575088 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Thu, 22 Apr 2010 10:15:01 -0400 Subject: [PATCH 06/21] update Todo --- Todo.txt | 2 ++ doc/site/src/credits.page | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Todo.txt b/Todo.txt index 1f55ad8..47606b0 100644 --- a/Todo.txt +++ b/Todo.txt @@ -2,6 +2,8 @@ | BEFORE RELEASE | ================== +* Cerberus doesn't work with Rails 3.x ActionMailer gems. Either require AM < 3.x or make work with both + ========== | FUTURE | diff --git a/doc/site/src/credits.page b/doc/site/src/credits.page index 0b4427c..aa50ec6 100644 --- a/doc/site/src/credits.page +++ b/doc/site/src/credits.page @@ -19,4 +19,4 @@ The following people made notable contributions to the Cerberus tool: * [Andrew Timberlake](http://ramblingsonrails.com) - Custom build script support * [Paul Hinze](http://phinze.com/) - Bazaar SCM support * [McClain Looney](http://github.com/mlooney) - Mercurial Support -* [Michael](http://github.com/iconoclast) - RSS Publisher updates +* [Michael Turner](http://github.com/iconoclast) - RSS Publisher updates From 9e81ccb8309b7245ad13bfc621d5082ccd62f5c0 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 24 Apr 2010 19:38:36 -0400 Subject: [PATCH 07/21] start version 0.7.7 branch --- Changelog.txt | 2 ++ lib/cerberus/constants.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index cf2d2c5..3076a6b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,7 @@ = Cerberus Changelog +== Version 0.7.7 + == Version 0.7.6 Bugfixes and updates to RSS publisher diff --git a/lib/cerberus/constants.rb b/lib/cerberus/constants.rb index 197e50f..27e7093 100644 --- a/lib/cerberus/constants.rb +++ b/lib/cerberus/constants.rb @@ -4,5 +4,5 @@ module Cerberus LOCK_WAIT = 30 * 60 # 30 minutes - VERSION = '0.7.6' + VERSION = '0.7.7' end From 66a0c17658cc6008018fc91ceeb332dc2f00be81 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 20 Mar 2010 18:20:16 +0800 Subject: [PATCH 08/21] changed extract_commit_info to include entire commit message instead of the diff In a "status summary" context the entire commit message is likely to be of more use than the actual code diff. The commit id can be used to link to the actual changeset in the repo itself for following up on code changes. --- lib/cerberus/scm/git.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cerberus/scm/git.rb b/lib/cerberus/scm/git.rb index c8bc797..584095c 100644 --- a/lib/cerberus/scm/git.rb +++ b/lib/cerberus/scm/git.rb @@ -71,7 +71,7 @@ def execute(command, parameters = nil, with_path = true) end def extract_commit_info( commit=remote_head ) - message = execute("show", "#{ commit } --pretty='format:%an(%ae)|%ai|%H|%s'").split("|") + message = execute("log", "#{ commit } -1 --pretty='format:%an(%ae)|%ai|%H|%s%n%n%b'").split("|") return { :author => message[0], :date => message[1], :revision => message[2], :message => message[3] } end From c0b1604618cee640cf41f64e0af648439eaad673 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 23 Mar 2010 13:16:07 +0800 Subject: [PATCH 09/21] sort by the project names before displaying list or status --- lib/cerberus/manager.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cerberus/manager.rb b/lib/cerberus/manager.rb index 7b3aec2..41cbe1a 100644 --- a/lib/cerberus/manager.rb +++ b/lib/cerberus/manager.rb @@ -221,7 +221,7 @@ def run else puts "List of active projects:" - projects.each do |fn| + projects.sort.each do |fn| fn =~ %r{#{HOME}/config/(.*).yml} puts " * #{$1}" @@ -237,7 +237,7 @@ def initialize(cli_options = {}) end def run - projects = Dir["#{HOME}/config/*.yml"].map { |fn| fn.gsub(/.*\/(.*).yml$/, '\1') } + projects = Dir["#{HOME}/config/*.yml"].sort.map { |fn| fn.gsub(/.*\/(.*).yml$/, '\1') } if projects.empty? puts "There are not any active projects" else From 1cb4ef7dd7cb1d168de2ed103dc114678037216e Mon Sep 17 00:00:00 2001 From: Peter Fitzgibbons Date: Tue, 6 Apr 2010 11:34:28 +0800 Subject: [PATCH 10/21] Fix cleanup issue on IntegrationTest --- test/integration_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration_test.rb b/test/integration_test.rb index 349cc66..32f9682 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -121,6 +121,6 @@ def test_hook # File.rm_f tmp_file run_cerb("build hooks") assert_equal some_number.to_s, IO.read(tmp_file).strip - File.rm_f tmp_file + FileUtils.rm_f tmp_file end end From 778fa7bb3d259d91810fc712184bef15d562aa43 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 24 Apr 2010 20:30:15 -0400 Subject: [PATCH 11/21] update Changelog --- Changelog.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 34754e6..3aa8ce4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,11 +1,13 @@ = Cerberus Changelog == Version 0.7.7 -Update to Setup Script configuration +Bugfixes and config options updates +* Projects are now sorted when displayed via Cerberus CLI +* Git builder now includes the full commit message and diff in publisher +output log file * Updated output/reporting of :setup_script during Manager#run. Results are included in Publisher's formatted_message -* Update site options.page == Version 0.7.6 Bugfixes and updates to RSS publisher From 62325f0d47a69d2cda5a83ef7c26f4d7a2cd1f6c Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 24 Apr 2010 20:38:45 -0400 Subject: [PATCH 12/21] update Changelog --- Changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 3aa8ce4..e4cac9b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,7 +1,7 @@ = Cerberus Changelog == Version 0.7.7 -Bugfixes and config options updates +Bugfixes, publisher and config options updates * Projects are now sorted when displayed via Cerberus CLI * Git builder now includes the full commit message and diff in publisher From 32e528e522ac2c8ce145138373d9d1a85b7445c8 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 24 Apr 2010 23:19:07 -0400 Subject: [PATCH 13/21] require actionmailer version in the 2.x branch * can't use the new ActionMailer 3.x branch yet --- Changelog.txt | 8 +++++--- Rakefile | 4 ++-- lib/cerberus/publisher/mail.rb | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index e4cac9b..b2bce7f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,13 +1,15 @@ = Cerberus Changelog == Version 0.7.7 -Bugfixes, publisher and config options updates +Bugfixes, publisher and config options updates, ActionMailer gem version requirements * Projects are now sorted when displayed via Cerberus CLI -* Git builder now includes the full commit message and diff in publisher -output log file +* Git builder now includes just the full commit message instead of the commit diff +in the publisher output and log file * Updated output/reporting of :setup_script during Manager#run. Results 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 == Version 0.7.6 Bugfixes and updates to RSS publisher diff --git a/Rakefile b/Rakefile index 4c3190e..4418b69 100644 --- a/Rakefile +++ b/Rakefile @@ -51,8 +51,8 @@ GEM_SPEC = Gem::Specification.new do |s| Cerberus could be easily invoked from Cron (for Unix) or nnCron (for Windows) utilities. DESC - s.add_dependency 'actionmailer', '>= 1.3.3' - s.add_dependency 'activesupport', '>= 1.4.2' + s.add_dependency 'actionmailer', '~> 2.0' + s.add_dependency 'activesupport', '~> 2.0' s.add_dependency 'rake', '>= 0.7.3' s.files = Dir.glob("{bin,lib,test}/**/*").delete_if { |item| item.include?('__workdir') } diff --git a/lib/cerberus/publisher/mail.rb b/lib/cerberus/publisher/mail.rb index d6bc9fe..d68d84c 100644 --- a/lib/cerberus/publisher/mail.rb +++ b/lib/cerberus/publisher/mail.rb @@ -1,4 +1,5 @@ require 'rubygems' +gem 'actionmailer', '~> 2.0' require 'action_mailer' require 'cerberus/publisher/base' From 4f7e5c2889187dbf25957aa3a306a066de926c65 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 24 Apr 2010 23:34:57 -0400 Subject: [PATCH 14/21] attempt to fix error.log error with IRC bot --- lib/vendor/irc/lib/IRCConnection.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vendor/irc/lib/IRCConnection.rb b/lib/vendor/irc/lib/IRCConnection.rb index 619e4fd..8442680 100644 --- a/lib/vendor/irc/lib/IRCConnection.rb +++ b/lib/vendor/irc/lib/IRCConnection.rb @@ -8,14 +8,14 @@ class IRCConnection @@last_send = Time.now.to_f @@message_delay = 0.2 # Default delay to 1 fifth of a second. # Creates a socket connection and then yields. - def IRCConnection.handle_connection(server, port, nick='ChangeMe', realname='MeToo', options = nil) + def IRCConnection.handle_connection(server, port, nick='ChangeMe', realname='MeToo', options = {}) #nil) @server = server; @port = port @nick = nick @realname = realname @@options = options if options.nil? - @@options = Array.new(0) + @@options = {} #Array.new(0) end socket = create_tcp_socket(server, port) add_IO_socket(socket) {|sock| From e27eae0ad71e0d7778f7a9ac2ccef04ba0b69dc5 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 24 Apr 2010 23:42:15 -0400 Subject: [PATCH 15/21] update docs --- Changelog.txt | 2 +- Todo.txt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index b2bce7f..751300f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -4,7 +4,7 @@ Bugfixes, publisher and config options updates, ActionMailer gem version requirements * Projects are now sorted when displayed via Cerberus CLI -* Git builder now includes just the full commit message instead of the commit diff +* Git builder now includes just the commit message instead of the commit diff in the publisher output and log file * Updated output/reporting of :setup_script during Manager#run. Results are included in Publisher's formatted_message diff --git a/Todo.txt b/Todo.txt index 47606b0..d460fca 100644 --- a/Todo.txt +++ b/Todo.txt @@ -1,8 +1,9 @@ -================== -| BEFORE RELEASE | -================== +=========================== +| BEFORE RELEASE - v0.7.7 | +=========================== * Cerberus doesn't work with Rails 3.x ActionMailer gems. Either require AM < 3.x or make work with both +* Functional test is not completely passing ========== From be4a5db7e1351e32d5560d8c3a415916ef08fbfd Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sun, 25 Apr 2010 09:39:49 -0400 Subject: [PATCH 16/21] update Todo and fix a typo --- Todo.txt | 3 +-- test/functional_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Todo.txt b/Todo.txt index d460fca..0e10637 100644 --- a/Todo.txt +++ b/Todo.txt @@ -2,14 +2,13 @@ | BEFORE RELEASE - v0.7.7 | =========================== -* Cerberus doesn't work with Rails 3.x ActionMailer gems. Either require AM < 3.x or make work with both -* Functional test is not completely passing ========== | FUTURE | ========== +* Functional test is not completely passing (test_darcs) * Update or split-out the bin_path setting * add test suite for Bazaar SCM * make --verbose option work with all SCM, Builders and Publishers diff --git a/test/functional_test.rb b/test/functional_test.rb index c4df4b4..9f96aac 100644 --- a/test/functional_test.rb +++ b/test/functional_test.rb @@ -136,7 +136,7 @@ def test_send_on_different_events # assert_equal 1, ActionMailer::Base.deliveries.size end - def test_multiply_publishers_without_configuration + def test_multiple_publishers_without_configuration add_application('myapp', SVN_URL, 'publisher' => {'active' => 'mail , jabber , irc, dddd'}) build = Cerberus::BuildCommand.new('myapp') @@ -348,14 +348,14 @@ def test_ok def test_mercurial add_application('hgapp', HG_URL, :scm => {:type => 'hg'}) - + build = Cerberus::BuildCommand.new('hgapp') build.run assert build.scm.has_changes? assert_equal 1, ActionMailer::Base.deliveries.size #first email that project was setup mail = ActionMailer::Base.deliveries[0] output = mail.body - + #Check output that run needed tasks assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, output assert output !~ /Task 'custom1' has been invoked/ From c4c96ebf0ca03d4a7b14e7414a56661be5b66613 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sun, 25 Apr 2010 09:42:17 -0400 Subject: [PATCH 17/21] use shout-bot instead of IRC gem for IRC publisher --- .gitmodules | 6 + Changelog.txt | 1 + lib/cerberus/publisher/irc.rb | 21 +-- lib/vendor/addressable | 1 + lib/vendor/irc/README | 23 --- lib/vendor/irc/lib/IRC.rb | 164 ------------------ lib/vendor/irc/lib/IRCChannel.rb | 33 ---- lib/vendor/irc/lib/IRCConnection.rb | 134 --------------- lib/vendor/irc/lib/IRCEvent.rb | 91 ---------- lib/vendor/irc/lib/IRCUser.rb | 23 --- lib/vendor/irc/lib/IRCUtil.rb | 49 ------ lib/vendor/irc/lib/eventmap.yml | 247 ---------------------------- lib/vendor/shout-bot | 1 + test/irc_publisher_test.rb | 8 +- 14 files changed, 21 insertions(+), 781 deletions(-) create mode 100644 .gitmodules create mode 160000 lib/vendor/addressable delete mode 100644 lib/vendor/irc/README delete mode 100644 lib/vendor/irc/lib/IRC.rb delete mode 100644 lib/vendor/irc/lib/IRCChannel.rb delete mode 100644 lib/vendor/irc/lib/IRCConnection.rb delete mode 100644 lib/vendor/irc/lib/IRCEvent.rb delete mode 100644 lib/vendor/irc/lib/IRCUser.rb delete mode 100644 lib/vendor/irc/lib/IRCUtil.rb delete mode 100644 lib/vendor/irc/lib/eventmap.yml create mode 160000 lib/vendor/shout-bot diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..14def06 --- /dev/null +++ b/.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 diff --git a/Changelog.txt b/Changelog.txt index 751300f..d333bcb 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -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 diff --git a/lib/cerberus/publisher/irc.rb b/lib/cerberus/publisher/irc.rb index 41c2d95..65d217e 100644 --- a/lib/cerberus/publisher/irc.rb +++ b/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 @@ -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 diff --git a/lib/vendor/addressable b/lib/vendor/addressable new file mode 160000 index 0000000..e07dd1c --- /dev/null +++ b/lib/vendor/addressable @@ -0,0 +1 @@ +Subproject commit e07dd1c771f4de0b5830ae8823d72d7ed7ad0e5e diff --git a/lib/vendor/irc/README b/lib/vendor/irc/README deleted file mode 100644 index 9f6a8c7..0000000 --- a/lib/vendor/irc/README +++ /dev/null @@ -1,23 +0,0 @@ -= 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 diff --git a/lib/vendor/irc/lib/IRC.rb b/lib/vendor/irc/lib/IRC.rb deleted file mode 100644 index 5dcc97e..0000000 --- a/lib/vendor/irc/lib/IRC.rb +++ /dev/null @@ -1,164 +0,0 @@ - -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 diff --git a/lib/vendor/irc/lib/IRCChannel.rb b/lib/vendor/irc/lib/IRCChannel.rb deleted file mode 100644 index d74724a..0000000 --- a/lib/vendor/irc/lib/IRCChannel.rb +++ /dev/null @@ -1,33 +0,0 @@ -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 diff --git a/lib/vendor/irc/lib/IRCConnection.rb b/lib/vendor/irc/lib/IRCConnection.rb deleted file mode 100644 index 8442680..0000000 --- a/lib/vendor/irc/lib/IRCConnection.rb +++ /dev/null @@ -1,134 +0,0 @@ - -# Handles connection to IRC Server -class IRCConnection - @@quit = 0 - @@readsockets = Array.new(0) - @@output_buffer = Array.new(0) - @@events = Hash.new() - @@last_send = Time.now.to_f - @@message_delay = 0.2 # Default delay to 1 fifth of a second. - # Creates a socket connection and then yields. - def IRCConnection.handle_connection(server, port, nick='ChangeMe', realname='MeToo', options = {}) #nil) - @server = server; - @port = port - @nick = nick - @realname = realname - @@options = options - if options.nil? - @@options = {} #Array.new(0) - end - socket = create_tcp_socket(server, port) - add_IO_socket(socket) {|sock| - begin - IRCEvent.new(sock.readline.chomp) - rescue Errno::ECONNRESET - # Catches connection reset by peer, attempts to reconnect - # after sleeping for 10 second. - remove_IO_socket(sock) - sleep 10 - handle_connection(@server, @port, @nick, @realname, @@options) - end - } - send_to_server "NICK #{nick}" - send_to_server "USER #{nick} 8 * :#{realname}" - if block_given? - yield - @@socket.close - end - end - - def IRCConnection.create_tcp_socket(server, port) - # Now with SSL Support. Thanks to dominiek@digigen.nl for the idea on this. - tcpsocket = TCPsocket.open(server, port) - if @@options[:use_ssl] - ssl_context = OpenSSL::SSL::SSLContext.new() - ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE - @@socket = OpenSSL::SSL::SSLSocket.new(tcpsocket, ssl_context) - @@socket.sync = true - @@socket.connect - else - @@socket = tcpsocket - end - - if block_given? - yield - @@socket.close - return - end - return @@socket - end - - # Sends a line of text to the server - def IRCConnection.send_to_server(line) - @@socket.write(line + "\n") - end - - # Adds data an output buffer. This let's us keep a handle on how - # fast we send things. Yay. - def IRCConnection.output_push(line) - @@output_buffer.push(line) - end - - # This loop monitors all IO_Sockets IRCConnection controls - # (including the IRC socket) and yields events to the IO_Sockets - # event handler. - def IRCConnection.main - while(@@quit == 0) - do_one_loop { |event| - yield event - } - end - end - - # Makes one single loop pass, checking all sockets for data to read, - # and yields the data to the sockets event handler. - def IRCConnection.do_one_loop - read_sockets = select(@@readsockets, nil, nil, 0.1); - if !read_sockets.nil? - read_sockets[0].each {|sock| - if sock.eof? && sock == @@socket - remove_IO_socket(sock) - sleep 10 - handle_connection(@server, @port, @nick, @realname) - else - yield @@events[sock.object_id.to_i].call(sock) - end - } - end - if @@output_buffer.length > 0 - timer = Time.now.to_f - if (timer > @@last_send + @@message_delay) - message = @@output_buffer.shift(); - if !message.nil? - IRCConnection.send_to_server(message); - @@last_send = timer - end - end - end - end - - # Ends connection to the irc server - def IRCConnection.quit - @@quit = 1 - end - def IRCConnection.delay=(delay) - @@message_delay = delay.to_f - end - # Retrieves user info from the server - def IRCConnection.get_user_info(user) - IRCConnection.send_to_server("WHOIS #{user}") - end - - # Adds a new socket to the list of sockets to monitor for new data. - def IRCConnection.add_IO_socket(socket, &event_generator) - @@readsockets.push(socket) - @@events[socket.object_id.to_i] = event_generator - end - - def IRCConnection.remove_IO_socket(sock) - sock.close - @@readsockets.delete_if {|item| item == sock } - end -end - - diff --git a/lib/vendor/irc/lib/IRCEvent.rb b/lib/vendor/irc/lib/IRCEvent.rb deleted file mode 100644 index 78cb4a5..0000000 --- a/lib/vendor/irc/lib/IRCEvent.rb +++ /dev/null @@ -1,91 +0,0 @@ -require 'yaml' - -# This is a lookup class for IRC event name mapping -class EventLookup - @@lookup = YAML.load_file("#{File.dirname(__FILE__)}/eventmap.yml") - - # returns the event name, given a number - def EventLookup::find_by_number(num) - return @@lookup[num.to_i] - end -end - - -# Handles an IRC generated event. -# Handlers are for the IRC framework to use -# Callbacks are for users to add. -# Both handlers and callbacks can be called for the same event. -class IRCEvent - @@handlers = { 'ping' => lambda {|event| IRCConnection.send_to_server("PONG #{event.message}") } } - @@callbacks = Hash.new() - attr_reader :hostmask, :message, :event_type, :from, :channel, :target, :mode, :stats - def initialize (line) - line.sub!(/^:/, '') - mess_parts = line.split(':', 2); - # mess_parts[0] is server info - # mess_parts[1] is the message that was sent - @message = mess_parts[1] - @stats = mess_parts[0].scan(/[-`\^\{\}\[\]\w.\#\@\+]+/) - if @stats[0].match(/^PING/) - @event_type = 'ping' - elsif @stats[1] && @stats[1].match(/^\d+/) - @event_type = EventLookup::find_by_number(@stats[1]); - @channel = @stats[3] - else - @event_type = @stats[2].downcase if @stats[2] - end - - if @event_type != 'ping' - @from = @stats[0] - @user = IRCUser.create_user(@from) - end - # FIXME: this list would probably be more accurate to exclude commands than to include them - @hostmask = @stats[1] if %W(topic privmsg join).include? @event_type - @channel = @stats[3] if @stats[3] && !@channel - @target = @stats[5] if @stats[5] - @mode = @stats[4] if @stats[4] - if @mode.nil? && @event_type == 'mode' - # Server modes (like +i) are sent in the 'message' part, and not - # the 'stat' part of the message. - @mode = @message - end - - # Unfortunatly, not all messages are created equal. This is our - # special exceptions section - if @event_type == 'join' - @channel = @message - end - - end - - # Adds a callback for the specified irc message. - def IRCEvent.add_callback(message_id, &callback) - @@callbacks[message_id] = callback - end - - # Adds a handler to the handler function hash. - def IRCEvent.add_handler(message_id, proc=nil, &handler) - if block_given? - @@handlers[message_id] = handler - elsif proc - @@handlers[message_id] = proc - end - end - - # Process this event, preforming which ever handler and callback is specified - # for this event. - def process - handled = nil - if @@handlers[@event_type] - @@handlers[@event_type].call(self) - handled = 1 - end - if @@callbacks[@event_type] - @@callbacks[@event_type].call(self) - handled = 1 - end - if !handled - end - end -end - diff --git a/lib/vendor/irc/lib/IRCUser.rb b/lib/vendor/irc/lib/IRCUser.rb deleted file mode 100644 index caee357..0000000 --- a/lib/vendor/irc/lib/IRCUser.rb +++ /dev/null @@ -1,23 +0,0 @@ -# Represents IRC Users -class IRCUser - @@users = Hash.new() - @modes = Hash.new() - - def IRCUser.create_user(username) - username.sub!(/^[\@\%]/,'') - - if @@users[username] - return @@users[username] - end - @@users[username] = self.new(username) - @@users[username] - end - - attr_reader :username, :mask - attr_writer :mask - - private - def initialize (username) - @username = username - end -end diff --git a/lib/vendor/irc/lib/IRCUtil.rb b/lib/vendor/irc/lib/IRCUtil.rb deleted file mode 100644 index f095f05..0000000 --- a/lib/vendor/irc/lib/IRCUtil.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# IRCUtil is a module that contains utility functions for use with the -# rest of Ruby-IRC. There is nothing required of the user to know or -# even use these functions, but they are useful for certain tasks -# regarding IRC connections. -# - -module IRCUtil - # - # Matches hostmasks against hosts. Returns t/f on success/fail. - # - # A hostmask consists of a simple wildcard that describes a - # host or class of hosts. - # - # f.e., where the host is 'bar.example.com', a host mask - # of '*.example.com' would assert. - # - - def assert_hostmask(host, hostmask) - return !!host.match(quote_regexp_for_mask(hostmask)) - end - - module_function :assert_hostmask - - # - # A utility function used by assert_hostmask() to turn hostmasks - # into regular expressions. - # - # Rarely, if ever, should be used by outside code. It's public - # exposure is merely for those who are interested in it's - # functionality. - # - - def quote_regexp_for_mask(hostmask) - # Big thanks to Jesse Williamson for his consultation while writing this. - # - # escape all other regexp specials except for . and *. - # properly escape . and place an unescaped . before *. - # confine the regexp to scan the whole line. - # return the edited hostmask as a string. - hostmask.gsub(/([\[\]\(\)\?\^\$])\\/, '\\1'). - gsub(/\./, '\.'). - gsub(/\*/, '.*'). - sub(/^/, '^'). - sub(/$/, '$') - end - - module_function :quote_regexp_for_mask -end diff --git a/lib/vendor/irc/lib/eventmap.yml b/lib/vendor/irc/lib/eventmap.yml deleted file mode 100644 index cc5377a..0000000 --- a/lib/vendor/irc/lib/eventmap.yml +++ /dev/null @@ -1,247 +0,0 @@ -# 001 ne 1 for the purpose of hash keying apparently. -001 : welcome -002 : yourhost -003 : created -004 : myinfo -005 : map # Undernet Extension, Kajetan@Hinner.com, 17/11/98 -006 : mapmore # Undernet Extension, Kajetan@Hinner.com, 17/11/98 -007 : mapend # Undernet Extension, Kajetan@Hinner.com, 17/11/98 -008 : snomask # Undernet Extension, Kajetan@Hinner.com, 17/11/98 -009 : statmemtot # Undernet Extension, Kajetan@Hinner.com, 17/11/98 -010 : statmem # Undernet Extension, Kajetan@Hinner.com, 17/11/98 -200 : tracelink -201 : traceconnecting -202 : tracehandshake -203 : traceunknown -204 : traceoperator -205 : traceuser -206 : traceserver -208 : tracenewtype -209 : traceclass -211 : statslinkinfo -212 : statscommands -213 : statscline -214 : statsnline -215 : statsiline -216 : statskline -217 : statsqline -218 : statsyline -219 : endofstats -220 : statsbline # UnrealIrcd, Hendrik Frenzel -221 : umodeis -222 : sqline_nick # UnrealIrcd, Hendrik Frenzel -223 : statsgline # UnrealIrcd, Hendrik Frenzel -224 : statstline # UnrealIrcd, Hendrik Frenzel -225 : statseline # UnrealIrcd, Hendrik Frenzel -226 : statsnline # UnrealIrcd, Hendrik Frenzel -227 : statsvline # UnrealIrcd, Hendrik Frenzel -231 : serviceinfo -232 : endofservices -233 : service -234 : servlist -235 : servlistend -241 : statslline -242 : statsuptime -243 : statsoline -244 : statshline -245 : statssline # Reserved, Kajetan@Hinner.com, 17/10/98 -246 : statstline # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -247 : statsgline # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -### TODO: need numerics to be able to map to multiple strings -### 247 : statsxline # UnrealIrcd, Hendrik Frenzel -248 : statsuline # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -249 : statsdebug # Unspecific Extension, Kajetan@Hinner.com, 17/10/98 -250 : luserconns # 1998-03-15 -- tkil -251 : luserclient -252 : luserop -253 : luserunknown -254 : luserchannels -255 : luserme -256 : adminme -257 : adminloc1 -258 : adminloc2 -259 : adminemail -261 : tracelog -262 : endoftrace # 1997-11-24 -- archon -265 : n_local # 1997-10-16 -- tkil -266 : n_global # 1997-10-16 -- tkil -271 : silelist # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -272 : endofsilelist # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -275 : statsdline # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -280 : glist # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -281 : endofglist # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -290 : helphdr # UnrealIrcd, Hendrik Frenzel -291 : helpop # UnrealIrcd, Hendrik Frenzel -292 : helptlr # UnrealIrcd, Hendrik Frenzel -293 : helphlp # UnrealIrcd, Hendrik Frenzel -294 : helpfwd # UnrealIrcd, Hendrik Frenzel -295 : helpign # UnrealIrcd, Hendrik Frenzel -300 : none -301 : away -302 : userhost -303 : ison -304 : rpl_text # Bahamut IRCD -305 : unaway -306 : nowaway -307 : userip # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -308 : rulesstart # UnrealIrcd, Hendrik Frenzel -309 : endofrules # UnrealIrcd, Hendrik Frenzel -310 : whoishelp # (July01-01)Austnet Extension, found by Andypoo -311 : whoisuser -312 : whoisserver -313 : whoisoperator -314 : whowasuser -315 : endofwho -316 : whoischanop -317 : whoisidle -318 : endofwhois -319 : whoischannels -320 : whoisvworld # (July01-01)Austnet Extension, found by Andypoo -321 : liststart -322 : list -323 : listend -324 : channelmodeis -329 : channelcreate # 1997-11-24 -- archon -331 : notopic -332 : topic -333 : topicinfo # 1997-11-24 -- archon -334 : listusage # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -335 : whoisbot # UnrealIrcd, Hendrik Frenzel -341 : inviting -342 : summoning -346 : invitelist # UnrealIrcd, Hendrik Frenzel -347 : endofinvitelist # UnrealIrcd, Hendrik Frenzel -348 : exlist # UnrealIrcd, Hendrik Frenzel -349 : endofexlist # UnrealIrcd, Hendrik Frenzel -351 : version -352 : whoreply -353 : namreply -354 : whospcrpl # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -361 : killdone -362 : closing -363 : closeend -364 : links -365 : endoflinks -366 : endofnames -367 : banlist -368 : endofbanlist -369 : endofwhowas -371 : info -372 : motd -373 : infostart -374 : endofinfo -375 : motdstart -376 : endofmotd -377 : motd2 # 1997-10-16 -- tkil -378 : austmotd # (July01-01)Austnet Extension, found by Andypoo -379 : whoismodes # UnrealIrcd, Hendrik Frenzel -381 : youreoper -382 : rehashing -383 : youreservice # UnrealIrcd, Hendrik Frenzel -384 : myportis -385 : notoperanymore # Unspecific Extension, Kajetan@Hinner.com, 17/10/98 -386 : qlist # UnrealIrcd, Hendrik Frenzel -387 : endofqlist # UnrealIrcd, Hendrik Frenzel -388 : alist # UnrealIrcd, Hendrik Frenzel -389 : endofalist # UnrealIrcd, Hendrik Frenzel -391 : time -392 : usersstart -393 : users -394 : endofusers -395 : nousers -401 : nosuchnick -402 : nosuchserver -403 : nosuchchannel -404 : cannotsendtochan -405 : toomanychannels -406 : wasnosuchnick -407 : toomanytargets -408 : nosuchservice # UnrealIrcd, Hendrik Frenzel -409 : noorigin -411 : norecipient -412 : notexttosend -413 : notoplevel -414 : wildtoplevel -416 : querytoolong # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -421 : unknowncommand -422 : nomotd -423 : noadmininfo -424 : fileerror -425 : noopermotd # UnrealIrcd, Hendrik Frenzel -431 : nonicknamegiven -432 : erroneusnickname # This iz how its speld in thee RFC. -433 : nicknameinuse -434 : norules # UnrealIrcd, Hendrik Frenzel -435 : serviceconfused # UnrealIrcd, Hendrik Frenzel -436 : nickcollision -437 : bannickchange # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -438 : nicktoofast # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -439 : targettoofast # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -440 : servicesdown # Bahamut IRCD -441 : usernotinchannel -442 : notonchannel -443 : useronchannel -444 : nologin -445 : summondisabled -446 : usersdisabled -447 : nonickchange # UnrealIrcd, Hendrik Frenzel -451 : notregistered -455 : hostilename # UnrealIrcd, Hendrik Frenzel -459 : nohiding # UnrealIrcd, Hendrik Frenzel -460 : notforhalfops # UnrealIrcd, Hendrik Frenzel -461 : needmoreparams -462 : alreadyregistered -463 : nopermforhost -464 : passwdmismatch -465 : yourebannedcreep # I love this one... -466 : youwillbebanned -467 : keyset -468 : invalidusername # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -469 : linkset # UnrealIrcd, Hendrik Frenzel -470 : linkchannel # UnrealIrcd, Hendrik Frenzel -471 : channelisfull -472 : unknownmode -473 : inviteonlychan -474 : bannedfromchan -475 : badchannelkey -476 : badchanmask -477 : needreggednick # Bahamut IRCD -478 : banlistfull # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -479 : secureonlychannel # pircd -### TODO: see above todo -### 479 : linkfail # UnrealIrcd, Hendrik Frenzel -480 : cannotknock # UnrealIrcd, Hendrik Frenzel -481 : noprivileges -482 : chanoprivsneeded -483 : cantkillserver -484 : ischanservice # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -485 : killdeny # UnrealIrcd, Hendrik Frenzel -486 : htmdisabled # UnrealIrcd, Hendrik Frenzel -489 : secureonlychan # UnrealIrcd, Hendrik Frenzel -491 : nooperhost -492 : noservicehost -501 : umodeunknownflag -502 : usersdontmatch -511 : silelistfull # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -513 : nosuchgline # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -513 : badping # Undernet Extension, Kajetan@Hinner.com, 17/10/98 -518 : noinvite # UnrealIrcd, Hendrik Frenzel -519 : admonly # UnrealIrcd, Hendrik Frenzel -520 : operonly # UnrealIrcd, Hendrik Frenzel -521 : listsyntax # UnrealIrcd, Hendrik Frenzel -524 : operspverify # UnrealIrcd, Hendrik Frenzel - -600 : rpl_logon # Bahamut IRCD -601 : rpl_logoff # Bahamut IRCD -602 : rpl_watchoff # UnrealIrcd, Hendrik Frenzel -603 : rpl_watchstat # UnrealIrcd, Hendrik Frenzel -604 : rpl_nowon # Bahamut IRCD -605 : rpl_nowoff # Bahamut IRCD -606 : rpl_watchlist # UnrealIrcd, Hendrik Frenzel -607 : rpl_endofwatchlist # UnrealIrcd, Hendrik Frenzel -610 : mapmore # UnrealIrcd, Hendrik Frenzel -640 : rpl_dumping # UnrealIrcd, Hendrik Frenzel -641 : rpl_dumprpl # UnrealIrcd, Hendrik Frenzel -642 : rpl_eodump # UnrealIrcd, Hendrik Frenzel - -999 : numericerror # Bahamut IRCD diff --git a/lib/vendor/shout-bot b/lib/vendor/shout-bot new file mode 160000 index 0000000..3d99dda --- /dev/null +++ b/lib/vendor/shout-bot @@ -0,0 +1 @@ +Subproject commit 3d99dda51dfb90b20207b6c521f621722b9226e9 diff --git a/test/irc_publisher_test.rb b/test/irc_publisher_test.rb index bb43bc1..91f585e 100644 --- a/test/irc_publisher_test.rb +++ b/test/irc_publisher_test.rb @@ -8,13 +8,13 @@ class IRCPublisherTest < Test::Unit::TestCase def test_publisher - options = Cerberus::Config.new(nil, :publisher => {:irc => {:channel => 'hello'}}, :application_name => 'IrcApp') + options = Cerberus::Config.new(nil, :publisher => {:irc => {:channel => 'cerberus-testing', :server => 'irc.freenode.net'}}, :application_name => 'IrcApp') build = DummyManager.new('last message', 'this is output', 1232, 'anatol') Cerberus::Publisher::IRC.publish(build_status(true), build, options) - assert IRCConnection.connected - assert IRCConnection.messages.first.include?('JOIN') - assert_equal 7, IRCConnection.messages.size + # assert IRCConnection.connected + # assert IRCConnection.messages.first.include?('JOIN') + # assert_equal 7, IRCConnection.messages.size end end From 9648917e6bbfc6e1d2f10ddc79a3357feb837c2f Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sun, 25 Apr 2010 16:22:16 -0400 Subject: [PATCH 18/21] update Readme --- Readme.markdown | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Readme.markdown b/Readme.markdown index 3fed946..21c6dc2 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -33,9 +33,7 @@ Main advantages of Cerberus over other solutions include: * ruby - 1.8.2 or higher * rake - 0.7.3 or higher (optional) -* actionmailer - 1.3.3 or higher (optional) -* activesupport - 1.4.2 or higher (optional) -* gmailer - 0.1.7 or higher (optional) +* actionmailer - 2.0 or higher (optional) ## Usage From 9364670adaf4a1ca43a9a11aaf189fd4a32c2f9d Mon Sep 17 00:00:00 2001 From: Kai Chen Date: Sat, 1 May 2010 14:42:08 +0800 Subject: [PATCH 19/21] add channel password to irc publisher * update shout-bot * update doc and config example about channel password --- doc/site/src/options.page | 1 + lib/cerberus/config.example.yml | 1 + lib/cerberus/publisher/irc.rb | 11 ++++++----- lib/vendor/shout-bot | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/site/src/options.page b/doc/site/src/options.page index 5824349..61730ed 100644 --- a/doc/site/src/options.page +++ b/doc/site/src/options.page @@ -35,6 +35,7 @@ publisher: server: port: channel: + channel_password: on_event: rss: file: diff --git a/lib/cerberus/config.example.yml b/lib/cerberus/config.example.yml index 5ac9f7c..a3e1ad5 100644 --- a/lib/cerberus/config.example.yml +++ b/lib/cerberus/config.example.yml @@ -19,6 +19,7 @@ publisher: # nick: cerb # server: irc.freenode.net # channel: cerberus +# channel_password: secert # campfire: # url: http://someemail:password@cerberustool.campfirenow.com/room/51660 # rss: diff --git a/lib/cerberus/publisher/irc.rb b/lib/cerberus/publisher/irc.rb index 65d217e..d148e2b 100644 --- a/lib/cerberus/publisher/irc.rb +++ b/lib/cerberus/publisher/irc.rb @@ -9,12 +9,13 @@ 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] + port = irc_options[:port] || 6667 + nick = irc_options[:nick] || 'cerberus' + server = irc_options[:server] + channel = '#' + irc_options[:channel] + channel_password = irc_options[:channel_password] - ShoutBot.shout("irc://#{nick}@#{server}:#{port}/#{channel}") do |channel| + ShoutBot.shout("irc://#{nick}@#{server}:#{port}/#{channel}", channel_password) do |channel| message.split("\n").each { |line| channel.say line } end diff --git a/lib/vendor/shout-bot b/lib/vendor/shout-bot index 3d99dda..416e0ef 160000 --- a/lib/vendor/shout-bot +++ b/lib/vendor/shout-bot @@ -1 +1 @@ -Subproject commit 3d99dda51dfb90b20207b6c521f621722b9226e9 +Subproject commit 416e0ef85e49d7b8c4a76415eac412073156aab5 From 1f1778fb807432c26a6aabcd9450d02346840713 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 1 May 2010 09:32:03 -0400 Subject: [PATCH 20/21] docs/version bump for 0.7.8 release --- Changelog.txt | 5 +++++ Copyright.txt | 4 +++- doc/site/src/credits.page | 3 ++- lib/cerberus/constants.rb | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index d333bcb..a19933b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,10 @@ = Cerberus Changelog +== Version 0.7.8 +Added channel password option to IRC publisher + +* New channel_password config option under publisher/irc + == Version 0.7.7 Bugfixes, publisher and config options updates, ActionMailer gem version requirements diff --git a/Copyright.txt b/Copyright.txt index 0a182fc..69ce3d7 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -14,4 +14,6 @@ Mike Gunderloy Joe Van Dyk Andrew Timberlake Paul Hinze -McClain Looney \ No newline at end of file +McClain Looney +Peter Fitzgibbons +Kai Chen \ No newline at end of file diff --git a/doc/site/src/credits.page b/doc/site/src/credits.page index f88e183..8452005 100644 --- a/doc/site/src/credits.page +++ b/doc/site/src/credits.page @@ -20,4 +20,5 @@ The following people made notable contributions to the Cerberus tool: * [Paul Hinze](http://phinze.com/) - Bazaar SCM support * [McClain Looney](http://github.com/mlooney) - Mercurial Support * [Michael Turner](http://github.com/iconoclast) - RSS Publisher updates -* [Peter Fitzgibbons](http://github.com/pjfitzgibbons) - Setup Script support \ No newline at end of file +* [Peter Fitzgibbons](http://github.com/pjfitzgibbons) - Setup Script support +* [Kai Chen](http://chenk85.com) - IRC channel passsword support \ No newline at end of file diff --git a/lib/cerberus/constants.rb b/lib/cerberus/constants.rb index 27e7093..2415f97 100644 --- a/lib/cerberus/constants.rb +++ b/lib/cerberus/constants.rb @@ -4,5 +4,5 @@ module Cerberus LOCK_WAIT = 30 * 60 # 30 minutes - VERSION = '0.7.7' + VERSION = '0.7.8' end From 357fa3e3b79f29b2217539cdbf2b80046d8953e2 Mon Sep 17 00:00:00 2001 From: Craig P Jolicoeur Date: Sat, 1 May 2010 09:46:43 -0400 Subject: [PATCH 21/21] add desc to all rake tasks --- Rakefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Rakefile b/Rakefile index 4418b69..39846fe 100644 --- a/Rakefile +++ b/Rakefile @@ -78,10 +78,12 @@ Rake::GemPackageTask.new(GEM_SPEC) do |p| p.need_zip = true end +desc "install gem from pkg/ directory after running clean and test" task :install => [:clean, :test, :package] do system "gem install pkg/#{PKG_NAME}-#{PKG_VERSION}.gem" end +desc "uninstall gem" task :uninstall => [:clean] do system "gem uninstall #{PKG_NAME}" end @@ -91,6 +93,7 @@ task :todo do FileList.new(File.dirname(__FILE__)+'/lib/cerberus/**/*.rb').egrep(/#.*(FIXME|TODO|TBD|DEPRECATED)/i) end +desc "uninstall and reinstall gem" task :reinstall => [:uninstall, :install] begin @@ -103,10 +106,12 @@ begin rescue Object end +desc "copy coverage directory to RubyForge site" task :site_coverage => [:rcov] do sh %{ scp -r coverage/* #{RUBYFORGE_USER}@rubyforge.org:/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/coverage/ } end +desc "Release files to RubyForge" task :release_files => [:clean, :package] do require 'meta_project' project = MetaProject::Project::XForge::RubyForge.new(RUBYFORGE_PROJECT) @@ -127,6 +132,7 @@ task :release_files => [:clean, :package] do end +desc "Publish news update to RubyForge" task :publish_news do require 'meta_project' @@ -151,8 +157,10 @@ rescue Gem::LoadError puts "webgen gem is required to build website output" end +desc "Update cerberus.rubyforge.org website" task :publish_site => :webgen do sh %{scp -r -q doc/site/out/* #{RUBYFORGE_USER}@rubyforge.org:/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/} end +desc "Run release_files, publish_news, publish_site" task :release => [:release_files, :publish_news, :publish_site]