capistrano-notifier 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  env:
2
- - TEST_ENV=default
3
- - TEST_ENV=rails-2.3
4
- - TEST_ENV=rails-3.0
5
- - TEST_ENV=rails-3.1
6
- - TEST_ENV=rails-3.2
2
+ - RAILS_VERSION=none
3
+ - RAILS_VERSION=2.3
4
+ - RAILS_VERSION=3.0
5
+ - RAILS_VERSION=3.1
6
+ - RAILS_VERSION=3.2
7
7
  rvm:
8
8
  - 1.8.7
9
9
  - 1.9.2
@@ -19,7 +19,7 @@ matrix:
19
19
  - rvm: ruby-head
20
20
  exclude:
21
21
  - rvm: ruby-head
22
- env: TEST_ENV=rails-2.3
22
+ env: RAILS_VERSION=2.3
23
23
  notifications:
24
24
  email:
25
25
  - sysadmin@cramerdev.com
data/README.md CHANGED
@@ -30,9 +30,30 @@ set :notifier_mail_options, {
30
30
  }
31
31
  ```
32
32
 
33
- If you specified `:method => test`, you can see the email that would be
33
+ If you specified `:method => :test`, you can see the email that would be
34
34
  generated in your console with `cap deploy:notify:mail`.
35
35
 
36
+ If you specified `:method => :smtp`, you can specify `:smtp_settings`
37
+
38
+ For example:
39
+
40
+ ```rb
41
+ set :notifier_mail_options, {
42
+ :method => :smtp,
43
+ :from => 'capistrano@domain.com',
44
+ :to => ['john@doe.com', 'jane@doe.com'],
45
+ :github => 'MyCompany/project-name',
46
+ :smtp_settings => {
47
+ address: "smtp.gmail.com",
48
+ port: 587,
49
+ domain: "gmail.com",
50
+ authentication: "plain",
51
+ enable_starttls_auto: true,
52
+ user_name: MY_USERNAME,
53
+ password: MY_PASSWORD
54
+ }
55
+ }
56
+ ```
36
57
 
37
58
  ## StatsD
38
59
 
@@ -15,14 +15,14 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Capistrano::Notifier::VERSION
17
17
 
18
- case ENV['TEST_ENV']
19
- when 'rails-2.3'
18
+ case ENV['RAILS_VERSION']
19
+ when '2.3'
20
20
  gem.add_dependency 'actionmailer', '~> 2.3.0'
21
- when 'rails-3.0'
21
+ when '3.0'
22
22
  gem.add_dependency 'actionmailer', '~> 3.0.0'
23
- when 'rails-3.1'
23
+ when '3.1'
24
24
  gem.add_dependency 'actionmailer', '~> 3.1.0'
25
- when 'rails-3.2'
25
+ when '3.2'
26
26
  gem.add_dependency 'actionmailer', '~> 3.2.0'
27
27
  else
28
28
  gem.add_dependency 'actionmailer'
@@ -65,6 +65,7 @@ class Capistrano::Notifier::Mail < Capistrano::Notifier::Base
65
65
  end
66
66
 
67
67
  def perform_with_action_mailer(notifier = Capistrano::Notifier::Mailer)
68
+ notifier.smtp_settings = smtp_settings
68
69
  notifier.notice(text, from, subject, to, notify_method).deliver
69
70
  end
70
71
 
@@ -114,6 +115,10 @@ class Capistrano::Notifier::Mail < Capistrano::Notifier::Base
114
115
  cap.notifier_mail_options[:method]
115
116
  end
116
117
 
118
+ def smtp_settings
119
+ cap.notifier_mail_options[:smtp_settings]
120
+ end
121
+
117
122
  def subject
118
123
  "#{application.titleize} branch #{branch} deployed to #{stage}"
119
124
  end
@@ -20,7 +20,7 @@ class Capistrano::Notifier::StatsD < Capistrano::Notifier::Base
20
20
  end
21
21
 
22
22
  def command
23
- "echo #{packet.gsub('|', '\\|')} | nc -w 1 -u #{host} #{port}"
23
+ "echo -n #{packet.gsub('|', '\\|')} | nc -w 1 -u #{host} #{port}"
24
24
  end
25
25
 
26
26
  private
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Notifier
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -48,12 +48,52 @@ describe Capistrano::Notifier::Mail do
48
48
 
49
49
  ActionMailer::Base.deliveries.clear
50
50
  end
51
-
51
+
52
52
  it { subject.send(:github).should == 'example/example' }
53
53
  it { subject.send(:notify_method).should == :sendmail }
54
54
  it { subject.send(:from).should == 'sender@example.com' }
55
55
  it { subject.send(:to).should == 'example@example.com' }
56
56
 
57
+
58
+ it 'delivers smtp mail' do
59
+ configuration.load do |configuration|
60
+ set :notifier_mail_options, {
61
+ :github => 'example/example',
62
+ :method => :test,
63
+ :from => 'sender@example.com',
64
+ :to => 'example@example.com',
65
+ :smtp_settings => {
66
+ :address => "smtp.gmail.com",
67
+ :port => 587,
68
+ :domain => "gmail.com",
69
+ :authentication => "plain",
70
+ :enable_starttls_auto => true,
71
+ :user_name => "USERNAME",
72
+ :password => "PASSWORD"
73
+ }
74
+ }
75
+ end
76
+
77
+ subject.perform
78
+
79
+ subject.send(:smtp_settings).should == {
80
+ :address => "smtp.gmail.com",
81
+ :port => 587,
82
+ :domain => "gmail.com",
83
+ :authentication => "plain",
84
+ :enable_starttls_auto => true,
85
+ :user_name => "USERNAME",
86
+ :password => "PASSWORD"
87
+ }
88
+
89
+ last_delivery = ActionMailer::Base.deliveries.last
90
+
91
+ last_delivery.to.should include 'example@example.com'
92
+ last_delivery.from.should include 'sender@example.com'
93
+
94
+ ActionMailer::Base.deliveries.clear
95
+ end
96
+
57
97
  it "creates a subject" do
58
98
  subject.send(:subject).should == "Example branch master deployed to test"
59
99
  end
@@ -21,7 +21,7 @@ describe Capistrano::Notifier::StatsD do
21
21
 
22
22
  it "creates a command" do
23
23
  subject.command.should ==
24
- "echo example.deploy:1\\|c | nc -w 1 -u 127.0.0.1 8125"
24
+ "echo -n example.deploy:1\\|c | nc -w 1 -u 127.0.0.1 8125"
25
25
  end
26
26
 
27
27
  context "with a stage" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-06 00:00:00.000000000 Z
13
+ date: 2013-01-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionmailer
@@ -151,15 +151,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  - - ! '>='
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
+ segments:
155
+ - 0
156
+ hash: -700121420444324432
154
157
  required_rubygems_version: !ruby/object:Gem::Requirement
155
158
  none: false
156
159
  requirements:
157
160
  - - ! '>='
158
161
  - !ruby/object:Gem::Version
159
162
  version: '0'
163
+ segments:
164
+ - 0
165
+ hash: -700121420444324432
160
166
  requirements: []
161
167
  rubyforge_project:
162
- rubygems_version: 1.8.23
168
+ rubygems_version: 1.8.24
163
169
  signing_key:
164
170
  specification_version: 3
165
171
  summary: Capistrano Notifier