sr-integrity-irc 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown ADDED
@@ -0,0 +1,50 @@
1
+ Integrity
2
+ =========
3
+
4
+ [Integrity][] is your friendly automated Continuous Integration server.
5
+
6
+ Integrity IRC Notifier
7
+ ========================
8
+
9
+ This lets Integrity alert an IRC channel after each build is made.
10
+
11
+ Setup Instructions
12
+ ==================
13
+
14
+ Just install this gem via `sudo gem install -s http://gems.github.com
15
+ sr-integrity-irc` and then in your Rackup (ie, `config.ru`) file:
16
+
17
+ require "rubygems"
18
+ require "notifier/irc"
19
+
20
+ And badabing! Now you can set up your projects to alert an IRC channel
21
+ after each build (just edit the project and the config options should
22
+ be there)
23
+
24
+ License
25
+ =======
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2008 [Simon Rozet](http://purl.org/net/sr/)
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49
+
50
+ [Integrity]: http://integrityapp.com
@@ -0,0 +1,3 @@
1
+ %p.normal
2
+ %label{ :for => 'irc_notifier_uri' } Send to
3
+ %input.text#irc_notifier_uri{ :name => 'notifiers[IRC][uri]', :type => 'text', :value => config['uri'] || 'irc://irc.freenode.net:6667/integrity' }
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'integrity' unless defined?(:Integrity)
3
+ require 'shout-bot'
4
+
5
+ module Integrity
6
+ class Notifier
7
+ class IRC < Notifier::Base
8
+ attr_reader :uri
9
+
10
+ def self.to_haml
11
+ File.read File.dirname(__FILE__) / "config.haml"
12
+ end
13
+
14
+ def initialize(build, config={})
15
+ @uri = config.delete("uri")
16
+ super
17
+ end
18
+
19
+ def deliver!
20
+ ShoutBot.shout(uri, :as => "IntegrityBot") do |channel|
21
+ channel.say short_message
22
+ channel.say build_url
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
data/spec/irc_spec.rb ADDED
@@ -0,0 +1,71 @@
1
+ require File.dirname(__FILE__) + "/../lib/notifier/irc"
2
+ require Integrity.root / "spec" / "spec_helper"
3
+
4
+ describe Integrity::Notifier::IRC do
5
+ include AppSpecHelper
6
+ include NotifierSpecHelper
7
+
8
+ it_should_behave_like "A notifier"
9
+
10
+ def klass
11
+ Integrity::Notifier::IRC
12
+ end
13
+
14
+ def notifier_config(opts={})
15
+ {"uri" =>"irc://irc.freenode.net:6667/integrity"}
16
+ end
17
+
18
+ def notifier
19
+ @notifier ||= Integrity::Notifier::IRC.new(mock_build, notifier_config)
20
+ end
21
+
22
+ it "should have an uri" do
23
+ notifier.uri.should == "irc://irc.freenode.net:6667/integrity"
24
+ end
25
+
26
+ describe "Generating a form for configuration" do
27
+ describe "with a field for the IRC URI" do
28
+ it "should have the proper name, id and label and a default value" do
29
+ the_form.should have_textfield("irc_notifier_uri").
30
+ named("notifiers[IRC][uri]").
31
+ with_label("Send to").
32
+ with_value("irc://irc.freenode.net:6667/integrity")
33
+ end
34
+
35
+ it "should use the config's 'uri' value if available" do
36
+ the_form(:config => { "uri" => "irc://irc.freenode.net/integrity" }).
37
+ should have_textfield("irc_notifier_uri").
38
+ with_value("irc://irc.freenode.net/integrity")
39
+ end
40
+ end
41
+ end
42
+
43
+ describe "Delevering the build" do
44
+ def do_notify
45
+ notifier.deliver!
46
+ end
47
+
48
+ before do
49
+ @channel = mock("channel", :say => "")
50
+ ShoutBot.stub!(:shout).and_yield(@channel)
51
+ end
52
+
53
+ it "should connect to the given URI as IntegrityBot" do
54
+ ShoutBot.should_receive(:shout).
55
+ with(notifier_config["uri"], {:as => "IntegrityBot"})
56
+ do_notify
57
+ end
58
+
59
+ it "should give the build status" do
60
+ notifier.should_receive(:short_message).and_return("foobar")
61
+ @channel.should_receive(:say).with("foobar")
62
+ do_notify
63
+ end
64
+
65
+ it "should give the build url" do
66
+ notifier.should_receive(:build_url).and_return("http://example.org")
67
+ @channel.should_receive(:say).with("http://example.org")
68
+ do_notify
69
+ end
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sr-integrity-irc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Simon Rozet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-20 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: foca-integrity
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: sr-shout-bot
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
32
+ version:
33
+ description:
34
+ email: simon@rozet.name
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files: []
40
+
41
+ files:
42
+ - README.markdown
43
+ - lib/notifier/config.haml
44
+ - lib/notifier/irc.rb
45
+ has_rdoc: false
46
+ homepage: http://integrityapp.com
47
+ post_install_message:
48
+ rdoc_options: []
49
+
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ version:
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.2.0
68
+ signing_key:
69
+ specification_version: 2
70
+ summary: IRC notifier for the Integrity continuous integration server
71
+ test_files:
72
+ - spec/irc_spec.rb