be9-integrity-twitter 1.0.3

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,56 @@
1
+ Integrity (forked by pat nakajima for purely aesthetic reasons)
2
+ =========
3
+
4
+ TODO: add confit option for twitter names of people to DM or @reply when the build goes red.
5
+
6
+ [Integrity][] is your friendly automated Continuous Integration server.
7
+
8
+ Integrity Twitter Notifier
9
+ ===========================
10
+
11
+ This lets Integrity send a tweet after each build is made.
12
+
13
+ Setup Instructions
14
+ ==================
15
+
16
+ Step 1. Install this gem via `sudo gem install -s http://gems.github.com
17
+ cwsaylor-integrity-twitter`
18
+
19
+ Step 2. Add the following lines to your Rackup (ie, `config.ru`) file:
20
+
21
+ require "rubygems"
22
+ require "notifier/twitter"
23
+
24
+ Step 3. Profit! Just kidding. Edit the project and update your twitter email
25
+ address and password.
26
+
27
+ Run the tests
28
+ ==================
29
+
30
+ rake spec
31
+
32
+ License
33
+ =======
34
+
35
+ (The MIT License)
36
+
37
+ Copyright (c) 2008 Chris Saylor
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining
40
+ a copy of this software and associated documentation files (the
41
+ 'Software'), to deal in the Software without restriction, including
42
+ without limitation the rights to use, copy, modify, merge, publish,
43
+ distribute, sublicense, and/or sell copies of the Software, and to
44
+ permit persons to whom the Software is furnished to do so, subject to
45
+ the following conditions:
46
+
47
+ The above copyright notice and this permission notice shall be
48
+ included in all copies or substantial portions of the Software.
49
+
50
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
51
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
52
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
53
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
54
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
55
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
56
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'spec/rake/spectask'
2
+
3
+ task :default => :spec
4
+
5
+ Spec::Rake::SpecTask.new(:spec) do |t|
6
+ t.spec_opts = ["--color", "--format", "progress"]
7
+ t.spec_files = Dir['spec/**/*_spec.rb'].sort
8
+ t.libs = ['lib']
9
+ t.rcov = false
10
+ end
11
+
12
+
@@ -0,0 +1,43 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{integrity-twitter}
5
+ s.version = "1.0.3"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Chris Saylor"]
9
+ s.date = %q{2008-12-15}
10
+ s.description = %q{Easily let Integrity tweet after each build}
11
+ s.email = %q{chris@justhack.com}
12
+ s.files = [
13
+ "integrity-twitter.gemspec",
14
+ "lib/notifier/config.haml",
15
+ "lib/notifier/twitter.rb",
16
+ "Rakefile",
17
+ "README.markdown",
18
+ "spec/integrity_twitter_spec.rb",
19
+ "spec/spec_helper.rb"
20
+ ]
21
+
22
+ s.homepage = %q{http://integrityapp.com}
23
+ s.require_paths = ["lib"]
24
+ s.rubyforge_project = %q{integrity-twitter}
25
+ s.rubygems_version = %q{1.3.1}
26
+ s.summary = %q{Twitter notifier for the Integrity continuous integration server}
27
+
28
+ if s.respond_to? :specification_version then
29
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
30
+ s.specification_version = 2
31
+
32
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
33
+ s.add_runtime_dependency(%q<integrity>, [">= 0"])
34
+ s.add_runtime_dependency(%q<twitter>, [">= 0"])
35
+ else
36
+ s.add_dependency(%q<integrity>, [">= 0"])
37
+ s.add_dependency(%q<twitter>, [">= 0"])
38
+ end
39
+ else
40
+ s.add_dependency(%q<integrity>, [">= 0"])
41
+ s.add_dependency(%q<twitter>, [">= 0"])
42
+ end
43
+ end
@@ -0,0 +1,7 @@
1
+ %p.normal
2
+ %label{ :for => "integrity_twitter_notifier_email" } Email Address
3
+ %input.text#integrity_twitter_notifier_email{ :name => "notifiers[IntegrityTwitter][email]", :value => config["email"], :type => "text" }
4
+
5
+ %p.normal
6
+ %label{ :for => "integrity_twitter_notifier_pass" } Password
7
+ %input.text#integrity_twitter_notifier_pass{ :name => "notifiers[IntegrityTwitter][pass]", :value => config["pass"], :type => "text" }
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'integrity'
3
+ require 'twitter'
4
+
5
+ module Integrity
6
+ class Notifier
7
+ class IntegrityTwitter < Notifier::Base
8
+
9
+ def self.to_haml
10
+ File.read File.dirname(__FILE__) / "config.haml"
11
+ end
12
+
13
+ def deliver!
14
+ httpauth = Twitter::HTTPAuth.new(@config['email'], @config['pass'])
15
+ @tweet = Twitter::Base.new(httpauth)
16
+
17
+ @tweet.post(message)
18
+ end
19
+
20
+ def message
21
+ "#{build_status} | #{project.name}, commit #{build.short_commit_identifier} - [committer: #{build.commit_author.name}]"
22
+ end
23
+
24
+ private
25
+
26
+ def build_status
27
+ build.successful? ? 'GREEN' : 'FAIL!'
28
+ end
29
+
30
+ def project
31
+ @project ||= build.project
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,85 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe Integrity::Notifier::IntegrityTwitter do
4
+ include AppSpecHelper
5
+ include NotifierSpecHelper
6
+
7
+ it_should_behave_like "A notifier"
8
+
9
+ def klass
10
+ Integrity::Notifier::IntegrityTwitter
11
+ end
12
+
13
+ describe "notifying the world of a build" do
14
+ before { klass.stub!(:new).and_return(notifier) }
15
+
16
+ it "should instantiate a notifier with the given build and config" do
17
+ klass.should_receive(:new).with(mock_build, anything).and_return(notifier)
18
+ klass.notify_of_build(mock_build, notifier_config)
19
+ end
20
+
21
+ it "should pass the notifier options to the notifier" do
22
+ klass.should_receive(:new).with(anything, notifier_config).and_return(notifier)
23
+ klass.notify_of_build(mock_build, notifier_config)
24
+ end
25
+
26
+ it "should deliver the notification" do
27
+ notifier.should_receive(:deliver!)
28
+ klass.notify_of_build(mock_build, notifier_config)
29
+ end
30
+ end
31
+
32
+ describe "message" do
33
+ attr_reader :build
34
+
35
+ before(:each) do
36
+ @build = mock_build :commit_author => stub("author", :name => "nakajima")
37
+ @notifier = Integrity::Notifier::IntegrityTwitter.new(build, { })
38
+ end
39
+
40
+ context "on a green build" do
41
+ before(:each) do
42
+ build.stub!(:successful?).and_return(true)
43
+ end
44
+
45
+ it "returns a success message" do
46
+ @notifier.message.should == "GREEN | Integrity, commit e7e02b - [committer: nakajima]"
47
+ end
48
+ end
49
+
50
+ context "on a red build" do
51
+ before(:each) do
52
+ build.stub!(:successful?).and_return(false)
53
+ end
54
+
55
+ it "returns a fail message" do
56
+ @notifier.message.should == "FAIL! | Integrity, commit e7e02b - [committer: nakajima]"
57
+ end
58
+ end
59
+ end
60
+
61
+ describe "generating a form for configuration" do
62
+ describe "with a field for the email" do
63
+ it "should have the proper name, id and label" do
64
+ the_form.should have_textfield("integrity_twitter_notifier_email").named("notifiers[IntegrityTwitter][email]").with_label("Email Address").with_value(nil)
65
+ end
66
+
67
+ it "should use the config's 'email' value if available" do
68
+ the_form(:config => { 'email' => 'test@example.com' }).should have_textfield("integrity_twitter_notifier_email").with_value("test@example.com")
69
+ end
70
+ end
71
+
72
+ describe "with a field for the pass" do
73
+ it "should have the proper name, id and label" do
74
+ the_form.should have_textfield("integrity_twitter_notifier_pass").named("notifiers[IntegrityTwitter][pass]").with_label("Password").with_value(nil)
75
+ end
76
+
77
+ it "should use the config's 'pass' value if available" do
78
+ the_form(:config => { 'pass' => 'mypass' }).should have_textfield("integrity_twitter_notifier_pass").with_value("mypass")
79
+ end
80
+ end
81
+ end
82
+
83
+
84
+
85
+ end
@@ -0,0 +1,5 @@
1
+ require "rubygems"
2
+ require "integrity"
3
+ require File.dirname(__FILE__) / ".." / "lib" / "notifier" / "twitter"
4
+
5
+ require Integrity.root / "spec" / "spec_helper"
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: be9-integrity-twitter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Chris Saylor
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-15 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: 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: twitter
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: Easily let Integrity tweet after each build
36
+ email: chris@justhack.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - integrity-twitter.gemspec
45
+ - lib/notifier/config.haml
46
+ - lib/notifier/twitter.rb
47
+ - Rakefile
48
+ - README.markdown
49
+ - spec/integrity_twitter_spec.rb
50
+ - spec/spec_helper.rb
51
+ has_rdoc: false
52
+ homepage: http://integrityapp.com
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "1.2"
69
+ version:
70
+ requirements: []
71
+
72
+ rubyforge_project: integrity-twitter
73
+ rubygems_version: 1.2.0
74
+ signing_key:
75
+ specification_version: 2
76
+ summary: Twitter notifier for the Integrity continuous integration server
77
+ test_files: []
78
+