capistrano_mailer 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ *.gem
5
+ doc
6
+ .project
7
+ .idea
@@ -0,0 +1,107 @@
1
+ Version 4.0.2 2013-01-21
2
+ - Git Release Notes by Mark Sim (marksim)
3
+ - Style improvements by Bartłomiej Danek (bartekd)
4
+ - Improved Readme by Peter Boling (pboling)
5
+
6
+ Version 4.0.1 2011-12-11
7
+ - Fixed issues with README
8
+
9
+ Version 4.0.0 2011-12-11
10
+ - Using the new way of sending a mail by passing the mail command a hash of options and setting instance variables. (jrust)
11
+ - Using Notifier.email_name().deliver instead (jrust)
12
+ - Using prepend_view_path for the template root (jrust)
13
+ - Remove the content_type setting since just sends a multipart email.(jrust)
14
+ - commented out the new release_notes variable, because even with version 2.9 of capistrano there was no cap method called release notes. (jrust)
15
+ - file cleanup (pboling)
16
+ - Improved Readme (pboling)
17
+
18
+ Version 3.2.5 2010-04-29
19
+ - Remove Active Support dependency
20
+
21
+ Version 3.2.4 2010-01-13
22
+ - Fixed subject line format (mail client filters are based on format of subject line)
23
+
24
+ Version 3.2.3 2010-01-13
25
+ - config[:user] is now optional.
26
+
27
+ Version 3.2.2 2010-01-13
28
+ - Improved Readme
29
+
30
+ Version 3.2.1 2010-01-13
31
+ - Added deprecation warning for configure_capistrano_mailer
32
+ - commented :site_url, doesn't appear to be a native capistrano variable, if sent in will still be rendered.
33
+
34
+ Version 3.2.0 textgoeshere fork
35
+ - config/cap_mailer_settings.rb is not longer a hard coded configuration location requirement.
36
+ - refactoring core cap mailer class
37
+
38
+ Version 3.1.10 2010-01-07
39
+ - included _section.text.erb view in gem manifest
40
+ - text version of email should render the text partials, not html
41
+
42
+ Version 3.1.9 2010-01-07
43
+ - Fixed URL for capistrano_mailer repo on github in HTML email message
44
+
45
+ Version 3.1.8 2010-01-07
46
+ - Improved Readme
47
+
48
+ Version 3.1.6 2009-11-10
49
+ - Fixed installation instructions to reference gemcutter instead of github
50
+
51
+ Version 3.1.3 2009-09-29
52
+ - Added Git as known compatable SCM to readme
53
+ - Credited Dustin Deyoung as Author of HTML Email templates
54
+ - Removed MIT-LICENSE file from gemspec (because github refuses to build with it there)
55
+ - Still trying to get github to build the gem
56
+
57
+ Version 3.1.2 2009-09-25
58
+ - Fixed footer copyright
59
+ - Trying to get github to build the gem
60
+
61
+ Version 3.1.1 2009-09-24
62
+ - Added back compatability with svn which broke when fixing for perforce (thanks to Matthew Beale / mixonic)
63
+ - Improved Readme for plugin installation. Tested as a plugin. Verified continued compatibility with Deprec.
64
+
65
+ Version 3.1.0 2009-09-17
66
+ - Added compatability with perforce (thanks to Andy Kock / ak47)
67
+
68
+ Version 3.0.3 2009-09-03
69
+ - Improved readme and upgrade instructions
70
+
71
+ Version 3.0.2 2009-08-27
72
+ - Fixed some typos in readme referencing outdated API
73
+
74
+ Version 3.0.1 2009-08-21
75
+ - removed a stray puts used in debugging
76
+
77
+ Version 3.0.0 2009-08-19
78
+ - turned into a gem
79
+ - New API for configuration
80
+ - improved email templates (hardened against crappy data)
81
+ - added simple testing framwork and Rakefile
82
+ - still compatible with deprec
83
+
84
+ Version 2.1.0 2008-11-15
85
+ - improved readme, and other stuff I don't remember
86
+
87
+ Version 2.0.1 2008-07-30
88
+ - Works when deploying to a server without capistrano installed
89
+ - Updated README and WIKI (improved documentation)
90
+
91
+ Version 2.0 2008-07-25
92
+ - Works with Rails 2.1
93
+ - Works with Capistrano 2.4.3
94
+ - Added access to many of Capistrano's internal variables (~25) so the emails can be more informative
95
+ - Added inferred_command, repo_end and some other derived variables that give more insight into a deployment
96
+ - Parameters are now sent in a hash
97
+ - Emails updated with new information
98
+ - HTML email improved layout, and added styling (thanks to Dustin Deyoung @ Sagebit)
99
+
100
+ Version 1.0.1 2008-03-26
101
+ - Works with Rails 2.0.2
102
+ - Works with Capistrano 2.1.0 - 2.2.0
103
+ - Compatability with Deprec verified
104
+
105
+ Version 1.0 2008-02-11
106
+ - Works with Rails 2.0.2
107
+ - Works with Capistrano 2.1.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'capistrano-log_with_awesome'
4
+ gem 'inline-style'
@@ -0,0 +1,46 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.2)
5
+ capistrano (2.12.0)
6
+ highline
7
+ net-scp (>= 1.0.0)
8
+ net-sftp (>= 2.0.0)
9
+ net-ssh (>= 2.0.14)
10
+ net-ssh-gateway (>= 1.1.0)
11
+ capistrano-log_with_awesome (0.0.2)
12
+ capistrano (>= 2.5.14)
13
+ css_parser (1.2.6)
14
+ addressable
15
+ rdoc
16
+ facets (2.9.3)
17
+ ffi (1.3.1)
18
+ ffi (1.3.1-x86-mingw32)
19
+ highline (1.6.12)
20
+ inline-style (0.5.0)
21
+ css_parser
22
+ facets
23
+ maca-fork-csspool
24
+ nokogiri
25
+ json (1.7.6)
26
+ maca-fork-csspool (2.0.2)
27
+ ffi
28
+ net-scp (1.0.4)
29
+ net-ssh (>= 1.99.1)
30
+ net-sftp (2.0.5)
31
+ net-ssh (>= 2.0.9)
32
+ net-ssh (2.5.2)
33
+ net-ssh-gateway (1.1.0)
34
+ net-ssh (>= 1.99.1)
35
+ nokogiri (1.5.6)
36
+ nokogiri (1.5.6-x86-mingw32)
37
+ rdoc (3.12)
38
+ json (~> 1.4)
39
+
40
+ PLATFORMS
41
+ ruby
42
+ x86-mingw32
43
+
44
+ DEPENDENCIES
45
+ capistrano-log_with_awesome
46
+ inline-style
@@ -1,187 +1,204 @@
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
1
+ = Capistrano Mailer {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/pboling/capistrano_mailer] {<img src="http://api.coderwall.com/pboling/endorsecount.png" />}[http://coderwall.com/pboling]
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
+ == Versioning
181
+
182
+ This library aims to adhere to {Semantic Versioning 2.0.0}[http://semver.org/].
183
+ Violations of this scheme should be reported as bugs. Specifically,
184
+ if a minor or patch version is released that breaks backward
185
+ compatibility, a new version should be immediately released that
186
+ restores compatibility. Breaking changes to the public API will
187
+ only be introduced with new major versions.
188
+
189
+ As a result of this policy, you can (and should) specify a
190
+ dependency on this gem using the {Pessimistic Version Constraint}[http://docs.rubygems.org/read/chapter/16#page74] with two digits of precision.
191
+
192
+ For example:
193
+
194
+ spec.add_dependency 'capistrano_mailer', '~> 4.0'
195
+
196
+
197
+ ----------------------------------------------------------------------------------
198
+ This plugin started out as a collaboration between Sagebit, LLC (http://www.sagebit.com) and Peter Boling (http://www.peterboling.com).
199
+ Written initially while Peter Boling was working at Sagebit for use in various projects.
200
+
201
+ Author: Peter Boling, peter.boling at gmail dot com
202
+
203
+ Copyright (c) 2009-2011 Peter Boling of 9thBit LLC, released under the MIT license
204
+ Copyright (c) 2007-2008 Sagebit LLC, released under the MIT license