capistrano-notifier 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -13
- data/Gemfile +1 -9
- data/README.md +51 -0
- data/capistrano-notifier.gemspec +4 -8
- data/lib/capistrano/notifier/mail.rb +45 -35
- data/lib/capistrano/notifier/statsd.rb +12 -6
- data/lib/capistrano/notifier/templates/mail.html.erb +42 -0
- data/lib/capistrano/notifier/templates/mail.text.erb +11 -0
- data/lib/capistrano/notifier/version.rb +1 -1
- data/spec/capistrano/notifier/mail_spec.rb +115 -39
- data/spec/capistrano/notifier/statsd_spec.rb +20 -3
- metadata +26 -36
- data/lib/capistrano/notifier/templates/mail.erb +0 -0
- data/lib/capistrano/notifier/templates/mail.txt.erb +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4d9227ceb01d7add2fed25486430cd6e0b5da2a7
|
4
|
+
data.tar.gz: 529fa6ce30beff4acc1ae87183cc7c20fb0c8e35
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 66b2281400a6d5b61d02959e57adb11060f93fec8b600d11a8d9eef444054fc714a3a16e4015931d643ad6cfba19688d352ace8ec1c0f66a65478a91f2d2c39c
|
7
|
+
data.tar.gz: 916d98341f09ae07879b2e395af6d723a39510d7dc18565056ea984a77f9cbd5ef48d7870a076e73a2a59692e6738ee44110510246ac11d37337fbda68ff6a2a
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,25 +1,17 @@
|
|
1
1
|
env:
|
2
2
|
- RAILS_VERSION=none
|
3
|
-
- RAILS_VERSION=2.3
|
4
|
-
- RAILS_VERSION=3.0
|
5
|
-
- RAILS_VERSION=3.1
|
6
3
|
- RAILS_VERSION=3.2
|
4
|
+
- RAILS_VERSION=4.0
|
7
5
|
rvm:
|
8
|
-
- 1.8.7
|
9
|
-
- 1.9.2
|
10
6
|
- 1.9.3
|
11
|
-
-
|
12
|
-
- rbx
|
13
|
-
- ree
|
7
|
+
- 2.0.0
|
14
8
|
- ruby-head
|
9
|
+
- jruby-19mode
|
10
|
+
- jruby-head
|
15
11
|
matrix:
|
16
12
|
allow_failures:
|
17
|
-
- rvm: jruby
|
18
|
-
- rvm: rbx
|
19
13
|
- rvm: ruby-head
|
20
|
-
|
21
|
-
- rvm: ruby-head
|
22
|
-
env: RAILS_VERSION=2.3
|
14
|
+
- rvm: jruby-head
|
23
15
|
notifications:
|
24
16
|
email:
|
25
17
|
- sysadmin@cramerdev.com
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -55,6 +55,45 @@ set :notifier_mail_options, {
|
|
55
55
|
}
|
56
56
|
```
|
57
57
|
|
58
|
+
### Templates
|
59
|
+
|
60
|
+
This gem comes with two different ERB templates that are used to generate the body of the email. To choose from each one of them, you can set the `format` option to either `:html` - for HTML emails - or `:text` - for plain text.
|
61
|
+
|
62
|
+
The following are the default values for the template options:
|
63
|
+
|
64
|
+
- `format`: `:text`
|
65
|
+
- `templates_path`: `"config/deploy/templates"`
|
66
|
+
- `template`: `"mail.#{format}.erb"`. Note the dependency of this option on `format`.
|
67
|
+
|
68
|
+
The relationship between these variables might seem a bit complex but provides great flexibility. The logic used is as follows:
|
69
|
+
|
70
|
+
- If the file exists in `"#{templates_path}/#{template}"`, then use that one. With no option set, this will default to `config/deploy/templates/mail.text.erb`.
|
71
|
+
|
72
|
+
- If the file doesn't exist in the previous path, load `"#{template}"` from one of the gem's templates, either `mail.text.erb` or `mail.html.erb`. With no options set, this will default to `mail.text.erb` due to how the `template` option is generated. See above.
|
73
|
+
|
74
|
+
For those interested in creating customized templates, it is important to know that you can use any of the variables defined in capistrano by prefixing it with the `cap` method like below:
|
75
|
+
|
76
|
+
```rb
|
77
|
+
<%= cap.any_variable_defined_in_capistrano %>
|
78
|
+
```
|
79
|
+
|
80
|
+
The following is a list of some popular variables that don't require the use of the `cap.` prefix:
|
81
|
+
|
82
|
+
- `application`: Name of the application.
|
83
|
+
- `branch`: Name of the branch to be deployed.
|
84
|
+
- `git_commit_prefix`: URL of the format `"#{git_prefix}/commit"`.
|
85
|
+
- `git_compare_prefix`: URL of the format `"#{git_prefix}/compare"`.
|
86
|
+
- `git_current_revision`: Commit for current revision.
|
87
|
+
- `git_log`: Simplified log of commits in the `git_range`.
|
88
|
+
- `git_prefix`: URL to the github repository. Depends on `giturl` or `github` variables.
|
89
|
+
- `git_previous_revision`: Commit for previous revision.
|
90
|
+
- `git_range`: Range of commits between previous and current revision. Example: xxx..yyy
|
91
|
+
- `github`: URL path to the GitHub respository. Ex: 'MyCompany/project-name'.
|
92
|
+
- `giturl`: Base URL to the repository.
|
93
|
+
- `now`: Current time.
|
94
|
+
- `stage`: Name of the stage from the capistrano multistage extension.
|
95
|
+
- `user_name`: Name of the local git author.
|
96
|
+
|
58
97
|
## StatsD
|
59
98
|
|
60
99
|
```rb
|
@@ -81,4 +120,16 @@ set :notifier_statsd_options, {
|
|
81
120
|
}
|
82
121
|
```
|
83
122
|
|
123
|
+
You can define the pattern that will be used to define the key.
|
124
|
+
In the example the key will be 'test.deployment.example'
|
125
|
+
|
126
|
+
```rb
|
127
|
+
set :application, 'example'
|
128
|
+
set :stage, 'test'
|
129
|
+
|
130
|
+
set :notifier_statsd_options, {
|
131
|
+
:pattern => "#{stage}.deployment.#{application}"
|
132
|
+
}
|
133
|
+
```
|
134
|
+
|
84
135
|
The `nc` ([Netcat](http://netcat.sourceforge.net/)) command is used to send messages to statsd and must be installed on the remote hosts. This is installed by default on most Unix machines.
|
data/capistrano-notifier.gemspec
CHANGED
@@ -16,22 +16,18 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Capistrano::Notifier::VERSION
|
17
17
|
|
18
18
|
case ENV['RAILS_VERSION']
|
19
|
-
when '2.3'
|
20
|
-
gem.add_dependency 'actionmailer', '~> 2.3.0'
|
21
|
-
when '3.0'
|
22
|
-
gem.add_dependency 'actionmailer', '~> 3.0.0'
|
23
|
-
when '3.1'
|
24
|
-
gem.add_dependency 'actionmailer', '~> 3.1.0'
|
25
19
|
when '3.2'
|
26
20
|
gem.add_dependency 'actionmailer', '~> 3.2.0'
|
21
|
+
when '4.0'
|
22
|
+
gem.add_dependency 'actionmailer', '~> 4.0.0'
|
27
23
|
else
|
28
24
|
gem.add_dependency 'actionmailer'
|
29
25
|
end
|
30
26
|
|
31
27
|
gem.add_dependency 'activesupport'
|
32
|
-
gem.add_dependency 'capistrano', '>= 2'
|
28
|
+
gem.add_dependency 'capistrano', '>= 2', '< 3'
|
33
29
|
|
34
|
-
gem.add_development_dependency '
|
30
|
+
gem.add_development_dependency 'rake'
|
35
31
|
gem.add_development_dependency 'rspec'
|
36
32
|
gem.add_development_dependency 'timecop'
|
37
33
|
end
|
@@ -2,28 +2,34 @@ require 'capistrano/notifier'
|
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'action_mailer'
|
5
|
-
rescue LoadError
|
5
|
+
rescue LoadError
|
6
6
|
require 'actionmailer'
|
7
7
|
end
|
8
8
|
|
9
9
|
class Capistrano::Notifier::Mailer < ActionMailer::Base
|
10
10
|
|
11
|
+
def content_type_for_format(format)
|
12
|
+
format == :html ? 'text/html' : 'text/plain'
|
13
|
+
end
|
14
|
+
|
11
15
|
if ActionMailer::Base.respond_to?(:mail)
|
12
|
-
def notice(text, from, subject, to, delivery_method)
|
16
|
+
def notice(text, from, subject, to, delivery_method, format)
|
13
17
|
mail({
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
18
|
+
body: text,
|
19
|
+
delivery_method: delivery_method,
|
20
|
+
content_type: content_type_for_format(format),
|
21
|
+
from: from,
|
22
|
+
subject: subject,
|
23
|
+
to: to
|
19
24
|
})
|
20
25
|
end
|
21
26
|
else
|
22
|
-
def notice(text, from, subject, to)
|
27
|
+
def notice(text, from, subject, to, format)
|
23
28
|
body text
|
29
|
+
content_type content_type_for_format(format)
|
24
30
|
from from
|
25
|
-
subject subject
|
26
31
|
recipients to
|
32
|
+
subject subject
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
@@ -61,54 +67,44 @@ class Capistrano::Notifier::Mail < Capistrano::Notifier::Base
|
|
61
67
|
|
62
68
|
def perform_with_legacy_action_mailer(notifier = Capistrano::Notifier::Mailer)
|
63
69
|
notifier.delivery_method = notify_method
|
64
|
-
notifier.deliver_notice(text, from, subject, to)
|
70
|
+
notifier.deliver_notice(text, from, subject, to, format)
|
65
71
|
end
|
66
72
|
|
67
73
|
def perform_with_action_mailer(notifier = Capistrano::Notifier::Mailer)
|
68
74
|
notifier.smtp_settings = smtp_settings
|
69
|
-
notifier.notice(text, from, subject, to, notify_method).deliver
|
75
|
+
notifier.notice(text, from, subject, to, notify_method, format).deliver
|
70
76
|
end
|
71
77
|
|
72
|
-
def
|
73
|
-
|
74
|
-
|
75
|
-
#{application.titleize} branch
|
76
|
-
#{branch} to
|
77
|
-
#{stage} on
|
78
|
-
#{now.strftime("%m/%d/%Y")} at
|
79
|
-
#{now.strftime("%I:%M %p %Z")}
|
78
|
+
def email_template
|
79
|
+
cap.notifier_mail_options[:template] || "mail.#{format.to_s}.erb"
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
BODY
|
82
|
+
def format
|
83
|
+
cap.notifier_mail_options[:format] || :text
|
84
84
|
end
|
85
85
|
|
86
86
|
def from
|
87
87
|
cap.notifier_mail_options[:from]
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
91
|
-
"#{
|
90
|
+
def git_commit_prefix
|
91
|
+
"#{git_prefix}/commit"
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
95
|
-
"#{
|
94
|
+
def git_compare_prefix
|
95
|
+
"#{git_prefix}/compare"
|
96
96
|
end
|
97
97
|
|
98
|
-
def
|
99
|
-
"https://github.com/#{github}"
|
98
|
+
def git_prefix
|
99
|
+
giturl ? giturl : "https://github.com/#{github}"
|
100
100
|
end
|
101
101
|
|
102
102
|
def github
|
103
103
|
cap.notifier_mail_options[:github]
|
104
104
|
end
|
105
105
|
|
106
|
-
def
|
107
|
-
|
108
|
-
/([0-9a-f]{7})\.\.([0-9a-f]{7})/, "<a href=\"#{github_compare_prefix}/\\1...\\2\">\\1..\\2</a>"
|
109
|
-
).gsub(
|
110
|
-
/^([0-9a-f]{7})/, "<a href=\"#{github_commit_prefix}/\\0\">\\0</a>"
|
111
|
-
)
|
106
|
+
def giturl
|
107
|
+
cap.notifier_mail_options[:giturl]
|
112
108
|
end
|
113
109
|
|
114
110
|
def notify_method
|
@@ -123,8 +119,22 @@ class Capistrano::Notifier::Mail < Capistrano::Notifier::Base
|
|
123
119
|
"#{application.titleize} branch #{branch} deployed to #{stage}"
|
124
120
|
end
|
125
121
|
|
122
|
+
def template(template_name)
|
123
|
+
config_file = "#{templates_path}/#{template_name}"
|
124
|
+
|
125
|
+
unless File.exists?(config_file)
|
126
|
+
config_file = File.join(File.dirname(__FILE__), "templates/#{template_name}")
|
127
|
+
end
|
128
|
+
|
129
|
+
ERB.new(File.read(config_file), nil, '-').result(binding)
|
130
|
+
end
|
131
|
+
|
132
|
+
def templates_path
|
133
|
+
cap.notifier_mail_options[:templates_path] || 'config/deploy/templates'
|
134
|
+
end
|
135
|
+
|
126
136
|
def text
|
127
|
-
|
137
|
+
template(email_template)
|
128
138
|
end
|
129
139
|
|
130
140
|
def to
|
@@ -2,7 +2,7 @@ require 'capistrano/notifier'
|
|
2
2
|
require 'socket'
|
3
3
|
|
4
4
|
class Capistrano::Notifier::StatsD < Capistrano::Notifier::Base
|
5
|
-
DEFAULTS = { :
|
5
|
+
DEFAULTS = { host: "127.0.0.1", port: "8125", with: :counter }
|
6
6
|
|
7
7
|
def self.load_into(configuration)
|
8
8
|
configuration.load do
|
@@ -38,11 +38,17 @@ class Capistrano::Notifier::StatsD < Capistrano::Notifier::Base
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def packet
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
"#{pattern}:#{with}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def pattern
|
45
|
+
options.fetch(:pattern){
|
46
|
+
if stage
|
47
|
+
"#{application}.#{stage}.deploy"
|
48
|
+
else
|
49
|
+
"#{application}.deploy"
|
50
|
+
end
|
51
|
+
}
|
46
52
|
end
|
47
53
|
|
48
54
|
def port
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
|
+
</head>
|
6
|
+
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
|
7
|
+
<h3>Details:</h3>
|
8
|
+
<table>
|
9
|
+
<tbody>
|
10
|
+
<tr>
|
11
|
+
<td><strong>Deployer:</strong></td>
|
12
|
+
<td><%= user_name %></td>
|
13
|
+
</tr>
|
14
|
+
<tr>
|
15
|
+
<td><strong>Application:</strong></td>
|
16
|
+
<td><%= application.titleize %></td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td><strong>Branch:</strong></td>
|
20
|
+
<td><%= branch %></td>
|
21
|
+
</tr>
|
22
|
+
<tr>
|
23
|
+
<td><strong>Environment:</strong></td>
|
24
|
+
<td><%= stage %></td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<td><strong>Time:</strong></td>
|
28
|
+
<td><%= now.strftime("%m/%d/%Y") %> at <%= now.strftime("%I:%M %p %Z") %></td>
|
29
|
+
</tr>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
32
|
+
|
33
|
+
<h3>Compare:</h3>
|
34
|
+
<p><%= git_compare_prefix %>/<%= git_range.gsub('..', '...') %></p>
|
35
|
+
|
36
|
+
<h3>Commits:</h3>
|
37
|
+
<%- git_log.split(/\n/).each do |commit| -%>
|
38
|
+
<p><%= commit %></p>
|
39
|
+
<%- end -%>
|
40
|
+
|
41
|
+
</body>
|
42
|
+
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Deployer: <%= user_name %>
|
2
|
+
Application: <%= application.titleize %>
|
3
|
+
Branch: <%= branch %>
|
4
|
+
Environment: <%= stage %>
|
5
|
+
Time: <%= now.strftime("%m/%d/%Y") %> at <%= now.strftime("%I:%M %p %Z") %>
|
6
|
+
|
7
|
+
Compare:
|
8
|
+
<%= git_compare_prefix %>/<%= git_range.gsub('..', '...') %>
|
9
|
+
|
10
|
+
Commits:
|
11
|
+
<%= git_log %>
|
@@ -8,10 +8,11 @@ describe Capistrano::Notifier::Mail do
|
|
8
8
|
before :each do
|
9
9
|
configuration.load do |configuration|
|
10
10
|
set :notifier_mail_options, {
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
11
|
+
github: 'example/example',
|
12
|
+
method: :sendmail,
|
13
|
+
from: 'sender@example.com',
|
14
|
+
to: 'example@example.com',
|
15
|
+
format: :text
|
15
16
|
}
|
16
17
|
|
17
18
|
set :application, 'example'
|
@@ -22,7 +23,7 @@ describe Capistrano::Notifier::Mail do
|
|
22
23
|
set :previous_revision, '890abcd0000000000000000000000000'
|
23
24
|
end
|
24
25
|
|
25
|
-
subject.stub(:git_log).and_return <<-LOG.gsub
|
26
|
+
subject.stub(:git_log).and_return <<-LOG.gsub(/^ {6}/, '')
|
26
27
|
1234567 This is the current commit (John Doe)
|
27
28
|
890abcd This is the previous commit (John Doe)
|
28
29
|
LOG
|
@@ -32,10 +33,10 @@ describe Capistrano::Notifier::Mail do
|
|
32
33
|
it 'delivers mail' do
|
33
34
|
configuration.load do |configuration|
|
34
35
|
set :notifier_mail_options, {
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
36
|
+
github: 'example/example',
|
37
|
+
method: :test,
|
38
|
+
from: 'sender@example.com',
|
39
|
+
to: 'example@example.com'
|
39
40
|
}
|
40
41
|
end
|
41
42
|
|
@@ -48,7 +49,7 @@ describe Capistrano::Notifier::Mail do
|
|
48
49
|
|
49
50
|
ActionMailer::Base.deliveries.clear
|
50
51
|
end
|
51
|
-
|
52
|
+
|
52
53
|
it { subject.send(:github).should == 'example/example' }
|
53
54
|
it { subject.send(:notify_method).should == :sendmail }
|
54
55
|
it { subject.send(:from).should == 'sender@example.com' }
|
@@ -58,18 +59,18 @@ describe Capistrano::Notifier::Mail do
|
|
58
59
|
it 'delivers smtp mail' do
|
59
60
|
configuration.load do |configuration|
|
60
61
|
set :notifier_mail_options, {
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
62
|
+
github: 'example/example',
|
63
|
+
method: :test,
|
64
|
+
from: 'sender@example.com',
|
65
|
+
to: 'example@example.com',
|
66
|
+
smtp_settings: {
|
67
|
+
address: "smtp.gmail.com",
|
68
|
+
port: 587,
|
69
|
+
domain: "gmail.com",
|
70
|
+
authentication: "plain",
|
71
|
+
enable_starttls_auto: true,
|
72
|
+
user_name: "USERNAME",
|
73
|
+
password: "PASSWORD"
|
73
74
|
}
|
74
75
|
}
|
75
76
|
end
|
@@ -77,13 +78,13 @@ describe Capistrano::Notifier::Mail do
|
|
77
78
|
subject.perform
|
78
79
|
|
79
80
|
subject.send(:smtp_settings).should == {
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
81
|
+
address: "smtp.gmail.com",
|
82
|
+
port: 587,
|
83
|
+
domain: "gmail.com",
|
84
|
+
authentication: "plain",
|
85
|
+
enable_starttls_auto: true,
|
86
|
+
user_name: "USERNAME",
|
87
|
+
password: "PASSWORD"
|
87
88
|
}
|
88
89
|
|
89
90
|
last_delivery = ActionMailer::Base.deliveries.last
|
@@ -94,23 +95,98 @@ describe Capistrano::Notifier::Mail do
|
|
94
95
|
ActionMailer::Base.deliveries.clear
|
95
96
|
end
|
96
97
|
|
97
|
-
it
|
98
|
+
it 'creates a subject' do
|
98
99
|
subject.send(:subject).should == "Example branch master deployed to test"
|
99
100
|
end
|
100
101
|
|
101
|
-
it
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
01/01/2012 at
|
108
|
-
12:00 AM #{Time.now.zone}
|
102
|
+
it 'should work with gitlab' do
|
103
|
+
configuration.load do |configuration|
|
104
|
+
set :notifier_mail_options, {
|
105
|
+
giturl: 'https://my.gitlab.url/',
|
106
|
+
}
|
107
|
+
end
|
109
108
|
|
110
|
-
|
109
|
+
subject.send(:git_prefix).should == 'https://my.gitlab.url/'
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should default to whatever was specified in giturl' do
|
113
|
+
configuration.load do |configuration|
|
114
|
+
set :notifier_mail_options, {
|
115
|
+
giturl: 'https://my.gitlab.url/',
|
116
|
+
github: 'example/example'
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
subject.send(:git_prefix).should == 'https://my.gitlab.url/'
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'renders a plaintext email' do
|
124
|
+
subject.send(:text).should == <<-BODY.gsub(/^ {6}/, '')
|
125
|
+
Deployer: John Doe
|
126
|
+
Application: Example
|
127
|
+
Branch: master
|
128
|
+
Environment: test
|
129
|
+
Time: 01/01/2012 at 12:00 AM #{Time.now.zone}
|
130
|
+
|
131
|
+
Compare:
|
132
|
+
https://github.com/example/example/compare/890abcd...1234567
|
133
|
+
|
134
|
+
Commits:
|
111
135
|
1234567 This is the current commit (John Doe)
|
112
136
|
890abcd This is the previous commit (John Doe)
|
113
137
|
|
114
138
|
BODY
|
115
139
|
end
|
140
|
+
|
141
|
+
context 'given the format is set to :html' do
|
142
|
+
before do
|
143
|
+
subject.stub(:format).and_return(:html)
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'renders an html email' do
|
147
|
+
subject.send(:text).should == <<-BODY.gsub(/^ {8}/, '')
|
148
|
+
<!DOCTYPE html>
|
149
|
+
<html>
|
150
|
+
<head>
|
151
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
152
|
+
</head>
|
153
|
+
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
|
154
|
+
<h3>Details:</h3>
|
155
|
+
<table>
|
156
|
+
<tbody>
|
157
|
+
<tr>
|
158
|
+
<td><strong>Deployer:</strong></td>
|
159
|
+
<td>John Doe</td>
|
160
|
+
</tr>
|
161
|
+
<tr>
|
162
|
+
<td><strong>Application:</strong></td>
|
163
|
+
<td>Example</td>
|
164
|
+
</tr>
|
165
|
+
<tr>
|
166
|
+
<td><strong>Branch:</strong></td>
|
167
|
+
<td>master</td>
|
168
|
+
</tr>
|
169
|
+
<tr>
|
170
|
+
<td><strong>Environment:</strong></td>
|
171
|
+
<td>test</td>
|
172
|
+
</tr>
|
173
|
+
<tr>
|
174
|
+
<td><strong>Time:</strong></td>
|
175
|
+
<td>01/01/2012 at 12:00 AM #{Time.now.zone}</td>
|
176
|
+
</tr>
|
177
|
+
</tbody>
|
178
|
+
</table>
|
179
|
+
|
180
|
+
<h3>Compare:</h3>
|
181
|
+
<p>https://github.com/example/example/compare/890abcd...1234567</p>
|
182
|
+
|
183
|
+
<h3>Commits:</h3>
|
184
|
+
<p>1234567 This is the current commit (John Doe)</p>
|
185
|
+
<p>890abcd This is the previous commit (John Doe)</p>
|
186
|
+
|
187
|
+
</body>
|
188
|
+
</html>
|
189
|
+
BODY
|
190
|
+
end
|
191
|
+
end
|
116
192
|
end
|
@@ -41,8 +41,8 @@ describe Capistrano::Notifier::StatsD do
|
|
41
41
|
before :each do
|
42
42
|
configuration.load do
|
43
43
|
set :notifier_statsd_options, {
|
44
|
-
:
|
45
|
-
:
|
44
|
+
host: '10.0.0.1',
|
45
|
+
port: '1234'
|
46
46
|
}
|
47
47
|
|
48
48
|
set :application, 'example'
|
@@ -59,7 +59,7 @@ describe Capistrano::Notifier::StatsD do
|
|
59
59
|
before :each do
|
60
60
|
configuration.load do
|
61
61
|
set :notifier_statsd_options, {
|
62
|
-
:
|
62
|
+
with: :gauge
|
63
63
|
}
|
64
64
|
|
65
65
|
set :application, 'example'
|
@@ -78,4 +78,21 @@ describe Capistrano::Notifier::StatsD do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
context "with a pattern" do
|
83
|
+
before :each do
|
84
|
+
configuration.load do
|
85
|
+
set :application, 'example'
|
86
|
+
set :stage, 'test'
|
87
|
+
set :notifier_statsd_options, {
|
88
|
+
:pattern => "#{stage}.deployment.#{application}"
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "creates a packet" do
|
94
|
+
subject.send(:packet).should == "test.deployment.example:1|c"
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
81
98
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Justin Campbell
|
@@ -10,102 +9,96 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: actionmailer
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: activesupport
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: capistrano
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - '>='
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '2'
|
49
|
+
- - <
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '3'
|
55
52
|
type: :runtime
|
56
53
|
prerelease: false
|
57
54
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
55
|
requirements:
|
60
|
-
- -
|
56
|
+
- - '>='
|
61
57
|
- !ruby/object:Gem::Version
|
62
58
|
version: '2'
|
59
|
+
- - <
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
63
62
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
63
|
+
name: rake
|
65
64
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
65
|
requirements:
|
68
|
-
- -
|
66
|
+
- - '>='
|
69
67
|
- !ruby/object:Gem::Version
|
70
68
|
version: '0'
|
71
69
|
type: :development
|
72
70
|
prerelease: false
|
73
71
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
72
|
requirements:
|
76
|
-
- -
|
73
|
+
- - '>='
|
77
74
|
- !ruby/object:Gem::Version
|
78
75
|
version: '0'
|
79
76
|
- !ruby/object:Gem::Dependency
|
80
77
|
name: rspec
|
81
78
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
79
|
requirements:
|
84
|
-
- -
|
80
|
+
- - '>='
|
85
81
|
- !ruby/object:Gem::Version
|
86
82
|
version: '0'
|
87
83
|
type: :development
|
88
84
|
prerelease: false
|
89
85
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
86
|
requirements:
|
92
|
-
- -
|
87
|
+
- - '>='
|
93
88
|
- !ruby/object:Gem::Version
|
94
89
|
version: '0'
|
95
90
|
- !ruby/object:Gem::Dependency
|
96
91
|
name: timecop
|
97
92
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
93
|
requirements:
|
100
|
-
- -
|
94
|
+
- - '>='
|
101
95
|
- !ruby/object:Gem::Version
|
102
96
|
version: '0'
|
103
97
|
type: :development
|
104
98
|
prerelease: false
|
105
99
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
100
|
requirements:
|
108
|
-
- -
|
101
|
+
- - '>='
|
109
102
|
- !ruby/object:Gem::Version
|
110
103
|
version: '0'
|
111
104
|
description: Simple notification hooks for Capistrano
|
@@ -129,10 +122,8 @@ files:
|
|
129
122
|
- lib/capistrano/notifier/base.rb
|
130
123
|
- lib/capistrano/notifier/mail.rb
|
131
124
|
- lib/capistrano/notifier/statsd.rb
|
132
|
-
- lib/capistrano/notifier/templates/mail.erb
|
133
125
|
- lib/capistrano/notifier/templates/mail.html.erb
|
134
126
|
- lib/capistrano/notifier/templates/mail.text.erb
|
135
|
-
- lib/capistrano/notifier/templates/mail.txt.erb
|
136
127
|
- lib/capistrano/notifier/version.rb
|
137
128
|
- spec/capistrano/notifier/base_spec.rb
|
138
129
|
- spec/capistrano/notifier/mail_spec.rb
|
@@ -141,27 +132,26 @@ files:
|
|
141
132
|
- spec/spec_helper.rb
|
142
133
|
homepage: http://github.com/cramerdev/capistrano-notifier
|
143
134
|
licenses: []
|
135
|
+
metadata: {}
|
144
136
|
post_install_message:
|
145
137
|
rdoc_options: []
|
146
138
|
require_paths:
|
147
139
|
- lib
|
148
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
-
none: false
|
150
141
|
requirements:
|
151
|
-
- -
|
142
|
+
- - '>='
|
152
143
|
- !ruby/object:Gem::Version
|
153
144
|
version: '0'
|
154
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
146
|
requirements:
|
157
|
-
- -
|
147
|
+
- - '>='
|
158
148
|
- !ruby/object:Gem::Version
|
159
149
|
version: '0'
|
160
150
|
requirements: []
|
161
151
|
rubyforge_project:
|
162
|
-
rubygems_version:
|
152
|
+
rubygems_version: 2.0.14
|
163
153
|
signing_key:
|
164
|
-
specification_version:
|
154
|
+
specification_version: 4
|
165
155
|
summary: Capistrano Notifier
|
166
156
|
test_files:
|
167
157
|
- spec/capistrano/notifier/base_spec.rb
|
File without changes
|
File without changes
|