Skip to content

Commit

Permalink
simple campfire notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Nov 16, 2008
0 parents commit 364ab9f
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.markdown
@@ -0,0 +1,50 @@
Integrity
=========

[Integrity][] is your friendly automated Continuous Integration server.

Integrity Campfire Notifier
===========================

This lets Integrity alert Campfire after each build is made.

Setup Instructions
==================

Just install this gem via `sudo gem install -s http://gems.github.com
defunkt-integrity-campfire` and then in your Rackup (ie, `config.ru`) file:

require "rubygems"
require "notifier/campfire"

And badabing! Now you can set up your projects to alert Campfire after
each build (just edit the project and the config options should be
there)

License
=======

(The MIT License)

Copyright (c) 2008 Chris Wanstrath

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[Integrity]: http://integrityapp.com
19 changes: 19 additions & 0 deletions integrity-campfire.gemspec
@@ -0,0 +1,19 @@
Gem::Specification.new do |s|
s.name = 'integrity-email'
s.version = '1.0.0'
s.date = '2008-11-16'
s.summary = 'Campfire notifier for the Integrity continuous integration server'
s.description = 'Easily let Integrity alert Campfire after each build'
s.homepage = 'http://integrityapp.com'
s.email = 'chris@ozmm.org'
s.authors = ['Chris Wanstrath']
s.has_rdoc = false
s.files = %w(
README.markdown
lib/notifier/config.haml
lib/notifier/campfire.rb
)

s.add_dependency 'foca-integrity'
s.add_dependency 'tinder'
end
39 changes: 39 additions & 0 deletions lib/notifier/campfire.rb
@@ -0,0 +1,39 @@
require 'rubygems'
require 'integrity'
require 'tinder'

module Integrity
class Notifier
class Campfire < Notifier::Base
attr_reader :config

def self.to_haml
File.read File.dirname(__FILE__) / "config.haml"
end

def deliver!
campfire = Tinder::Campfire.new(config['account'])
campfire.login(config['user'], config['pass'])
room = campfire.find_room_by_name(config['room'])

room.speak "#{short_message}. #{build_url}"
room.paste full_message
end

def short_message
"Build #{build.short_commit_identifier} of #{build.project.name} #{build.successful? ? "was successful" : "failed"}"
end

def full_message
<<-EOM
Commit Message: #{build.commit_message}
Commit Date: #{build.commited_at}
Commit Author: #{build.commit_author.name}
#{stripped_build_output}
EOM
end

end
end
end
15 changes: 15 additions & 0 deletions lib/notifier/config.haml
@@ -0,0 +1,15 @@
%p.normal
%label{ :for => "campfire_notifier_account" } Subdomain
%input.text#campfire_notifier_account{ :name => "notifiers[Campfire][account]", :type => "text", :value => config["account"] }

%p.normal
%label{ :for => "campfire_notifier_room" } Room Name
%input.text#campfire_notifier_room{ :name => "notifiers[Campfire][room]", :type => "text", :value => config["room"] }

%p.normal
%label{ :for => "campfire_notifier_user" } User
%input.text#campfire_notifier_user{ :name => "notifiers[Campfire][user]", :value => config["user"], :type => "text" }

%p.normal
%label{ :for => "campfire_notifier_pass" } Password
%input.text#campfire_notifier_pass{ :name => "notifiers[Campfire][pass]", :value => config["pass"], :type => "text" }

0 comments on commit 364ab9f

Please sign in to comment.