ichverstehe-integrity-irc 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
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,31 @@
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
+ <<-HAML
12
+ %p.normal
13
+ %label{ :for => 'irc_notifier_uri' } Send to
14
+ %input.text#irc_notifier_uri{ :name => 'notifiers[IRC][uri]', :type => 'text', :value => config['uri'] || 'irc://IntegrityBot@irc.freenode.net:6667/#test' }
15
+ HAML
16
+ end
17
+
18
+ def initialize(build, config={})
19
+ @uri = config.delete("uri")
20
+ super
21
+ end
22
+
23
+ def deliver!
24
+ ShoutBot.shout(uri) do |channel|
25
+ channel.say "#{build.project.name}: #{short_message}"
26
+ channel.say build_url
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
data/spec/irc_spec.rb ADDED
@@ -0,0 +1,72 @@
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/test")
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 and project name" do
60
+ notifier.build.project.should_receive(:name).and_return("Integrity")
61
+ notifier.should_receive(:short_message).and_return("short message")
62
+ @channel.should_receive(:say).with("Integrity: short message")
63
+ do_notify
64
+ end
65
+
66
+ it "should give the build url" do
67
+ notifier.should_receive(:build_url).and_return("http://example.org")
68
+ @channel.should_receive(:say).with("http://example.org")
69
+ do_notify
70
+ end
71
+ end
72
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ichverstehe-integrity-irc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Simon Rozet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-03 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: foca-integrity
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: ichverstehe-shout-bot
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ description:
36
+ email: simon@rozet.name
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - README.markdown
45
+ - lib/notifier/config.haml
46
+ - lib/notifier/irc.rb
47
+ has_rdoc: false
48
+ homepage: http://integrityapp.com
49
+ post_install_message:
50
+ rdoc_options: []
51
+
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.2.0
70
+ signing_key:
71
+ specification_version: 2
72
+ summary: IRC notifier for the Integrity continuous integration server
73
+ test_files:
74
+ - spec/irc_spec.rb