integrity-email 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "integrity-email"
3
- s.version = "1.0.3"
4
- s.date = "2009-04-06"
3
+ s.version = "1.0.4"
4
+ s.date = "2009-06-01"
5
5
  s.summary = "Email notifier for the Integrity continuous integration server"
6
6
  s.description = "Easily let Integrity send emails after each build"
7
7
  s.homepage = "http://integrityapp.com"
@@ -24,12 +24,15 @@
24
24
 
25
25
  %p.normal
26
26
  %label{ :for => "email_notifier_auth" } Auth type
27
- %select#email_notifier_auth{ :name => "notifiers[Email][auth]", :value => (config["auth"] || "plain"), :type => "text" }
28
- %option{ :value => '', :selected => true } none
29
- %option{ :value => 'login'} login
30
- %option{ :value => 'cram_md5' } cram_md5
31
- %option{ :value => 'plain' } plain
27
+ %input.text#email_notifier_auth{ :name => "notifiers[Email][auth]", :value => (config["auth"] || "plain"), :type => "text" }
32
28
 
33
29
  %p.normal
34
30
  %label{ :for => "email_notifier_domain" } Domain
35
31
  %input.text#email_notifier_domain{ :name => "notifiers[Email][domain]", :value => config["domain"], :type => "text" }
32
+
33
+
34
+ %h3 Or, enter the path to sendmail:
35
+
36
+ %p.normal
37
+ %label{ :for => "email_notifier_sendmail" } Sendmail path (often /usr/sbin/sendmail)
38
+ %input.text#email_notifier_sendmail{ :name => "notifiers[Email][sendmail]", :value => config["sendmail"], :type => "text" }
@@ -38,6 +38,11 @@ module Integrity
38
38
 
39
39
  private
40
40
  def configure_mailer
41
+ return configure_sendmail unless @config["sendmail"].blank?
42
+ configure_smtp
43
+ end
44
+
45
+ def configure_smtp
41
46
  user = @config["user"] || ""
42
47
  pass = @config["pass"] || ""
43
48
  user = nil if user.empty?
@@ -54,6 +59,11 @@ module Integrity
54
59
  :domain => @config["domain"]
55
60
  }
56
61
  end
62
+
63
+ def configure_sendmail
64
+ Sinatra::Mailer.delivery_method = :sendmail
65
+ Sinatra::Mailer.config = {:sendmail_path => @config['sendmail']}
66
+ end
57
67
  end
58
68
 
59
69
  register Email
@@ -40,16 +40,17 @@ class IntegrityEmailTest < Test::Unit::TestCase
40
40
  end
41
41
 
42
42
  def test_configuration_form
43
- assert_form_have_tag "h3", :content => "SMTP Server Configuration"
44
-
45
- assert_form_have_option "to", "foo@example.org"
46
- assert_form_have_option "from", "bar@example.org"
47
- assert_form_have_option "host", "foobarhost.biz"
48
- assert_form_have_option "user", "foobaruser"
49
- assert_form_have_option "pass", "secret"
50
- # TODO assert_form_have_option "auth", "plain"
51
- assert_form_have_option "pass", "secret"
52
- assert_form_have_option "domain","localhost"
43
+ assert form_have_tag?("h3", :content => "SMTP Server Configuration")
44
+
45
+ assert provides_option? "to", "foo@example.org"
46
+ assert provides_option? "from", "bar@example.org"
47
+ assert provides_option? "host", "foobarhost.biz"
48
+ assert provides_option? "user", "foobaruser"
49
+ assert provides_option? "pass", "secret"
50
+ assert provides_option? "auth", "plain"
51
+ assert provides_option? "pass", "secret"
52
+ assert provides_option? "domain","localhost"
53
+ assert provides_option? "sendmail","/usr/sbin/sendmail"
53
54
  end
54
55
 
55
56
  def test_it_sends_email_notification
@@ -64,6 +65,8 @@ class IntegrityEmailTest < Test::Unit::TestCase
64
65
  Integrity::Notifier::Email.new(successful, config.dup).deliver!
65
66
  Integrity::Notifier::Email.new(failed, config).deliver!
66
67
 
68
+ assert_equal "net_smtp", Sinatra::Mailer.delivery_method
69
+
67
70
  mail = @mail_observer.messages.first
68
71
 
69
72
  assert_equal ["you@example.org"], mail.destinations
@@ -73,4 +76,18 @@ class IntegrityEmailTest < Test::Unit::TestCase
73
76
  assert mail.body.include?(successful.author.name)
74
77
  assert mail.body.include?(successful.output)
75
78
  end
79
+
80
+ def test_it_configures_email_notification_with_sendmail
81
+ sendmail_path = "/usr/sbin/sendmail"
82
+
83
+ config = { "sendmail" => sendmail_path,
84
+ "to" => "sendmail@example.org",
85
+ "from" => "me@example.org" }
86
+ successful = commit(:successful)
87
+
88
+ Integrity::Notifier::Email.new(successful, config)
89
+
90
+ assert_equal :sendmail, Sinatra::Mailer.delivery_method
91
+ assert_equal sendmail_path, Sinatra::Mailer.config[:sendmail_path]
92
+ end
76
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integrity-email
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Nicol\xC3\xA1s Sanguinetti"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-04-06 00:00:00 +02:00
13
+ date: 2009-06-01 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -58,8 +58,10 @@ files:
58
58
  - lib/integrity/notifier/config.haml
59
59
  - lib/integrity/notifier/email.rb
60
60
  - test/integrity_email_test.rb
61
- has_rdoc: false
61
+ has_rdoc: true
62
62
  homepage: http://integrityapp.com
63
+ licenses: []
64
+
63
65
  post_install_message:
64
66
  rdoc_options: []
65
67
 
@@ -80,9 +82,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
82
  requirements: []
81
83
 
82
84
  rubyforge_project: integrity
83
- rubygems_version: 1.3.1
85
+ rubygems_version: 1.3.3
84
86
  signing_key:
85
- specification_version: 2
87
+ specification_version: 3
86
88
  summary: Email notifier for the Integrity continuous integration server
87
89
  test_files: []
88
90