integrity-prowl 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2009 Matías Flores
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,46 @@
1
+ Integrity
2
+ =========
3
+
4
+ [Integrity][] is your friendly automated Continuous Integration server.
5
+
6
+ Integrity Prowl Notifier
7
+ ========================
8
+
9
+
10
+ Setup Instructions
11
+ ==================
12
+
13
+ Just install this gem via `sudo gem install bdotdub-integrity-prowl` and then in your
14
+ Rackup (ie, `config.ru`) file:
15
+
16
+ require "rubygems"
17
+ require "integrity/notifier/prowl"
18
+
19
+ License
20
+ =======
21
+
22
+ (The MIT License)
23
+
24
+ Copyright (c) 2009 [Matías Flores][matflores]
25
+
26
+ Permission is hereby granted, free of charge, to any person obtaining
27
+ a copy of this software and associated documentation files (the
28
+ 'Software'), to deal in the Software without restriction, including
29
+ without limitation the rights to use, copy, modify, merge, publish,
30
+ distribute, sublicense, and/or sell copies of the Software, and to
31
+ permit persons to whom the Software is furnished to do so, subject to
32
+ the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be
35
+ included in all copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
38
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
39
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
40
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
41
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
42
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
43
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44
+
45
+ [Integrity]: http://integrityapp.com
46
+ [Benny Wong]: http://bwong.net
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = integrity-prowl
2
+
3
+ A Prowl notifier for the Integrity continuous integration server.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 Benny Wong. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "integrity-prowl"
8
+ gem.summary = "Prowl notifier for the Integrity continuous integration server"
9
+ gem.description = "Sends a notification from Integrity to Prowl after each build"
10
+ gem.email = "benny@bwong.net"
11
+ gem.homepage = "http://github.com/bdotdub/integrity-prowl"
12
+ gem.authors = ["Benny Wong"]
13
+ gem.add_dependency "integrity"
14
+ gem.add_dependency "prowl"
15
+ gem.rubyforge_project = "integrity"
16
+ end
17
+
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/*_test.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/*_test.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ if File.exist?('VERSION.yml')
48
+ config = YAML.load(File.read('VERSION.yml'))
49
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
50
+ else
51
+ version = ""
52
+ end
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "integrity-prowl #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
59
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1,61 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{integrity-prowl}
8
+ s.version = "0.3.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Benny Wong"]
12
+ s.date = %q{2009-09-27}
13
+ s.description = %q{Sends a notification from Integrity to Prowl after each build}
14
+ s.email = %q{benny@bwong.net}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.markdown",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "README.markdown",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "integrity-prowl.gemspec",
29
+ "lib/integrity/notifier/config.haml",
30
+ "lib/integrity/notifier/prowl.rb",
31
+ "test/dict",
32
+ "test/integrity_prowl_test.rb",
33
+ "test/test_helper.rb"
34
+ ]
35
+ s.homepage = %q{http://github.com/bdotdub/integrity-prowl}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubyforge_project = %q{integrity}
39
+ s.rubygems_version = %q{1.3.5}
40
+ s.summary = %q{Prowl notifier for the Integrity continuous integration server}
41
+ s.test_files = [
42
+ "test/integrity_prowl_test.rb",
43
+ "test/test_helper.rb"
44
+ ]
45
+
46
+ if s.respond_to? :specification_version then
47
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
48
+ s.specification_version = 3
49
+
50
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
51
+ s.add_runtime_dependency(%q<integrity>, [">= 0"])
52
+ s.add_runtime_dependency(%q<prowl>, [">= 0"])
53
+ else
54
+ s.add_dependency(%q<integrity>, [">= 0"])
55
+ s.add_dependency(%q<prowl>, [">= 0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<integrity>, [">= 0"])
59
+ s.add_dependency(%q<prowl>, [">= 0"])
60
+ end
61
+ end
@@ -0,0 +1,10 @@
1
+ %p.normal
2
+ %div
3
+ Enter your
4
+ %a{ :href => 'https://prowl.weks.net/settings.php' } Prowl API Key(s)
5
+ (separated by commas)
6
+ %label{ :for => "prowl_api_keys" } API Key(s)
7
+ %input.text#tumblr_notifier_email{ :name => "notifiers[Prowl][api_keys]", :value => config['api_keys'], :type => 'text' }
8
+ %input.checkbox#tumblr_notifier_successful{ :name => "notifiers[Prowl][successful]", :checked => config['successful'], :type => 'checkbox', :value => "1" }
9
+ %input.checkbox#tumblr_notifier_failed{ :name => "notifiers[Prowl][failed]", :checked => config['failed'], :type => 'checkbox', :value => "1" }
10
+ %input.checkbox#tumblr_notifier_pending{ :name => "notifiers[Prowl][pending]", :checked => config['pending'], :type => 'checkbox', :value => "1" }
@@ -0,0 +1,36 @@
1
+ require 'integrity'
2
+ require 'prowl'
3
+
4
+ module Integrity
5
+ class Notifier
6
+ class Prowl < Notifier::Base
7
+ attr_reader :config
8
+
9
+ def self.to_haml
10
+ File.read(File.dirname(__FILE__) + '/config.haml')
11
+ end
12
+
13
+ def deliver!
14
+ return unless config[commit.status.to_s] == '1'
15
+
16
+ if api_keys = config['api_keys']
17
+ api_keys.split(',').each do |key|
18
+ prowl_params = {}
19
+ prowl_params[:application] = 'Integrity'
20
+ prowl_params[:event] = short_message
21
+ prowl_params[:description] = full_message
22
+
23
+ ::Prowl.add(key, prowl_params)
24
+ end
25
+ end
26
+ end
27
+
28
+ def to_s
29
+ 'Prowl'
30
+ end
31
+ end
32
+
33
+ register Prowl
34
+ end
35
+ end
36
+
data/test/dict ADDED
@@ -0,0 +1,50 @@
1
+ A
2
+ a
3
+ aa
4
+ aal
5
+ aalii
6
+ aam
7
+ Aani
8
+ aardvark
9
+ aardwolf
10
+ Aaron
11
+ Aaronic
12
+ Aaronical
13
+ Aaronite
14
+ Aaronitic
15
+ Aaru
16
+ Ab
17
+ aba
18
+ Ababdeh
19
+ Ababua
20
+ abac
21
+ abaca
22
+ abacate
23
+ abacay
24
+ abacinate
25
+ abacination
26
+ abaciscus
27
+ abacist
28
+ aback
29
+ abactinal
30
+ abactinally
31
+ abaction
32
+ abactor
33
+ abaculus
34
+ abacus
35
+ Abadite
36
+ abaff
37
+ abaft
38
+ abaisance
39
+ abaiser
40
+ abaissed
41
+ abalienate
42
+ abalienation
43
+ abalone
44
+ Abama
45
+ abampere
46
+ abandon
47
+ abandonable
48
+ abandoned
49
+ abandonedly
50
+ abandonee
@@ -0,0 +1,77 @@
1
+ require 'test_helper'
2
+ require 'integrity/notifier/test'
3
+ require 'integrity/notifier/prowl'
4
+
5
+ class IntegrityProwlTest < Test::Unit::TestCase
6
+ include Integrity::Notifier::Test
7
+
8
+ context 'A prowl notifier' do
9
+ setup do
10
+ setup_database
11
+ end
12
+
13
+ should 'register itself' do
14
+ assert_equal Integrity::Notifier::Prowl,
15
+ Integrity::Notifier.available['Prowl']
16
+ end
17
+
18
+ context 'with valid API keys' do
19
+ should 'add one prowl message with one key' do
20
+ config = { 'api_keys' => 'an_api_key', 'failed' => '1' }
21
+ flexmock(::Prowl).should_receive(:add).once
22
+
23
+ notifier = Integrity::Notifier::Prowl
24
+ notifier.notify_of_build(Integrity::Build.gen(:failed), config)
25
+ end
26
+
27
+ should 'add n prowl message with n keys' do
28
+ [5, 10, 25, 50].each do |to|
29
+ keys = (0...to).map{ |n| "api_key_#{n}" }
30
+ config = { 'api_keys' => keys.join(','), 'failed' => '1' }
31
+ flexmock(::Prowl).should_receive(:add).times(keys.length)
32
+
33
+ notifier = Integrity::Notifier::Prowl
34
+ notifier.notify_of_build(Integrity::Build.gen(:failed), config)
35
+ end
36
+ end
37
+ end
38
+
39
+ should 'not notify prowl if no key is provided' do
40
+ [nil, ''].each do |key|
41
+ config = { 'api_keys' => key, 'failed' => 1 }
42
+ flexmock(::Prowl).should_receive(:add).times(0)
43
+
44
+ notifier = Integrity::Notifier::Prowl
45
+ notifier.notify_of_build(Integrity::Build.gen(:failed), config)
46
+ end
47
+ end
48
+
49
+ context 'state' do
50
+ should 'not notify if no states are checked' do
51
+ config = { 'api_keys' => 'an_api_key' }
52
+ flexmock(::Prowl).should_receive(:add).times(0)
53
+
54
+ notifier = Integrity::Notifier::Prowl
55
+ notifier.notify_of_build(Integrity::Build.gen(:successful), config)
56
+ end
57
+
58
+ should 'not notify if the state is not checked' do
59
+ config = { 'api_keys' => 'an_api_key', 'failed' => '1' }
60
+ flexmock(::Prowl).should_receive(:add).times(0)
61
+
62
+ notifier = Integrity::Notifier::Prowl
63
+ notifier.notify_of_build(Integrity::Build.gen(:successful), config)
64
+ end
65
+
66
+ should 'send notification when correct status is set' do
67
+ config = { 'api_keys' => 'an_api_key', 'failed' => '1', 'successful' => '1' }
68
+ flexmock(::Prowl).should_receive(:add).times(1)
69
+
70
+ [:successful, :failed].each do |status|
71
+ notifier = Integrity::Notifier::Prowl
72
+ notifier.notify_of_build(Integrity::Build.gen(status), config)
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'flexmock/test_unit'
4
+ require 'shoulda'
5
+ require 'randexp'
6
+
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
9
+
10
+ class Randexp::Dictionary
11
+ def self.load_dictionary
12
+ File.read(File.dirname(__FILE__) + '/dict').split
13
+ end
14
+ end
15
+
16
+ class Test::Unit::TestCase
17
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: integrity-prowl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Benny Wong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-27 00:00:00 -04: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: prowl
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: Sends a notification from Integrity to Prowl after each build
36
+ email: benny@bwong.net
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.markdown
44
+ - README.rdoc
45
+ files:
46
+ - .document
47
+ - .gitignore
48
+ - LICENSE
49
+ - README.markdown
50
+ - README.rdoc
51
+ - Rakefile
52
+ - VERSION
53
+ - integrity-prowl.gemspec
54
+ - lib/integrity/notifier/config.haml
55
+ - lib/integrity/notifier/prowl.rb
56
+ - test/dict
57
+ - test/integrity_prowl_test.rb
58
+ - test/test_helper.rb
59
+ has_rdoc: true
60
+ homepage: http://github.com/bdotdub/integrity-prowl
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options:
65
+ - --charset=UTF-8
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ requirements: []
81
+
82
+ rubyforge_project: integrity
83
+ rubygems_version: 1.3.5
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Prowl notifier for the Integrity continuous integration server
87
+ test_files:
88
+ - test/integrity_prowl_test.rb
89
+ - test/test_helper.rb