atmos-integrity-irccat 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,51 @@
1
+ Integrity
2
+ =========
3
+
4
+ [Integrity][] is your friendly automated Continuous Integration server.
5
+
6
+ Integrity IrcCat Notifier
7
+ ========================
8
+
9
+ This lets Integrity alert an IRC channel after each build is made.
10
+ Based on src/integrity-irc on github.
11
+
12
+ Setup Instructions
13
+ ==================
14
+
15
+ Just install this gem via `sudo gem install -s http://gems.github.com
16
+ atmos-integrity-irccat` and then in your Rackup (ie, `config.ru`) file:
17
+
18
+ require "rubygems"
19
+ require "notifier/irccat"
20
+
21
+ And badabing! Now you can set up your projects to alert an IRC channel
22
+ after each build (just edit the project and the config options should
23
+ be there)
24
+
25
+ License
26
+ =======
27
+
28
+ (The MIT License)
29
+
30
+ Copyright (c) 2008 [atmos](http://atmos.org/)
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining
33
+ a copy of this software and associated documentation files (the
34
+ 'Software'), to deal in the Software without restriction, including
35
+ without limitation the rights to use, copy, modify, merge, publish,
36
+ distribute, sublicense, and/or sell copies of the Software, and to
37
+ permit persons to whom the Software is furnished to do so, subject to
38
+ the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50
+
51
+ [Integrity]: http://integrityapp.com
@@ -0,0 +1,5 @@
1
+ %p.normal
2
+ %label{ :for => 'irccat_notifier_host' } Send to host
3
+ %input.text#irccat_notifier_host{ :name => 'notifiers[IrcCat][host]', :type => 'text', :value => config['host'] || '127.0.0.1' }
4
+ %label{ :for => 'irccat_notifier_port' } Send to port
5
+ %input.text#irccat_notifier_port{ :name => 'notifiers[IrcCat][port]', :type => 'text', :value => config['port'] || 5678 }
@@ -0,0 +1,32 @@
1
+ require 'rubygems'
2
+ require 'integrity'
3
+ gem 'irc_cat'
4
+ require 'irc_cat/tcp_client'
5
+
6
+ module Integrity
7
+ class Notifier
8
+ class IrcCat < Notifier::Base
9
+ attr_reader :host, :port
10
+
11
+ def self.to_haml
12
+ File.read File.dirname(__FILE__) / "config.haml"
13
+ end
14
+
15
+ def initialize(build, config={})
16
+ @host = config.delete("host")
17
+ @port = config.delete("port")
18
+ super
19
+ end
20
+
21
+ def deliver!
22
+ notify "[#{commit.project.name}] Build by #{commit.author.name} #{commit.successful? ? "was successful" : "failed"} - #{commit_url}"
23
+ end
24
+
25
+ def notify(message)
26
+ ::IrcCat::TcpClient.notify(host, port, message)
27
+ rescue Errno::ECONNREFUSED
28
+ Integrity.log "Unable to connect to the IrcCat Bot"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,73 @@
1
+ require File.dirname(__FILE__) + "/../lib/notifier/irccat"
2
+ require Integrity.root / "spec" / "spec_helper"
3
+
4
+ describe Integrity::Notifier::IrcCat do
5
+ include AppSpecHelper
6
+ include NotifierSpecHelper
7
+
8
+ it_should_behave_like "A notifier"
9
+
10
+ def klass
11
+ Integrity::Notifier::IrcCat
12
+ end
13
+
14
+ def notifier_config(opts={})
15
+ {"host" =>"127.0.0.1", "port" => 5678}
16
+ end
17
+
18
+ def notifier
19
+ @notifier ||= Integrity::Notifier::IrcCat.new(mock_build, notifier_config)
20
+ end
21
+
22
+ it "should have an host" do
23
+ notifier.host.should == "127.0.0.1"
24
+ end
25
+
26
+ it "should have an port" do
27
+ notifier.port.should == 5678
28
+ end
29
+
30
+ describe "Generating a form for configuration" do
31
+ describe "with a field for the IrcCat host" do
32
+ it "should have the proper name, id and label and a default value" do
33
+ the_form.should have_textfield("irccat_notifier_host").
34
+ named("notifiers[IrcCat][host]").
35
+ with_label("Send to host").
36
+ with_value("127.0.0.1")
37
+ end
38
+
39
+ it "should use the config's 'host' value if available" do
40
+ the_form(:config => { "host" => "127.0.0.1" }).
41
+ should have_textfield("irccat_notifier_host").
42
+ with_value("127.0.0.1")
43
+ end
44
+ end
45
+
46
+ describe "with a field for the IrcCat port" do
47
+ it "should have the proper name, id and label and a default value" do
48
+ the_form.should have_textfield("irccat_notifier_port").
49
+ named("notifiers[IrcCat][port]").
50
+ with_label("Send to port").
51
+ with_value("5678")
52
+ end
53
+
54
+ it "should use the config's 'port' value if available" do
55
+ the_form(:config => { "port" => 5678 }).
56
+ should have_textfield("irccat_notifier_port").
57
+ with_value("5678")
58
+ end
59
+ end
60
+ end
61
+
62
+ describe "Delevering the build" do
63
+ def do_notify
64
+ notifier.deliver!
65
+ end
66
+
67
+ it "should give the build status, project name and the build url" do
68
+ IrcCat::TcpClient.should_receive(:notify).with("127.0.0.1", 5678,
69
+ "[Integrity] Build e7e02b was successful - http://localhost:4567/integrity/builds/e7e02bc669d07064cdbc7e7508a21a41e040e70d")
70
+ do_notify
71
+ end
72
+ end
73
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: atmos-integrity-irccat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Tim Carey-Smith
8
+ - Corey Donohoe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-12-11 00:00:00 -08:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: integrity
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 0.1.9.1
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: irc_cat
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.2.1.1
35
+ version:
36
+ description:
37
+ email:
38
+ - tim@spork.in
39
+ - atmos@atmos.org
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - README.markdown
48
+ - lib/notifier/config.haml
49
+ - lib/notifier/irccat.rb
50
+ has_rdoc: false
51
+ homepage: http://integrityapp.com
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.2.0
73
+ signing_key:
74
+ specification_version: 2
75
+ summary: IrcCat notifier for the Integrity continuous integration server
76
+ test_files:
77
+ - spec/irccat_spec.rb