Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cpjolicoeur/cerberus
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjolicoeur committed Jun 24, 2010
2 parents a26e5d0 + 357fa3e commit fef9301
Show file tree
Hide file tree
Showing 29 changed files with 94 additions and 806 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
17 changes: 17 additions & 0 deletions Changelog.txt
@@ -1,5 +1,22 @@
= 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

* Projects are now sorted when displayed via Cerberus CLI
* 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
* 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
4 changes: 3 additions & 1 deletion Copyright.txt
Expand Up @@ -14,4 +14,6 @@ Mike Gunderloy
Joe Van Dyk
Andrew Timberlake
Paul Hinze
McClain Looney
McClain Looney
Peter Fitzgibbons
Kai Chen
12 changes: 10 additions & 2 deletions Rakefile
Expand Up @@ -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') }
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -127,6 +132,7 @@ task :release_files => [:clean, :package] do

end

desc "Publish news update to RubyForge"
task :publish_news do
require 'meta_project'

Expand All @@ -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]
4 changes: 1 addition & 3 deletions Readme.markdown
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions Todo.txt
@@ -1,12 +1,14 @@
==================
| BEFORE RELEASE |
==================
===========================
| BEFORE RELEASE - v0.7.7 |
===========================



==========
| 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
Expand Down
4 changes: 3 additions & 1 deletion doc/site/src/credits.page
Expand Up @@ -19,4 +19,6 @@ 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
* [Peter Fitzgibbons](http://github.com/pjfitzgibbons) - Setup Script support
* [Kai Chen](http://chenk85.com) - IRC channel passsword support
2 changes: 2 additions & 0 deletions doc/site/src/options.page
Expand Up @@ -35,6 +35,7 @@ publisher:
server:
port:
channel:
channel_password:
on_event:
rss:
file:
Expand All @@ -54,6 +55,7 @@ scm:
password:
view: #for perforce only
branch: #for git only
setup_script:
builder:
type:
rake:
Expand Down
1 change: 1 addition & 0 deletions lib/cerberus/config.example.yml
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/cerberus/constants.rb
Expand Up @@ -4,5 +4,5 @@ module Cerberus

LOCK_WAIT = 30 * 60 # 30 minutes

VERSION = '0.7.6'
VERSION = '0.7.8'
end
10 changes: 5 additions & 5 deletions lib/cerberus/manager.rb
Expand Up @@ -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},
Expand Down Expand Up @@ -114,7 +114,7 @@ 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]
@setup_script_output = `#{@config[:setup_script]}` if @config[:setup_script]

build_successful = @builder.run
@status.keep(build_successful, @scm.current_revision, @builder.brokeness)
Expand All @@ -126,7 +126,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

Expand Down Expand Up @@ -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}"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/cerberus/publisher/base.rb
Expand Up @@ -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
Expand Down
24 changes: 10 additions & 14 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,15 @@ def self.publish(state, manager, options)
subject,body = Cerberus::Publisher::Base.formatted_message(state, manager, options)
message = subject + "\n" + '*' * subject.length + "\n" + body

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
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}", channel_password) do |channel|
message.split("\n").each { |line| channel.say line }
end

end
end
1 change: 1 addition & 0 deletions lib/cerberus/publisher/mail.rb
@@ -1,4 +1,5 @@
require 'rubygems'
gem 'actionmailer', '~> 2.0'
require 'action_mailer'
require 'cerberus/publisher/base'

Expand Down
2 changes: 1 addition & 1 deletion lib/cerberus/scm/git.rb
Expand Up @@ -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

Expand Down
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.

0 comments on commit fef9301

Please sign in to comment.