mpilat-integrity-email 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,52 @@
1
+ Integrity
2
+ =========
3
+
4
+ [Integrity][] is your friendly automated Continuous Integration server.
5
+
6
+ Integrity Email Notifier
7
+ ========================
8
+
9
+ This lets Integrity send emails 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
+ foca-integrity-email` and then in your Rackup (ie, `config.ru`) file:
16
+
17
+ require "rubygems"
18
+ require "notifier/email"
19
+
20
+ And badabing! Now you can set up your projects to send emails after
21
+ each build (just edit the project and the config options should be
22
+ there)
23
+
24
+ License
25
+ =======
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2008 [Nicolás Sanguinetti][foca], [entp][]
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
51
+ [foca]: http://nicolassanguinetti.info
52
+ [entp]: http://entp.com
@@ -0,0 +1,37 @@
1
+ %p.normal
2
+ %label{ :for => "email_notifier_to" } Send to
3
+ %input.text#email_notifier_to{ :name => "notifiers[Email][to]", :type => "text", :value => config["to"] }
4
+
5
+ %p.normal
6
+ %label{ :for => "email_notifier_from" } Send from
7
+ %input.text#email_notifier_from{ :name => "notifiers[Email][from]", :type => "text", :value => config["from"] }
8
+
9
+ %h3 SMTP Server Configuration
10
+
11
+ %p.normal
12
+ %label{ :for => "email_notifier_host" } Host : Port
13
+ = succeed " : " do
14
+ %input.text#email_notifier_host{ :name => "notifiers[Email][host]", :value => config["host"], :style => "width: 24.5em;", :type => "text" }
15
+ %input.text#email_notifier_port{ :name => "notifiers[Email][port]", :value => config["port"], :style => "width: 3.5em;", :type => "text" }
16
+
17
+ %p.normal
18
+ %label{ :for => "email_notifier_user" } User
19
+ %input.text#email_notifier_user{ :name => "notifiers[Email][user]", :value => config["user"], :type => "text" }
20
+
21
+ %p.normal
22
+ %label{ :for => "email_notifier_pass" } Password
23
+ %input.text#email_notifier_pass{ :name => "notifiers[Email][pass]", :value => config["pass"], :type => "text" }
24
+
25
+ %p.normal
26
+ %label{ :for => "email_notifier_auth" } Auth type
27
+ %input.text#email_notifier_auth{ :name => "notifiers[Email][auth]", :value => (config["auth"] || "plain"), :type => "text" }
28
+
29
+ %p.normal
30
+ %label{ :for => "email_notifier_domain" } Domain
31
+ %input.text#email_notifier_domain{ :name => "notifiers[Email][domain]", :value => config["domain"], :type => "text" }
32
+
33
+ %h3 Or, the path to sendmail:
34
+
35
+ %p.normal
36
+ %label{ :for => "email_notifier_sendmail" } Sendmail path
37
+ %input.text#email_notifier_sendmail{ :name => "notifiers[Email][sendmail]", :value => config["sendmail"] || '/usr/sbin/sendmail', :type => "text" }
@@ -0,0 +1,65 @@
1
+ require 'rubygems'
2
+ require 'integrity'
3
+ require 'diddies/mailer'
4
+
5
+ module Integrity
6
+ class Notifier
7
+ class Email < Notifier::Base
8
+ attr_reader :to, :from
9
+
10
+ def self.to_haml
11
+ File.read File.dirname(__FILE__) / "config.haml"
12
+ end
13
+
14
+ def initialize(build, config={})
15
+ @to = config.delete("to")
16
+ @from = config.delete("from")
17
+ super
18
+ configure_mailer
19
+ end
20
+
21
+ def deliver!
22
+ email.deliver!
23
+ end
24
+
25
+ def email
26
+ @email ||= Sinatra::Mailer::Email.new(
27
+ :to => to,
28
+ :from => from,
29
+ :text => body,
30
+ :subject => subject
31
+ )
32
+ end
33
+
34
+ def subject
35
+ "[Integrity] #{build.project.name}: #{short_message}"
36
+ end
37
+
38
+ alias :body :full_message
39
+
40
+ private
41
+
42
+ def configure_mailer
43
+ if @config["sendmail"]
44
+ Sinatra::Mailer.delivery_method = 'sendmail'
45
+ Sinatra::Mailer.config = {:sendmail_path => @config['sendmail']}
46
+
47
+ else
48
+ user = @config["user"]
49
+ pass = @config["pass"]
50
+
51
+ user = pass = nil if user.empty? && pass.empty?
52
+ Sinatra::Mailer.delivery_method = "net_smtp"
53
+ Sinatra::Mailer.config = {
54
+ :host => @config["host"],
55
+ :port => @config["port"],
56
+ :user => user,
57
+ :pass => pass,
58
+ :auth => @config["auth"],
59
+ :domain => @config["domain"]
60
+ }
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mpilat-integrity-email
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Pilat
8
+ - others
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-03-14 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: foca-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"
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: foca-sinatra-diddies
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 0.0.2
35
+ version:
36
+ description: Easily let Integrity send emails after each build using SendMail
37
+ email: mpilat@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - README.markdown
46
+ - lib/notifier/config.haml
47
+ - lib/notifier/email.rb
48
+ has_rdoc: false
49
+ homepage: http://integrityapp.com
50
+ post_install_message:
51
+ rdoc_options: []
52
+
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ requirements: []
68
+
69
+ rubyforge_project:
70
+ rubygems_version: 1.2.0
71
+ signing_key:
72
+ specification_version: 2
73
+ summary: Email notifier for the Integrity continuous integration server
74
+ test_files: []
75
+