capistrano_mailer 3.2.7 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,116 @@
1
+ ## Next...
2
+ * Add tests with rspec and capistrano-spec
3
+
4
+ ## Version 3.3.0 2014-03-17
5
+ * Fix compatibility with Rails 2.3.18
6
+ * Integrate Travis-ci
7
+ * Integrate Coveralls
8
+ * Backport (most) new features from master (4.X releases)
9
+ * Gemfile.lock should not be in version control for a gem by Peter Boling
10
+ * Do not require RubyGems by Peter Boling
11
+ * Fix dependency declarations; remove jeweler dependency; improve gemspec by Peter Boling
12
+ * Modernize the ruby manager by Peter Boling
13
+ * Modernize the VERSION by Peter Boling
14
+ * Markdown the Readme. by Peter Boling (pboling)
15
+ * Modern the License by Peter Boling (pboling)
16
+ * Markdown the Changelog by Peter Boling (pboling)
17
+ * Git Release Notes by Mark Sim (marksim)
18
+ * Improved Readme by Peter Boling (pboling)
19
+
20
+ ## Version 3.2.7 2011-12-11
21
+ * General file cleanup
22
+ * Improved Readme
23
+ * Fix to \*args passing to CapMailer.deliver_notification_email (dreamnid)
24
+
25
+ ## Version 3.2.6 --botched--
26
+
27
+ ## Version 3.2.5 2010-04-29
28
+ * Remove Active Support dependency
29
+
30
+ ## Version 3.2.4 2010-01-13
31
+ * Fixed subject line format (mail client filters are based on format of subject line)
32
+
33
+ ## Version 3.2.3 2010-01-13
34
+ * config[:user] is now optional.
35
+
36
+ ## Version 3.2.2 2010-01-13
37
+ * Improved Readme
38
+
39
+ ## Version 3.2.1 2010-01-13
40
+ * Added deprecation warning for configure_capistrano_mailer
41
+ * commented :site_url, doesn't appear to be a native capistrano variable, if sent in will still be rendered.
42
+
43
+ ## Version 3.2.0 textgoeshere fork
44
+ * config/cap_mailer_settings.rb is not longer a hard coded configuration location requirement.
45
+ * refactoring core cap mailer class
46
+
47
+ ## Version 3.1.10 2010-01-07
48
+ * included \_section.text.erb view in gem manifest
49
+ * text version of email should render the text partials, not html
50
+
51
+ ## Version 3.1.9 2010-01-07
52
+ * Fixed URL for capistrano_mailer repo on github in HTML email message
53
+
54
+ ## Version 3.1.8 2010-01-07
55
+ * Improved Readme
56
+
57
+ ## Version 3.1.6 2009-11-10
58
+ * Fixed installation instructions to reference gemcutter instead of github
59
+
60
+ ## Version 3.1.3 2009-09-29
61
+ * Added Git as known compatable SCM to readme
62
+ * Credited Dustin Deyoung as Author of HTML Email templates
63
+ * Removed MIT-LICENSE file from gemspec (because github refuses to build with it there)
64
+ * Still trying to get github to build the gem
65
+
66
+ ## Version 3.1.2 2009-09-25
67
+ * Fixed footer copyright
68
+ * Trying to get github to build the gem
69
+
70
+ ## Version 3.1.1 2009-09-24
71
+ * Added back compatability with svn which broke when fixing for perforce (thanks to Matthew Beale / mixonic)
72
+ * Improved Readme for plugin installation. Tested as a plugin. Verified continued compatibility with Deprec.
73
+
74
+ ## Version 3.1.0 2009-09-17
75
+ * Added compatability with perforce (thanks to Andy Kock / ak47)
76
+
77
+ ## Version 3.0.3 2009-09-03
78
+ * Improved readme and upgrade instructions
79
+
80
+ ## Version 3.0.2 2009-08-27
81
+ * Fixed some typos in readme referencing outdated API
82
+
83
+ ## Version 3.0.1 2009-08-21
84
+ * removed a stray puts used in debugging
85
+
86
+ ## Version 3.0.0 2009-08-19
87
+ * turned into a gem
88
+ * New API for configuration
89
+ * improved email templates (hardened against crappy data)
90
+ * added simple testing framwork and Rakefile
91
+ * still compatible with deprec
92
+
93
+ ## Version 2.1.0 2008-11-15
94
+ * improved readme, and other stuff I don't remember
95
+
96
+ ## Version 2.0.1 2008-07-30
97
+ * Works when deploying to a server without capistrano installed
98
+ * Updated README and WIKI (improved documentation)
99
+
100
+ ## Version 2.0 2008-07-25
101
+ * Works with Rails 2.1
102
+ * Works with Capistrano 2.4.3
103
+ * Added access to many of Capistrano's internal variables (~25) so the emails can be more informative
104
+ * Added inferred_command, repo_end and some other derived variables that give more insight into a deployment
105
+ * Parameters are now sent in a hash
106
+ * Emails updated with new information
107
+ * HTML email improved layout, and added styling (thanks to Dustin Deyoung @ Sagebit)
108
+
109
+ ## Version 1.0.1 2008-03-26
110
+ * Works with Rails 2.0.2
111
+ * Works with Capistrano 2.1.0 - 2.2.0
112
+ * Compatability with Deprec verified
113
+
114
+ ## Version 1.0 2008-02-11
115
+ * Works with Rails 2.0.2
116
+ * Works with Capistrano 2.1.0
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2008-2014 Peter H. Boling (http://railsbling.com)
2
+ Copyright (c) 2007-8 Sagebit, LLC
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,268 @@
1
+ # CapistranoMailer
2
+
3
+ A Gem For Capistrano Deployment Email Notification
4
+
5
+ | Project | Capistrano Mailer |
6
+ |------------------------ | ----------------- |
7
+ | gem name | capistrano_mailer |
8
+ | license | MIT |
9
+ | moldiness | [![Maintainer Status](http://stillmaintained.com/pboling/capistrano_mailer.png)](http://stillmaintained.com/pboling/capistrano_mailer) |
10
+ | version | [![Gem Version](https://badge.fury.io/rb/capistrano_mailer.png)](http://badge.fury.io/rb/capistrano_mailer) |
11
+ | dependencies | [![Dependency Status](https://gemnasium.com/pboling/capistrano_mailer.png)](https://gemnasium.com/pboling/capistrano_mailer) |
12
+ | code quality | [![Code Climate](https://codeclimate.com/github/pboling/capistrano_mailer.png)](https://codeclimate.com/github/pboling/capistrano_mailer) |
13
+ | inline documenation | [![Inline docs](http://inch-pages.github.io/github/pboling/capistrano_mailer.png)](http://inch-pages.github.io/github/pboling/capistrano_mailer) |
14
+ | continuous integration | [![Build Status](https://travis-ci.org/pboling/capistrano_mailer.png?branch=rails2)](https://travis-ci.org/pboling/capistrano_mailer) |
15
+ | test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/capistrano_mailer/badge.png)](https://coveralls.io/r/pboling/capistrano_mailer) |
16
+ | homepage | [https://github.com/pboling/capistrano_mailer][homepage] |
17
+ | documentation | [http://rdoc.info/github/pboling/capistrano_mailer/frames][documentation] |
18
+ | author | [Peter Boling](https://coderbits.com/pboling) |
19
+ | Spread ~♡ⓛⓞⓥⓔ♡~ | [![Endorse Me](https://api.coderwall.com/pboling/endorsecount.png)](http://coderwall.com/pboling) |
20
+
21
+ ## Summary
22
+
23
+ * It is a Capistrano Plugin / Ruby Gem that requires ActionMailer
24
+ * It is MIT licensed
25
+ * It is old, but still kicking; project started in 2007
26
+ * rails2 branch (THIS BRANCH!), releases will be in 3.x range, requires Rails 2.X
27
+ * master branch, releases will be in 4.x range, requires Rails 3.X
28
+ * Requires at least Capistrano 2.4.3 (might work with capistrano as old as 2.1.0, but has not been tested)
29
+ * Known to be compatible with SCMs as of version 3.1.2: Perforce, SVN, and Git
30
+ * Known to be compatible with, but does not require, the deprec gem.
31
+
32
+ ## About
33
+
34
+ Ever wanted to be emailed whenever someone on the team does a cap deploy of trunk or some tag to some server.
35
+ 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,
36
+ and this plugin makes sure everyone on the need to know list is notified when something new is deployed.
37
+
38
+ This plugin/gem is an extension to Capistrano.
39
+
40
+ That means it registers itself with Capistrano as a plugin and is therefore available to call in your recipes.
41
+
42
+ If you are looking to roll your own email integration into capistrano then try this pastie:
43
+ http://pastie.org/146264 (thanks to Mislav Marohnić).
44
+ But if you want to take the easy road to riches then keep reading ;)
45
+ -- figurative "riches" of course, I promise nothing in return for your using this plugin
46
+
47
+ ### Important Note:
48
+
49
+ 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!
50
+
51
+ ## Installation
52
+
53
+ Add this line to your application's Gemfile:
54
+
55
+ gem 'capistrano_mailer', '~> 3.3.0'
56
+
57
+ And then execute:
58
+
59
+ $ bundle
60
+
61
+ Or install it yourself as:
62
+
63
+ $ gem install capistrano_mailer
64
+
65
+ ### With Rails <= 2.X (THIS BRANCH!)
66
+
67
+ The 3.x+ versions of this gem require Rails 2.X
68
+
69
+ ### With Rails >= 3.X (NOT THIS BRANCH!)
70
+
71
+ Switch to the master branch (releases will be in 4+ range)
72
+ The 4.x+ versions of this gem require at least Rails 3
73
+
74
+ ## Upgrading
75
+
76
+ From version 3.2.x to version 3.3.x
77
+
78
+ 1. If you had customized mailer views you might need to update the name.
79
+ The built-in views have been changed from with a `.text`:
80
+
81
+ `notification_email.text.html.erb`
82
+
83
+ to without
84
+
85
+ `notification_email.html.erb`
86
+
87
+ From version 3.1.x to version 3.2.x
88
+
89
+ 1. Update the way CapistranoMailer is configured using the new method: CapMailer.configure (see Usage below).
90
+ 2. require the cap mailer config file (see Usage below)
91
+
92
+ From version 2.1.0 to version 3.1.x:
93
+
94
+ 1. Update the way CapistranoMailer is configured using the new method: CapMailer.configure_capistrano_mailer (changed in later versions to just 'configure') (see Usage below).
95
+ 2. Update the require statement at the top of deploy.rb, see below (note for plugin change from capistrano_mailer to capistrano/mailer).
96
+ 3. Change the mailer.send to mailer.send_notification_email in your cap recipe.
97
+
98
+ ## Usage
99
+
100
+ 1) You need to have already setup capistrano in the project, including the 'capify .' command.
101
+
102
+ 2) Load the Capistrano plugin: Add this line to the top of your config/deploy.rb:
103
+
104
+ require 'capistrano/mailer'
105
+
106
+ # configure capistrano_mailer
107
+ # The configuration file can go anywhere, but in past versions of the gem it was required to be in the config/ dir.
108
+ require 'config/cap_mailer_settings'
109
+
110
+ 3) Configure Capistrano Mailer in the settings file required in step 2 (`config/cap_mailer_settings` or whatever you called it):
111
+
112
+ ActionMailer::Base.delivery_method = :sendmail
113
+ ActionMailer::Base.default_charset = "utf-8"
114
+ ActionMailer::Base.sendmail_settings = {
115
+ :location => '/usr/sbin/sendmail',
116
+ :arguments => "-i -t -f deploy@example.com" # the address your deployment notification emails will come from
117
+ }
118
+
119
+ CapMailer.configure do |config|
120
+ config[:recipient_addresses] = ["dev1@example.com"]
121
+ config[:sender_address] = "deployment@example.com"
122
+ config[:subject_prepend] = "[EMPTY-CAP-DEPLOY]"
123
+ config[:site_name] = "Empty Example.com App"
124
+ end
125
+
126
+ 4) Setup the tasks.
127
+
128
+ # load recipes for notification (or roll your own)
129
+ require 'capistrano/mailer_recipes'
130
+
131
+ OR: Roll your own! Add these two tasks to your deploy.rb:
132
+
133
+ namespace :show do
134
+ task :me do
135
+ set :task_name, task_call_frames.first.task.fully_qualified_name
136
+ end
137
+ end
138
+
139
+ namespace :deploy do
140
+ desc "Send email notification of deployment"
141
+ task :notify, :roles => :app do
142
+ show.me # this sets the task_name variable
143
+
144
+ # Set the release notes
145
+ git_commits_range = "#{previous_revision.strip}..#{current_revision.strip}"
146
+ git_log = `git log --pretty=oneline --abbrev-commit #{git_commits_range}` # executes in local shell
147
+ set :release_notes, git_log.blank? ? "No Changes since last deploy." : "from git:\n" + git_log
148
+
149
+ # These are overridden by settings from configure the block:
150
+ # CapMailer.configure do |config|
151
+ # config[:attach_log_on] = [:failure]
152
+ # end
153
+ mailer.send_notification_email(self, {
154
+ #:attach_log_on => [:success, :failure],
155
+ :release_notes => release_notes
156
+ })
157
+ end
158
+ end
159
+
160
+
161
+ 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!
162
+
163
+ 6) The only parameter to mailer.send_notification_email that is *required* is the first, and it should always be `self`. _Minimally_ you need to define the capistrano variables:
164
+
165
+ :rails_env
166
+ :repository
167
+ :task_name (provided by the show:me task included in this readme)
168
+ :deploy_to
169
+ :host
170
+ :application
171
+
172
+ 7) You can `set` any variable and send it to be rendered as a custom section in the notification email using the third parameter to `send_notification_email`:
173
+
174
+ set :hot_slice_of_wonder, 'This is just so cool'
175
+
176
+ mailer.send_notification_email(
177
+ self, # will contain everything defined with set, but capistrano mailer will only know to pull some of them for rendering
178
+ { :attach_log_on => [:success, :failure] }, # Custom configurations
179
+ { :my_super_awesome_thing => hot_slice_of_wonder }
180
+ )
181
+
182
+ 8) Then add the hook somewhere in your deploy.rb (if you required `capistrano/mailer_recipes` this is already done):
183
+
184
+ after "deploy", "deploy:notify"
185
+
186
+ 9) Enjoy and Happy Capping!
187
+
188
+ ## Customization
189
+
190
+ If you want to use your own views you'll need to recreate the notification_email view:
191
+ First you need to define where your templates are:
192
+
193
+ CapMailer.configure_capistrano_mailer do |config|
194
+ config[:template_root] = "app/views/capistrano_mailer/"
195
+ end
196
+
197
+ Then you'll need to create templates there called:
198
+
199
+ `notification_email.html.erb`
200
+
201
+ and / or
202
+
203
+ `notification_email.plain.erb`
204
+
205
+ Take a look at the templates that comes with the plugin to see how it is done (views/cap_mailer/...)
206
+
207
+ ## Credit where Credit is Due
208
+
209
+ [Peter Boling (pboling)](https://github.com/pboling) - Wrote original & maintainer
210
+ [Dave Nolan (textgoeshere)](https://github.com/textgoeshere) - lots of refactoring for 3.2 release
211
+ [Jason Rust (jrust)](https://github.com/jrust) - Updated for Rails 3 compatibility
212
+
213
+ Thanks to [Dustin Deyoung (ddeyoung)](https://github.com/ddeyoung) for the beautiful HTML email templates.
214
+ Thanks to mixonix and [Yoan Blanc (greut)](https://github.com/greut) for work on SCMs compatibility
215
+
216
+ ## How you can help!
217
+
218
+ Take a look at the `reek` list which is the file called `REEK` and stat fixing things. Once you complete a change, run the tests:
219
+
220
+ ```
221
+ bundle exec rake test:all
222
+ ```
223
+
224
+ If the tests pass refresh the `reek` list:
225
+
226
+ ```
227
+ bundle exec rake reek > REEK
228
+ ```
229
+
230
+ Follow the instructions for "Contributing" below.
231
+
232
+ ## Contributing
233
+
234
+ 1. Fork it
235
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
236
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
237
+ 4. Push to the branch (`git push origin my-new-feature`)
238
+ 5. Create new Pull Request
239
+
240
+ ## Versioning
241
+
242
+ This library aims to adhere to [Semantic Versioning 2.0.0][semver].
243
+ Violations of this scheme should be reported as bugs. Specifically,
244
+ if a minor or patch version is released that breaks backward
245
+ compatibility, a new version should be immediately released that
246
+ restores compatibility. Breaking changes to the public API will
247
+ only be introduced with new major versions.
248
+
249
+ As a result of this policy, you can (and should) specify a
250
+ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
251
+
252
+ For example:
253
+
254
+ spec.add_dependency 'capistrano_mailer', '~> 0.5'
255
+
256
+ ## License
257
+
258
+ * MIT License - See LICENSE file in this project
259
+ * Copyright (c) 2008-2014 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
260
+ * Copyright (c) 2007-8 Peter Boling & Sagebit, LLC
261
+
262
+ [semver]: http://semver.org/
263
+ [pvc]: http://docs.rubygems.org/read/chapter/16#page74
264
+ [railsbling]: http://www.railsbling.com
265
+ [peterboling]: http://www.peterboling.com
266
+ [documentation]: http://rdoc.info/github/pboling/capistrano_mailer/frames
267
+ [homepage]: https://github.com/pboling/capistrano_mailer
268
+
data/Rakefile CHANGED
@@ -1,52 +1,24 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
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"]
12
- gemspec.homepage = "http://github.com/pboling/capistrano_mailer"
13
- gemspec.authors = ["Peter Boling", "Dave Nolan"]
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.text.html.erb",
26
- "views/cap_mailer/notification_email.text.plain.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
+
4
+ desc 'Default: run unit tests.'
5
+ task :default => :test
6
+
7
+ desc 'Test the capistrano_mailer gem.'
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs << 'lib'
10
+ t.libs << 'test'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the capistrano_mailer gem.'
16
+ require 'rdoc'
17
+ require 'rdoc/task'
18
+ RDoc::Task.new do |rdoc|
19
+ rdoc.rdoc_dir = 'rdoc'
20
+ rdoc.title = 'capistrano_mailer'
21
+ rdoc.options << '--line-numbers' << '--inline-source'
22
+ rdoc.rdoc_files.include('README.markdown')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end