capistrano_mailer 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +187 -206
- data/Rakefile +52 -52
- data/VERSION.yml +1 -1
- data/capistrano_mailer.gemspec +1 -1
- data/lib/cap_mailer.rb +184 -184
- data/lib/capistrano/mailer.rb +25 -25
- data/views/cap_mailer/_section.html.erb +31 -31
- data/views/cap_mailer/_section.text.erb +23 -23
- data/views/cap_mailer/notification_email.html.erb +39 -39
- data/views/cap_mailer/notification_email.text.erb +22 -22
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,206 +1,187 @@
|
|
1
|
-
= Capistrano Mailer
|
2
|
-
|
3
|
-
* For Capistrano Deployment Email Notification
|
4
|
-
* It is a Capistrano Plugin / Ruby Gem that requires ActionMailer
|
5
|
-
* It is MIT-LICENSE
|
6
|
-
|
7
|
-
Ever wanted to be emailed whenever someone on the team does a cap deploy of trunk or some tag to some server.
|
8
|
-
Wouldn't it be nice to know about it every time a release was deployed? For large rails projects this type of coordination is essential,
|
9
|
-
and this plugin makes sure everyone on the need to know list is notified when something new is deployed.
|
10
|
-
|
11
|
-
This plugin/gem is an extension to Capistrano.
|
12
|
-
|
13
|
-
That means it registers itself with Capistrano as a plugin and is therefore available to call in your recipes.
|
14
|
-
|
15
|
-
If you are looking to roll your own email integration into capistrano then try this pastie:
|
16
|
-
http://pastie.org/146264 (thanks to Mislav Marohnić).
|
17
|
-
But if you want to take the easy road to riches then keep reading ;)
|
18
|
-
-- figurative "riches" of course, I promise nothing in return for your using this plugin
|
19
|
-
|
20
|
-
Important Note:
|
21
|
-
The first time you deploy to a server (a 'cold' deploy) capistrano mailer will cause an error because it uses capistrano's previous release variables, and when there are no previous releases capistrano throws an error. In the next version this will be fixed, just don't have time at the moment. If you would like to work on this 'first deploy' problem please fork my repo and work on it!
|
22
|
-
|
23
|
-
== Home Page
|
24
|
-
|
25
|
-
http://github.com/pboling/capistrano_mailer
|
26
|
-
|
27
|
-
|
28
|
-
== Credit where Credit is Due
|
29
|
-
|
30
|
-
* Thanks to Dustin Deyoung of Sagebit, LLC (http://www.sagebit.com) for the beautiful HTML email templates.
|
31
|
-
|
32
|
-
|
33
|
-
== Requirements
|
34
|
-
|
35
|
-
* at least Rails
|
36
|
-
|
37
|
-
* at least Capistrano 2.4.3 (might work with capistrano as old as 2.1.0, but has not been tested)
|
38
|
-
|
39
|
-
* Known to be compatible with SCMs as of version 3.1.2: Perforce, SVN, and Git
|
40
|
-
|
41
|
-
* Known to be compatible with, but does not require, the deprec gem.
|
42
|
-
|
43
|
-
|
44
|
-
== Usage with Rails >= 3.x.x
|
45
|
-
|
46
|
-
The > 4.x versions of this gem require at least Rails 3
|
47
|
-
|
48
|
-
=== Installation
|
49
|
-
|
50
|
-
Install as a gem:
|
51
|
-
|
52
|
-
[sudo] gem install capistrano_mailer
|
53
|
-
|
54
|
-
== Usage with Rails <= 2.3.x
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
#
|
86
|
-
|
87
|
-
|
88
|
-
#
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
Peter Boling (pboling) - Wrote original & maintainer
|
190
|
-
Dave Nolan (textgoeshere) - lots of refactoring merged into 3.2 release
|
191
|
-
Jason Rust (jrust) - Updated for Rails 3 compatibility
|
192
|
-
|
193
|
-
== Contributors
|
194
|
-
|
195
|
-
Dustin Deyoung - HTML Email Templates
|
196
|
-
mixonix - SCMs compatibility
|
197
|
-
greut - SCMs compatibility
|
198
|
-
|
199
|
-
----------------------------------------------------------------------------------
|
200
|
-
This plugin started out as a collaboration between Sagebit, LLC (http://www.sagebit.com) and Peter Boling (http://www.peterboling.com).
|
201
|
-
Written initially while Peter Boling was working at Sagebit for use in various projects.
|
202
|
-
|
203
|
-
Author: Peter Boling, peter.boling at gmail dot com
|
204
|
-
|
205
|
-
Copyright (c) 2009-2011 Peter Boling of 9thBit LLC, released under the MIT license
|
206
|
-
Copyright (c) 2007-2008 Sagebit LLC, released under the MIT license
|
1
|
+
= Capistrano Mailer
|
2
|
+
|
3
|
+
* For Capistrano Deployment Email Notification
|
4
|
+
* It is a Capistrano Plugin / Ruby Gem that requires ActionMailer
|
5
|
+
* It is MIT-LICENSE
|
6
|
+
|
7
|
+
Ever wanted to be emailed whenever someone on the team does a cap deploy of trunk or some tag to some server.
|
8
|
+
Wouldn't it be nice to know about it every time a release was deployed? For large rails projects this type of coordination is essential,
|
9
|
+
and this plugin makes sure everyone on the need to know list is notified when something new is deployed.
|
10
|
+
|
11
|
+
This plugin/gem is an extension to Capistrano.
|
12
|
+
|
13
|
+
That means it registers itself with Capistrano as a plugin and is therefore available to call in your recipes.
|
14
|
+
|
15
|
+
If you are looking to roll your own email integration into capistrano then try this pastie:
|
16
|
+
http://pastie.org/146264 (thanks to Mislav Marohnić).
|
17
|
+
But if you want to take the easy road to riches then keep reading ;)
|
18
|
+
-- figurative "riches" of course, I promise nothing in return for your using this plugin
|
19
|
+
|
20
|
+
Important Note:
|
21
|
+
The first time you deploy to a server (a 'cold' deploy) capistrano mailer will cause an error because it uses capistrano's previous release variables, and when there are no previous releases capistrano throws an error. In the next version this will be fixed, just don't have time at the moment. If you would like to work on this 'first deploy' problem please fork my repo and work on it!
|
22
|
+
|
23
|
+
== Home Page
|
24
|
+
|
25
|
+
http://github.com/pboling/capistrano_mailer
|
26
|
+
|
27
|
+
|
28
|
+
== Credit where Credit is Due
|
29
|
+
|
30
|
+
* Thanks to Dustin Deyoung of Sagebit, LLC (http://www.sagebit.com) for the beautiful HTML email templates.
|
31
|
+
|
32
|
+
|
33
|
+
== Requirements
|
34
|
+
|
35
|
+
* at least Rails 3.0 (might work with older versions, but has not been tested)
|
36
|
+
|
37
|
+
* at least Capistrano 2.4.3 (might work with capistrano as old as 2.1.0, but has not been tested)
|
38
|
+
|
39
|
+
* Known to be compatible with SCMs as of version 3.1.2: Perforce, SVN, and Git
|
40
|
+
|
41
|
+
* Known to be compatible with, but does not require, the deprec gem.
|
42
|
+
|
43
|
+
|
44
|
+
== Usage with Rails >= 3.x.x
|
45
|
+
|
46
|
+
The > 4.x versions of this gem require at least Rails 3
|
47
|
+
|
48
|
+
=== Installation
|
49
|
+
|
50
|
+
Install as a gem:
|
51
|
+
|
52
|
+
[sudo] gem install capistrano_mailer
|
53
|
+
|
54
|
+
== Usage with Rails <= 2.3.x
|
55
|
+
|
56
|
+
Switch to the rails2 branch (releases will be in 3.x range)
|
57
|
+
|
58
|
+
== Setup
|
59
|
+
|
60
|
+
1. You need to have already setup capistrano in the project, including the 'capify .' command.
|
61
|
+
|
62
|
+
2. Add this line to the top of your config/deploy.rb:
|
63
|
+
|
64
|
+
# For plugin:
|
65
|
+
# You must make capistrano_mailer's libraries available in Ruby's load path. This is one way to do that:
|
66
|
+
# Add to the top of your config/deploy.rb file:
|
67
|
+
$:.unshift 'vendor/plugins/capistrano_mailer/lib'
|
68
|
+
|
69
|
+
# For frozen gem:
|
70
|
+
# You must make capistrano_mailer's libraries available in Ruby's load path. This is one way to do that:
|
71
|
+
# Add to the top of your config/deploy.rb file:
|
72
|
+
$:.unshift 'vendor/gems/capistrano_mailer-x.x.x/lib'
|
73
|
+
|
74
|
+
# then for gem or plugin:
|
75
|
+
####################################
|
76
|
+
# Capistrano Plugins go here
|
77
|
+
require 'capistrano/mailer'
|
78
|
+
#configure capistrano_mailer:
|
79
|
+
# The configuration file can go anywhere, but in past versions of the gem it was required to be in the config/ dir.
|
80
|
+
require 'config/cap_mailer_settings'
|
81
|
+
####################################
|
82
|
+
|
83
|
+
3. Configure Caistrano Mailer in the settings file required in step 2:
|
84
|
+
|
85
|
+
# If installed as a plugin might need the require here as well
|
86
|
+
|
87
|
+
ActionMailer::Base.delivery_method = :smtp # or :sendmail, or whatever
|
88
|
+
ActionMailer::Base.smtp_settings = { # if using :smtp
|
89
|
+
:address => "mail.example.com",
|
90
|
+
:port => 25,
|
91
|
+
:domain => 'default.com',
|
92
|
+
:perform_deliveries => true,
|
93
|
+
:user_name => "releases@example.com",
|
94
|
+
:password => "mypassword",
|
95
|
+
:authentication => :login }
|
96
|
+
ActionMailer::Base.default_charset = "utf-8"# or "latin1" or whatever you are using
|
97
|
+
|
98
|
+
CapMailer.configure do |config|
|
99
|
+
config[:recipient_addresses] = ["dev1@example.com"]
|
100
|
+
# NOTE: THERE IS A BUG IN RAILS 2.3.3 which forces us to NOT use anything but a simple email address string for the sender address.
|
101
|
+
# https://rails.lighthouseapp.com/projects/8994/tickets/2340
|
102
|
+
# Therefore %("Capistrano Deployment" <releases@example.com>) style addresses may not work in Rails 2.3.3
|
103
|
+
config[:sender_address] = "deployment@example.com"
|
104
|
+
config[:subject_prepend] = "[EMPTY-CAP-DEPLOY]"
|
105
|
+
config[:site_name] = "Empty Example.com App"
|
106
|
+
end
|
107
|
+
|
108
|
+
4. Add these two tasks to your deploy.rb:
|
109
|
+
|
110
|
+
namespace :show do
|
111
|
+
desc "Show some internal Cap-Fu: What's mah NAYM?!?"
|
112
|
+
task :me do
|
113
|
+
set :task_name, task_call_frames.first.task.fully_qualified_name
|
114
|
+
#puts "Running #{task_name} task"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
namespace :deploy do
|
119
|
+
...
|
120
|
+
|
121
|
+
desc "Send email notification of deployment (only send variables you want to be in the email)"
|
122
|
+
task :notify, :roles => :app do
|
123
|
+
show.me # this sets the task_name variable
|
124
|
+
mailer.send_notification_email(self)
|
125
|
+
end
|
126
|
+
|
127
|
+
...
|
128
|
+
end
|
129
|
+
|
130
|
+
5. Make _sure_ you've defined `rails_env`, `repository`, `deploy_to`, `host`, and `application`. `task_name` is defined by the show:me task above, and the others are defined behind the scenes by Capistrano!
|
131
|
+
|
132
|
+
6. The only parameter to mailer.send_notification_email that is *required* is the first. _Minimally_ you need to define the capistrano variables:
|
133
|
+
|
134
|
+
:rails_env
|
135
|
+
:repository
|
136
|
+
:task_name (provided by the show:me task included in this readme)
|
137
|
+
:deploy_to
|
138
|
+
:host
|
139
|
+
:application
|
140
|
+
|
141
|
+
But there are tons of others - just take a look at lib/mailer/cap_mailer.rb.
|
142
|
+
|
143
|
+
If anyone has a cool way of recording the *output* into a capistrano accessible variable,
|
144
|
+
so that it can be shoved into the release email that would be an excellent contribution!
|
145
|
+
|
146
|
+
7. Then add the hook somewhere in your deploy.rb:
|
147
|
+
|
148
|
+
after "deploy", "deploy:notify"
|
149
|
+
|
150
|
+
8. Enjoy and Happy Capping!
|
151
|
+
|
152
|
+
9. Customization
|
153
|
+
|
154
|
+
If you want to use your own views you'll need to recreate the notification_email view:
|
155
|
+
First you need to define where your templates are:
|
156
|
+
|
157
|
+
CapMailer.configure_capistrano_mailer do |config|
|
158
|
+
config[:template_root] = "app/views/capistrano_mailer/"
|
159
|
+
end
|
160
|
+
|
161
|
+
Then you'll need to create templates there called:
|
162
|
+
`notification_email.text.html.erb`
|
163
|
+
and / or
|
164
|
+
`notification_email.text.plain.erb`
|
165
|
+
|
166
|
+
Take a look at the templates that comes with the plugin to see how it is done (views/cap_mailer/...)
|
167
|
+
|
168
|
+
== Authors
|
169
|
+
|
170
|
+
Peter Boling (pboling) - Wrote original & maintainer
|
171
|
+
Dave Nolan (textgoeshere) - lots of refactoring merged into 3.2 release
|
172
|
+
Jason Rust (jrust) - Updated for Rails 3 compatibility
|
173
|
+
|
174
|
+
== Contributors
|
175
|
+
|
176
|
+
Dustin Deyoung - HTML Email Templates
|
177
|
+
mixonix - SCMs compatibility
|
178
|
+
greut - SCMs compatibility
|
179
|
+
|
180
|
+
----------------------------------------------------------------------------------
|
181
|
+
This plugin started out as a collaboration between Sagebit, LLC (http://www.sagebit.com) and Peter Boling (http://www.peterboling.com).
|
182
|
+
Written initially while Peter Boling was working at Sagebit for use in various projects.
|
183
|
+
|
184
|
+
Author: Peter Boling, peter.boling at gmail dot com
|
185
|
+
|
186
|
+
Copyright (c) 2009-2011 Peter Boling of 9thBit LLC, released under the MIT license
|
187
|
+
Copyright (c) 2007-2008 Sagebit LLC, released under the MIT license
|
data/Rakefile
CHANGED
@@ -1,52 +1,52 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rdoc/task'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'jeweler'
|
7
|
-
Jeweler::Tasks.new do |gemspec|
|
8
|
-
gemspec.name = "capistrano_mailer"
|
9
|
-
gemspec.summary = "Capistrano Deployment Email Notification"
|
10
|
-
gemspec.description = %q{Capistrano Deployment Email Notification. Keep the whole team informed of each release!}
|
11
|
-
gemspec.email = ["peter.boling@gmail.com", "dave@textgoeshere.org.uk", "jason@rustedcode.com"]
|
12
|
-
gemspec.homepage = "http://github.com/pboling/capistrano_mailer"
|
13
|
-
gemspec.authors = ["Peter Boling", "Dave Nolan", "Jason Rust"]
|
14
|
-
gemspec.add_dependency 'actionmailer'
|
15
|
-
gemspec.files = ["README.rdoc",
|
16
|
-
"capistrano_mailer.gemspec",
|
17
|
-
"lib/cap_mailer.rb",
|
18
|
-
"lib/capistrano/mailer.rb",
|
19
|
-
"Rakefile",
|
20
|
-
"MIT-LICENSE",
|
21
|
-
"views/cap_mailer/_section.html.erb",
|
22
|
-
"views/cap_mailer/_section.text.erb",
|
23
|
-
"views/cap_mailer/_section_custom.html.erb",
|
24
|
-
"views/cap_mailer/_section_custom.text.erb",
|
25
|
-
"views/cap_mailer/notification_email.html.erb",
|
26
|
-
"views/cap_mailer/notification_email.text.erb",
|
27
|
-
"VERSION.yml"]
|
28
|
-
end
|
29
|
-
Jeweler::GemcutterTasks.new
|
30
|
-
rescue LoadError
|
31
|
-
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
32
|
-
end
|
33
|
-
|
34
|
-
desc 'Default: run unit tests.'
|
35
|
-
task :default => :test
|
36
|
-
|
37
|
-
desc 'Test the capistrano_mailer gem.'
|
38
|
-
Rake::TestTask.new(:test) do |t|
|
39
|
-
t.libs << 'lib'
|
40
|
-
t.libs << 'test'
|
41
|
-
t.pattern = 'test/**/*_test.rb'
|
42
|
-
t.verbose = true
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'Generate documentation for the capistrano_mailer gem.'
|
46
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
47
|
-
rdoc.rdoc_dir = 'rdoc'
|
48
|
-
rdoc.title = 'capistrano_mailer'
|
49
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
50
|
-
rdoc.rdoc_files.include('README.markdown')
|
51
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
-
end
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rdoc/task'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gemspec|
|
8
|
+
gemspec.name = "capistrano_mailer"
|
9
|
+
gemspec.summary = "Capistrano Deployment Email Notification"
|
10
|
+
gemspec.description = %q{Capistrano Deployment Email Notification. Keep the whole team informed of each release!}
|
11
|
+
gemspec.email = ["peter.boling@gmail.com", "dave@textgoeshere.org.uk", "jason@rustedcode.com"]
|
12
|
+
gemspec.homepage = "http://github.com/pboling/capistrano_mailer"
|
13
|
+
gemspec.authors = ["Peter Boling", "Dave Nolan", "Jason Rust"]
|
14
|
+
gemspec.add_dependency 'actionmailer'
|
15
|
+
gemspec.files = ["README.rdoc",
|
16
|
+
"capistrano_mailer.gemspec",
|
17
|
+
"lib/cap_mailer.rb",
|
18
|
+
"lib/capistrano/mailer.rb",
|
19
|
+
"Rakefile",
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"views/cap_mailer/_section.html.erb",
|
22
|
+
"views/cap_mailer/_section.text.erb",
|
23
|
+
"views/cap_mailer/_section_custom.html.erb",
|
24
|
+
"views/cap_mailer/_section_custom.text.erb",
|
25
|
+
"views/cap_mailer/notification_email.html.erb",
|
26
|
+
"views/cap_mailer/notification_email.text.erb",
|
27
|
+
"VERSION.yml"]
|
28
|
+
end
|
29
|
+
Jeweler::GemcutterTasks.new
|
30
|
+
rescue LoadError
|
31
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Default: run unit tests.'
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
desc 'Test the capistrano_mailer gem.'
|
38
|
+
Rake::TestTask.new(:test) do |t|
|
39
|
+
t.libs << 'lib'
|
40
|
+
t.libs << 'test'
|
41
|
+
t.pattern = 'test/**/*_test.rb'
|
42
|
+
t.verbose = true
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Generate documentation for the capistrano_mailer gem.'
|
46
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = 'capistrano_mailer'
|
49
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
50
|
+
rdoc.rdoc_files.include('README.markdown')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION.yml
CHANGED
data/capistrano_mailer.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "capistrano_mailer"
|
8
|
-
s.version = "4.0.
|
8
|
+
s.version = "4.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peter Boling", "Dave Nolan", "Jason Rust"]
|
data/lib/cap_mailer.rb
CHANGED
@@ -1,184 +1,184 @@
|
|
1
|
-
class CapMailer < ActionMailer::Base
|
2
|
-
|
3
|
-
@@default_base_config ||= {
|
4
|
-
:sender_address => %("#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")} Capistrano Deployment" <capistrano.mailer@example.com>),
|
5
|
-
:recipient_addresses => [],
|
6
|
-
# Customize the subject line
|
7
|
-
:subject_prepend => "[DEPLOYMENT]-[#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")}] ",
|
8
|
-
:subject_append => nil,
|
9
|
-
# Include which sections of the deployment email?
|
10
|
-
:sections => %w(deployment release_data source_control latest_release previous_release other_deployment_info extra_information),
|
11
|
-
:site_name => "",
|
12
|
-
:email_content_type => "text/html",
|
13
|
-
:template_root => "#{File.dirname(__FILE__)}/../views"
|
14
|
-
}
|
15
|
-
|
16
|
-
cattr_accessor :default_base_config
|
17
|
-
attr_accessor :config, :options
|
18
|
-
attr_accessor :date, :time, :inferred_command, :task_name, :repo_end
|
19
|
-
|
20
|
-
def self.configure(&block)
|
21
|
-
yield @@default_base_config
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.configure_capistrano_mailer(&block)
|
25
|
-
puts "Deprecated 'configure_capistrano_mailer'. Please update your capistrano_mailer configuration to use 'configure' instead of 'configure_capistrano_mailer'"
|
26
|
-
end
|
27
|
-
|
28
|
-
self.prepend_view_path default_base_config[:template_root]
|
29
|
-
|
30
|
-
def self.reloadable?() false end
|
31
|
-
|
32
|
-
def notification_email(cap, config = {}, *args)
|
33
|
-
@options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
|
34
|
-
@config = default_base_config.merge(config.reverse_merge({
|
35
|
-
:rails_env => cap.rails_env,
|
36
|
-
:host => cap.host,
|
37
|
-
:task_name => cap.task_name,
|
38
|
-
:application => cap.application,
|
39
|
-
:repository => cap.repository,
|
40
|
-
:scm => cap.scm,
|
41
|
-
:deploy_via => cap.deploy_via,
|
42
|
-
:deploy_to => cap.deploy_to,
|
43
|
-
:revision => cap.revision,
|
44
|
-
:real_revision => cap.real_revision,
|
45
|
-
:release_name => cap.release_name,
|
46
|
-
#This does not appear to be a capistrano variable:
|
47
|
-
#:release_notes => cap.release_notes,
|
48
|
-
:version_dir => cap.version_dir,
|
49
|
-
:shared_dir => cap.shared_dir,
|
50
|
-
:current_dir => cap.current_dir,
|
51
|
-
:releases_path => cap.releases_path,
|
52
|
-
:shared_path => cap.shared_path,
|
53
|
-
:current_path => cap.current_path,
|
54
|
-
:release_path => cap.release_path,
|
55
|
-
:releases => cap.releases,
|
56
|
-
:current_release => cap.current_release,
|
57
|
-
:previous_release => cap.previous_release,
|
58
|
-
:current_revision => cap.current_revision,
|
59
|
-
:latest_revision => cap.latest_revision,
|
60
|
-
:previous_revision => cap.previous_revision,
|
61
|
-
:run_method => cap.run_method,
|
62
|
-
:latest_release => cap.latest_release
|
63
|
-
|
64
|
-
#This does not appear to be a capistrano variable:
|
65
|
-
#:site_url => cap.site_url
|
66
|
-
}))
|
67
|
-
|
68
|
-
@date = Date.today.to_s
|
69
|
-
@time = Time.now.strftime("%I:%M %p").to_s
|
70
|
-
@inferred_command = "cap #{@config[:rails_env]} #{@config[:task_name]}"
|
71
|
-
@task_name = @config[:task_name] || "unknown"
|
72
|
-
|
73
|
-
repo = @config[:repository]
|
74
|
-
x = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
|
75
|
-
front = repo.slice(0..x)
|
76
|
-
back = repo.sub(front, '')
|
77
|
-
unless back == 'trunk'
|
78
|
-
x = front.include?('/') ? front.rindex('/') - 1 : front.length
|
79
|
-
front = front.slice(0..x)
|
80
|
-
end
|
81
|
-
@repo_end = repo.sub(front, '')
|
82
|
-
|
83
|
-
body_data_hash.each_pair do |k, v|
|
84
|
-
self.instance_variable_set("@#{k}", v)
|
85
|
-
end
|
86
|
-
|
87
|
-
mail :subject => subject_line,
|
88
|
-
:to => @config[:recipient_addresses],
|
89
|
-
:from => @config[:sender_address]
|
90
|
-
end
|
91
|
-
|
92
|
-
private
|
93
|
-
|
94
|
-
def subject_line
|
95
|
-
#The subject prepend and append are useful for people to setup filters in mail clients.
|
96
|
-
user = config[:user] ? " by #{config[:user]}" : ""
|
97
|
-
middle = config[:subject] ? config[:subject] : "[#{config[:rails_env].upcase}][#{repo_end}] #{inferred_command}#{user}"
|
98
|
-
"#{config[:subject_prepend]}#{middle}#{config[:subject_append]}"
|
99
|
-
end
|
100
|
-
|
101
|
-
def body_data_hash
|
102
|
-
options[:data].merge({
|
103
|
-
:section_data => section_data_hash,
|
104
|
-
:date => date,
|
105
|
-
:time => time,
|
106
|
-
:task_name => task_name,
|
107
|
-
:inferred_command => inferred_command,
|
108
|
-
:repo_end => repo_end,
|
109
|
-
:site_name => config[:site_name],
|
110
|
-
:site_url => config[:site_url],
|
111
|
-
:application => config[:application],
|
112
|
-
:sections => config[:sections]
|
113
|
-
})
|
114
|
-
end
|
115
|
-
|
116
|
-
def section_data_hash
|
117
|
-
{
|
118
|
-
:deployment => section_hash_deployment,
|
119
|
-
:source_control => section_hash_source_control,
|
120
|
-
:latest_release => section_hash_latest_release,
|
121
|
-
:previous_release => section_hash_previous_release,
|
122
|
-
:other_deployment_info => section_hash_other_deployment_info,
|
123
|
-
:release_data => options[:release_data],
|
124
|
-
:extra_information => options[:extra_information]
|
125
|
-
}
|
126
|
-
end
|
127
|
-
|
128
|
-
def section_hash_deployment
|
129
|
-
{
|
130
|
-
:date => date,
|
131
|
-
:time => time,
|
132
|
-
:rails_env => config[:rails_env],
|
133
|
-
:task_name => task_name,
|
134
|
-
:inferred_command => inferred_command,
|
135
|
-
:host => config[:host],
|
136
|
-
:release_name => config[:release_name],
|
137
|
-
:release_notes => config[:release_notes]
|
138
|
-
}
|
139
|
-
end
|
140
|
-
|
141
|
-
def section_hash_source_control
|
142
|
-
{
|
143
|
-
:revision => config[:revision],
|
144
|
-
:released => repo_end,
|
145
|
-
:repository => config[:repository],
|
146
|
-
:branch => config[:branch],
|
147
|
-
:scm => config[:scm],
|
148
|
-
:deploy_via => config[:deploy_via],
|
149
|
-
:deploy_to => config[:deploy_to]
|
150
|
-
}
|
151
|
-
end
|
152
|
-
|
153
|
-
def section_hash_latest_release
|
154
|
-
{
|
155
|
-
:latest_release => config[:latest_release],
|
156
|
-
:latest_revision => config[:latest_revision],
|
157
|
-
:release_path => config[:release_path],
|
158
|
-
:real_revision => config[:real_revision],
|
159
|
-
:current_path => config[:current_path]
|
160
|
-
}
|
161
|
-
end
|
162
|
-
|
163
|
-
def section_hash_previous_release
|
164
|
-
{
|
165
|
-
:current_release => config[:current_release],
|
166
|
-
:current_revision => config[:current_revision],
|
167
|
-
:previous_release => config[:previous_release],
|
168
|
-
:previous_revision => config[:previous_revision],
|
169
|
-
:releases => config[:releases]
|
170
|
-
}
|
171
|
-
end
|
172
|
-
|
173
|
-
def section_hash_other_deployment_info
|
174
|
-
{
|
175
|
-
:version_dir => config[:version_dir],
|
176
|
-
:shared_dir => config[:shared_dir],
|
177
|
-
:current_dir => config[:current_dir],
|
178
|
-
:releases_path => config[:releases_path],
|
179
|
-
:shared_path => config[:shared_path],
|
180
|
-
:run_method => config[:run_method],
|
181
|
-
:ip_address => config[:ip_address]
|
182
|
-
}
|
183
|
-
end
|
184
|
-
end
|
1
|
+
class CapMailer < ActionMailer::Base
|
2
|
+
|
3
|
+
@@default_base_config ||= {
|
4
|
+
:sender_address => %("#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")} Capistrano Deployment" <capistrano.mailer@example.com>),
|
5
|
+
:recipient_addresses => [],
|
6
|
+
# Customize the subject line
|
7
|
+
:subject_prepend => "[DEPLOYMENT]-[#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")}] ",
|
8
|
+
:subject_append => nil,
|
9
|
+
# Include which sections of the deployment email?
|
10
|
+
:sections => %w(deployment release_data source_control latest_release previous_release other_deployment_info extra_information),
|
11
|
+
:site_name => "",
|
12
|
+
:email_content_type => "text/html",
|
13
|
+
:template_root => "#{File.dirname(__FILE__)}/../views"
|
14
|
+
}
|
15
|
+
|
16
|
+
cattr_accessor :default_base_config
|
17
|
+
attr_accessor :config, :options
|
18
|
+
attr_accessor :date, :time, :inferred_command, :task_name, :repo_end
|
19
|
+
|
20
|
+
def self.configure(&block)
|
21
|
+
yield @@default_base_config
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.configure_capistrano_mailer(&block)
|
25
|
+
puts "Deprecated 'configure_capistrano_mailer'. Please update your capistrano_mailer configuration to use 'configure' instead of 'configure_capistrano_mailer'"
|
26
|
+
end
|
27
|
+
|
28
|
+
self.prepend_view_path default_base_config[:template_root]
|
29
|
+
|
30
|
+
def self.reloadable?() false end
|
31
|
+
|
32
|
+
def notification_email(cap, config = {}, *args)
|
33
|
+
@options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
|
34
|
+
@config = default_base_config.merge(config.reverse_merge({
|
35
|
+
:rails_env => cap.rails_env,
|
36
|
+
:host => cap.host,
|
37
|
+
:task_name => cap.task_name,
|
38
|
+
:application => cap.application,
|
39
|
+
:repository => cap.repository,
|
40
|
+
:scm => cap.scm,
|
41
|
+
:deploy_via => cap.deploy_via,
|
42
|
+
:deploy_to => cap.deploy_to,
|
43
|
+
:revision => cap.revision,
|
44
|
+
:real_revision => cap.real_revision,
|
45
|
+
:release_name => cap.release_name,
|
46
|
+
#This does not appear to be a capistrano variable:
|
47
|
+
#:release_notes => cap.release_notes,
|
48
|
+
:version_dir => cap.version_dir,
|
49
|
+
:shared_dir => cap.shared_dir,
|
50
|
+
:current_dir => cap.current_dir,
|
51
|
+
:releases_path => cap.releases_path,
|
52
|
+
:shared_path => cap.shared_path,
|
53
|
+
:current_path => cap.current_path,
|
54
|
+
:release_path => cap.release_path,
|
55
|
+
:releases => cap.releases,
|
56
|
+
:current_release => cap.current_release,
|
57
|
+
:previous_release => cap.previous_release,
|
58
|
+
:current_revision => cap.current_revision,
|
59
|
+
:latest_revision => cap.latest_revision,
|
60
|
+
:previous_revision => cap.previous_revision,
|
61
|
+
:run_method => cap.run_method,
|
62
|
+
:latest_release => cap.latest_release
|
63
|
+
|
64
|
+
#This does not appear to be a capistrano variable:
|
65
|
+
#:site_url => cap.site_url
|
66
|
+
}))
|
67
|
+
|
68
|
+
@date = Date.today.to_s
|
69
|
+
@time = Time.now.strftime("%I:%M %p").to_s
|
70
|
+
@inferred_command = "cap #{@config[:rails_env]} #{@config[:task_name]}"
|
71
|
+
@task_name = @config[:task_name] || "unknown"
|
72
|
+
|
73
|
+
repo = @config[:repository]
|
74
|
+
x = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
|
75
|
+
front = repo.slice(0..x)
|
76
|
+
back = repo.sub(front, '')
|
77
|
+
unless back == 'trunk'
|
78
|
+
x = front.include?('/') ? front.rindex('/') - 1 : front.length
|
79
|
+
front = front.slice(0..x)
|
80
|
+
end
|
81
|
+
@repo_end = repo.sub(front, '')
|
82
|
+
|
83
|
+
body_data_hash.each_pair do |k, v|
|
84
|
+
self.instance_variable_set("@#{k}", v)
|
85
|
+
end
|
86
|
+
|
87
|
+
mail :subject => subject_line,
|
88
|
+
:to => @config[:recipient_addresses],
|
89
|
+
:from => @config[:sender_address]
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def subject_line
|
95
|
+
#The subject prepend and append are useful for people to setup filters in mail clients.
|
96
|
+
user = config[:user] ? " by #{config[:user]}" : ""
|
97
|
+
middle = config[:subject] ? config[:subject] : "[#{config[:rails_env].upcase}][#{repo_end}] #{inferred_command}#{user}"
|
98
|
+
"#{config[:subject_prepend]}#{middle}#{config[:subject_append]}"
|
99
|
+
end
|
100
|
+
|
101
|
+
def body_data_hash
|
102
|
+
options[:data].merge({
|
103
|
+
:section_data => section_data_hash,
|
104
|
+
:date => date,
|
105
|
+
:time => time,
|
106
|
+
:task_name => task_name,
|
107
|
+
:inferred_command => inferred_command,
|
108
|
+
:repo_end => repo_end,
|
109
|
+
:site_name => config[:site_name],
|
110
|
+
:site_url => config[:site_url],
|
111
|
+
:application => config[:application],
|
112
|
+
:sections => config[:sections]
|
113
|
+
})
|
114
|
+
end
|
115
|
+
|
116
|
+
def section_data_hash
|
117
|
+
{
|
118
|
+
:deployment => section_hash_deployment,
|
119
|
+
:source_control => section_hash_source_control,
|
120
|
+
:latest_release => section_hash_latest_release,
|
121
|
+
:previous_release => section_hash_previous_release,
|
122
|
+
:other_deployment_info => section_hash_other_deployment_info,
|
123
|
+
:release_data => options[:release_data],
|
124
|
+
:extra_information => options[:extra_information]
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
def section_hash_deployment
|
129
|
+
{
|
130
|
+
:date => date,
|
131
|
+
:time => time,
|
132
|
+
:rails_env => config[:rails_env],
|
133
|
+
:task_name => task_name,
|
134
|
+
:inferred_command => inferred_command,
|
135
|
+
:host => config[:host],
|
136
|
+
:release_name => config[:release_name],
|
137
|
+
:release_notes => config[:release_notes]
|
138
|
+
}
|
139
|
+
end
|
140
|
+
|
141
|
+
def section_hash_source_control
|
142
|
+
{
|
143
|
+
:revision => config[:revision],
|
144
|
+
:released => repo_end,
|
145
|
+
:repository => config[:repository],
|
146
|
+
:branch => config[:branch],
|
147
|
+
:scm => config[:scm],
|
148
|
+
:deploy_via => config[:deploy_via],
|
149
|
+
:deploy_to => config[:deploy_to]
|
150
|
+
}
|
151
|
+
end
|
152
|
+
|
153
|
+
def section_hash_latest_release
|
154
|
+
{
|
155
|
+
:latest_release => config[:latest_release],
|
156
|
+
:latest_revision => config[:latest_revision],
|
157
|
+
:release_path => config[:release_path],
|
158
|
+
:real_revision => config[:real_revision],
|
159
|
+
:current_path => config[:current_path]
|
160
|
+
}
|
161
|
+
end
|
162
|
+
|
163
|
+
def section_hash_previous_release
|
164
|
+
{
|
165
|
+
:current_release => config[:current_release],
|
166
|
+
:current_revision => config[:current_revision],
|
167
|
+
:previous_release => config[:previous_release],
|
168
|
+
:previous_revision => config[:previous_revision],
|
169
|
+
:releases => config[:releases]
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
def section_hash_other_deployment_info
|
174
|
+
{
|
175
|
+
:version_dir => config[:version_dir],
|
176
|
+
:shared_dir => config[:shared_dir],
|
177
|
+
:current_dir => config[:current_dir],
|
178
|
+
:releases_path => config[:releases_path],
|
179
|
+
:shared_path => config[:shared_path],
|
180
|
+
:run_method => config[:run_method],
|
181
|
+
:ip_address => config[:ip_address]
|
182
|
+
}
|
183
|
+
end
|
184
|
+
end
|
data/lib/capistrano/mailer.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
require 'rubygems' unless defined?(Rubygems)
|
2
|
-
require 'capistrano' unless defined?(Capistrano)
|
3
|
-
|
4
|
-
unless Capistrano::Configuration.respond_to?(:instance)
|
5
|
-
abort "capistrano/mailer requires Capistrano 2"
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'action_mailer' unless defined?(ActionMailer)
|
9
|
-
|
10
|
-
require 'cap_mailer' unless defined?(CapMailer)
|
11
|
-
|
12
|
-
|
13
|
-
module Capistrano
|
14
|
-
class Configuration
|
15
|
-
module CapistranoMailer
|
16
|
-
def send_notification_email(cap, config = {}, *args)
|
17
|
-
CapMailer.notification_email(cap, config, *args).deliver
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
include CapistranoMailer
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
Capistrano.plugin :mailer, Capistrano::Configuration::CapistranoMailer
|
1
|
+
require 'rubygems' unless defined?(Rubygems)
|
2
|
+
require 'capistrano' unless defined?(Capistrano)
|
3
|
+
|
4
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
5
|
+
abort "capistrano/mailer requires Capistrano 2"
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'action_mailer' unless defined?(ActionMailer)
|
9
|
+
|
10
|
+
require 'cap_mailer' unless defined?(CapMailer)
|
11
|
+
|
12
|
+
|
13
|
+
module Capistrano
|
14
|
+
class Configuration
|
15
|
+
module CapistranoMailer
|
16
|
+
def send_notification_email(cap, config = {}, *args)
|
17
|
+
CapMailer.notification_email(cap, config, *args).deliver
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
include CapistranoMailer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Capistrano.plugin :mailer, Capistrano::Configuration::CapistranoMailer
|
@@ -1,31 +1,31 @@
|
|
1
|
-
<div style="margin: 20px; padding: 0 0 20px 0;">
|
2
|
-
|
3
|
-
<h2 style="margin: 0px; padding: 10px 10px 5px 10px; background: #eee; border-left: 10px solid #ccc; color: #333;">
|
4
|
-
<%= section_title.titleize unless section_title.nil? -%>
|
5
|
-
</h2>
|
6
|
-
<% if data.is_a?(Array) then data = data[0] end -%>
|
7
|
-
<% arr = case section_title
|
8
|
-
when 'deployment'
|
9
|
-
[:date,:time,:rails_env,:task_name,:inferred_command,:host,:release_name,:release_notes]
|
10
|
-
when 'source_control'
|
11
|
-
[:scm,:released,:branch,:revision,:deploy_via,:deploy_to,:repository]
|
12
|
-
when 'latest_release'
|
13
|
-
[:latest_release,:latest_revision,:real_revision,:release_path,:current_path]
|
14
|
-
when 'previous_release'
|
15
|
-
[:current_release,:current_revision,:previous_release,:previous_revision,:releases]
|
16
|
-
when 'other_deployment_info'
|
17
|
-
[:ip_address,:run_method,:source,:strategy,:version_dir,:shared_dir,:current_dir,:releases_path,:shared_path]
|
18
|
-
end -%>
|
19
|
-
<% if !arr.nil? && arr.is_a?(Array) %>
|
20
|
-
<% arr.each do |key| -%>
|
21
|
-
<% if key.is_a?(Symbol) && !data[key].nil?-%>
|
22
|
-
<p style="margin: 10px; padding: 0px;">
|
23
|
-
<span style="float:left; width:150px; padding: 10px 10px 0;"><%= key.to_s.titleize %></span>
|
24
|
-
<span style="float:left; width:490px; padding: 10px 10px 0;"><%= data[key].is_a?(Array) ? data[key].to_sentence : data[key].is_a?(String) ? data[key].gsub(/\n/, '<br>').gsub(/\n/, '<br>').html_safe : data[key].inspect.html_safe %></span>
|
25
|
-
</p>
|
26
|
-
<% end -%>
|
27
|
-
<% end -%>
|
28
|
-
<% end -%>
|
29
|
-
<p style="clear:both"></p>
|
30
|
-
|
31
|
-
</div>
|
1
|
+
<div style="margin: 20px; padding: 0 0 20px 0;">
|
2
|
+
|
3
|
+
<h2 style="margin: 0px; padding: 10px 10px 5px 10px; background: #eee; border-left: 10px solid #ccc; color: #333;">
|
4
|
+
<%= section_title.titleize unless section_title.nil? -%>
|
5
|
+
</h2>
|
6
|
+
<% if data.is_a?(Array) then data = data[0] end -%>
|
7
|
+
<% arr = case section_title
|
8
|
+
when 'deployment'
|
9
|
+
[:date,:time,:rails_env,:task_name,:inferred_command,:host,:release_name,:release_notes]
|
10
|
+
when 'source_control'
|
11
|
+
[:scm,:released,:branch,:revision,:deploy_via,:deploy_to,:repository]
|
12
|
+
when 'latest_release'
|
13
|
+
[:latest_release,:latest_revision,:real_revision,:release_path,:current_path]
|
14
|
+
when 'previous_release'
|
15
|
+
[:current_release,:current_revision,:previous_release,:previous_revision,:releases]
|
16
|
+
when 'other_deployment_info'
|
17
|
+
[:ip_address,:run_method,:source,:strategy,:version_dir,:shared_dir,:current_dir,:releases_path,:shared_path]
|
18
|
+
end -%>
|
19
|
+
<% if !arr.nil? && arr.is_a?(Array) %>
|
20
|
+
<% arr.each do |key| -%>
|
21
|
+
<% if key.is_a?(Symbol) && !data[key].nil?-%>
|
22
|
+
<p style="margin: 10px; padding: 0px;">
|
23
|
+
<span style="float:left; width:150px; padding: 10px 10px 0;"><%= key.to_s.titleize %></span>
|
24
|
+
<span style="float:left; width:490px; padding: 10px 10px 0;"><%= data[key].is_a?(Array) ? data[key].to_sentence : data[key].is_a?(String) ? data[key].gsub(/\n/, '<br>').gsub(/\n/, '<br>').html_safe : data[key].inspect.html_safe %></span>
|
25
|
+
</p>
|
26
|
+
<% end -%>
|
27
|
+
<% end -%>
|
28
|
+
<% end -%>
|
29
|
+
<p style="clear:both"></p>
|
30
|
+
|
31
|
+
</div>
|
@@ -1,23 +1,23 @@
|
|
1
|
-
<%= section_title.titleize unless section_title.nil? -%>
|
2
|
-
===========================================================
|
3
|
-
|
4
|
-
<% if data.is_a?(Array) then data = data[0] end -%>
|
5
|
-
<% arr = case section_title
|
6
|
-
when 'deployment'
|
7
|
-
[:date,:time,:rails_env,:task,:inferred_command,:host,:release_name,:release_notes]
|
8
|
-
when 'source_control'
|
9
|
-
[:scm,:released,:branch,:revision,:deploy_via,:deploy_to,:repository]
|
10
|
-
when 'latest_release'
|
11
|
-
[:latest_release,:latest_revision,:real_revision,:release_path,:current_path]
|
12
|
-
when 'previous_release'
|
13
|
-
[:current_release,:current_revision,:previous_release,:previous_revision,:releases]
|
14
|
-
when 'other_deployment_info'
|
15
|
-
[:ip_address,:run_method,:source,:strategy,:version_dir,:shared_dir,:current_dir,:releases_path,:shared_path]
|
16
|
-
end -%>
|
17
|
-
<% if !arr.nil? && arr.is_a?(Array) %>
|
18
|
-
<% arr.each do |key| -%>
|
19
|
-
<% if key.is_a?(Symbol) && !data[key].nil?-%>
|
20
|
-
<%= key.to_s.titleize %> <%= data[key].is_a?(Array) ? data[key].to_sentence : data[key].is_a?(String) ? data[key] : data[key].inspect %>
|
21
|
-
<% end -%>
|
22
|
-
<% end -%>
|
23
|
-
<% end -%>
|
1
|
+
<%= section_title.titleize unless section_title.nil? -%>
|
2
|
+
===========================================================
|
3
|
+
|
4
|
+
<% if data.is_a?(Array) then data = data[0] end -%>
|
5
|
+
<% arr = case section_title
|
6
|
+
when 'deployment'
|
7
|
+
[:date,:time,:rails_env,:task,:inferred_command,:host,:release_name,:release_notes]
|
8
|
+
when 'source_control'
|
9
|
+
[:scm,:released,:branch,:revision,:deploy_via,:deploy_to,:repository]
|
10
|
+
when 'latest_release'
|
11
|
+
[:latest_release,:latest_revision,:real_revision,:release_path,:current_path]
|
12
|
+
when 'previous_release'
|
13
|
+
[:current_release,:current_revision,:previous_release,:previous_revision,:releases]
|
14
|
+
when 'other_deployment_info'
|
15
|
+
[:ip_address,:run_method,:source,:strategy,:version_dir,:shared_dir,:current_dir,:releases_path,:shared_path]
|
16
|
+
end -%>
|
17
|
+
<% if !arr.nil? && arr.is_a?(Array) %>
|
18
|
+
<% arr.each do |key| -%>
|
19
|
+
<% if key.is_a?(Symbol) && !data[key].nil?-%>
|
20
|
+
<%= key.to_s.titleize %> <%= data[key].is_a?(Array) ? data[key].to_sentence : data[key].is_a?(String) ? data[key] : data[key].inspect %>
|
21
|
+
<% end -%>
|
22
|
+
<% end -%>
|
23
|
+
<% end -%>
|
@@ -1,39 +1,39 @@
|
|
1
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
5
|
-
<title><%= @site_name %> Notification </title>
|
6
|
-
</head>
|
7
|
-
<body style="font: 14px normal Helvetica, Arial, Sans; background: #999;">
|
8
|
-
|
9
|
-
<div style="width:800px; margin: 10px auto; background: #fff; border: 10px solid #aaa;">
|
10
|
-
|
11
|
-
<h1 style="clear: both; margin: 0; padding: 40px 20px 5px 20px; border-bottom: 1px dotted; background: #ccc;">
|
12
|
-
<%= @site_name %> <%=@task_name.titleize unless @task_name.nil? %>
|
13
|
-
</h1>
|
14
|
-
|
15
|
-
<% unless @site_url.nil? %>
|
16
|
-
<p style="margin: 8px 0 20px 20px; padding: 0px; font-style: italic;" >
|
17
|
-
View site: <a href="<%= @site_url.html_safe -%>"><%= @site_url.html_safe -%></a>
|
18
|
-
</p>
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
<p style="margin: 10px 20px; font-weight: bold;">Released: <%= @date %> at <%= @time %></p>
|
22
|
-
|
23
|
-
<%= @sections.map { |section|
|
24
|
-
data = @section_data[section.to_sym]
|
25
|
-
if !data.empty?
|
26
|
-
if %w(extra_information release_data).include?(section)
|
27
|
-
render :partial => 'section_custom.html.erb', :locals => {:section_title => section, :data => data}
|
28
|
-
else
|
29
|
-
render :partial => 'section.html.erb', :locals => {:section_title => section, :data => data}
|
30
|
-
end
|
31
|
-
end
|
32
|
-
}.join.html_safe unless @sections.nil? %>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<p style="margin: 8px 0 20px 20px; padding: 0px; font-style: italic;" >
|
36
|
-
Brought to you by: <a href="http://github.com/textgoeshere/capistrano_mailer">Capistrano Mailer</a>
|
37
|
-
</p>
|
38
|
-
</body>
|
39
|
-
</html>
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
5
|
+
<title><%= @site_name %> Notification </title>
|
6
|
+
</head>
|
7
|
+
<body style="font: 14px normal Helvetica, Arial, Sans; background: #999;">
|
8
|
+
|
9
|
+
<div style="width:800px; margin: 10px auto; background: #fff; border: 10px solid #aaa;">
|
10
|
+
|
11
|
+
<h1 style="clear: both; margin: 0; padding: 40px 20px 5px 20px; border-bottom: 1px dotted; background: #ccc;">
|
12
|
+
<%= @site_name %> <%=@task_name.titleize unless @task_name.nil? %>
|
13
|
+
</h1>
|
14
|
+
|
15
|
+
<% unless @site_url.nil? %>
|
16
|
+
<p style="margin: 8px 0 20px 20px; padding: 0px; font-style: italic;" >
|
17
|
+
View site: <a href="<%= @site_url.html_safe -%>"><%= @site_url.html_safe -%></a>
|
18
|
+
</p>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<p style="margin: 10px 20px; font-weight: bold;">Released: <%= @date %> at <%= @time %></p>
|
22
|
+
|
23
|
+
<%= @sections.map { |section|
|
24
|
+
data = @section_data[section.to_sym]
|
25
|
+
if !data.empty?
|
26
|
+
if %w(extra_information release_data).include?(section)
|
27
|
+
render :partial => 'section_custom.html.erb', :locals => {:section_title => section, :data => data}
|
28
|
+
else
|
29
|
+
render :partial => 'section.html.erb', :locals => {:section_title => section, :data => data}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
}.join.html_safe unless @sections.nil? %>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<p style="margin: 8px 0 20px 20px; padding: 0px; font-style: italic;" >
|
36
|
+
Brought to you by: <a href="http://github.com/textgoeshere/capistrano_mailer">Capistrano Mailer</a>
|
37
|
+
</p>
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -1,22 +1,22 @@
|
|
1
|
-
<%= @site_name %> Notification
|
2
|
-
===========================================================
|
3
|
-
|
4
|
-
<%= @site_name %> <%=@task_name.titleize unless @task_name.nil? %>
|
5
|
-
===========================================================
|
6
|
-
Brought to you by: Capistrano Mailer - http://github.com/pboling/capistrano_mailer
|
7
|
-
Released: <%= @date %> at <%= @time %>
|
8
|
-
|
9
|
-
<%= @sections.map { |section|
|
10
|
-
data = @section_data[section.to_sym]
|
11
|
-
if !data.empty?
|
12
|
-
if %w(extra_information release_data).include?(section)
|
13
|
-
render :partial => 'section_custom.text.erb', :locals => {:section_title => section, :data => data}
|
14
|
-
else
|
15
|
-
render :partial => 'section.text.erb', :locals => {:section_title => section, :data => data}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
}.join.html_safe unless @sections.nil? %>
|
19
|
-
|
20
|
-
===========================================================
|
21
|
-
Copyright 2009 9thBit LLC under MIT License
|
22
|
-
Copyright 2007-8 Sagebit LLC under MIT License
|
1
|
+
<%= @site_name %> Notification
|
2
|
+
===========================================================
|
3
|
+
|
4
|
+
<%= @site_name %> <%=@task_name.titleize unless @task_name.nil? %>
|
5
|
+
===========================================================
|
6
|
+
Brought to you by: Capistrano Mailer - http://github.com/pboling/capistrano_mailer
|
7
|
+
Released: <%= @date %> at <%= @time %>
|
8
|
+
|
9
|
+
<%= @sections.map { |section|
|
10
|
+
data = @section_data[section.to_sym]
|
11
|
+
if !data.empty?
|
12
|
+
if %w(extra_information release_data).include?(section)
|
13
|
+
render :partial => 'section_custom.text.erb', :locals => {:section_title => section, :data => data}
|
14
|
+
else
|
15
|
+
render :partial => 'section.text.erb', :locals => {:section_title => section, :data => data}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
}.join.html_safe unless @sections.nil? %>
|
19
|
+
|
20
|
+
===========================================================
|
21
|
+
Copyright 2009 9thBit LLC under MIT License
|
22
|
+
Copyright 2007-8 Sagebit LLC under MIT License
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ date: 2011-12-11 00:00:00.000000000Z
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: actionmailer
|
18
|
-
requirement: &
|
18
|
+
requirement: &70226373536920 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70226373536920
|
27
27
|
description: Capistrano Deployment Email Notification. Keep the whole team informed
|
28
28
|
of each release!
|
29
29
|
email:
|