textgoeshere-capistrano_mailer 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +194 -0
- data/Rakefile +53 -0
- data/VERSION.yml +4 -0
- data/about.yml +9 -0
- data/init.rb +3 -0
- data/lib/cap_mailer.rb +171 -0
- data/lib/capistrano/mailer.rb +26 -0
- data/test/build_gem_test.rb +18 -0
- data/views/cap_mailer/_section.html.erb +31 -0
- data/views/cap_mailer/_section.text.erb +23 -0
- data/views/cap_mailer/_section_custom.html.erb +15 -0
- data/views/cap_mailer/notification_email.text.html.erb +37 -0
- data/views/cap_mailer/notification_email.text.plain.erb +22 -0
- metadata +76 -0
data/README.rdoc
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
= Capistrano Mailer v3.1.3 (20090925)
|
2
|
+
|
3
|
+
* For Capistrano Deployment Email Notification
|
4
|
+
* It is a Capistrano Plugin / Ruby Gem that requires ActionMailer
|
5
|
+
* It is MIT-LICENSE (License file is in source only for now because github won't build the gem if it is bundled with the gem... ?)
|
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/tree/master
|
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 1.2.6 (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
|
+
== Installation
|
45
|
+
|
46
|
+
Gem Using Git building from source:
|
47
|
+
|
48
|
+
mkdir -p ~/src
|
49
|
+
cd ~/src
|
50
|
+
git clone git://github.com/pboling/capistrano_mailer.git
|
51
|
+
cd capistrano_mailer
|
52
|
+
gem build capistrano_mailer.gemspec
|
53
|
+
sudo gem install capistrano_mailer-3.1.6.gem # (Or whatever version gets built)
|
54
|
+
|
55
|
+
Gemcutter is the hot new gem host, and you can use it like this:
|
56
|
+
|
57
|
+
[sudo] gem install gemcutter
|
58
|
+
[sudo] gem tumble # makes gemcutter gem source first in line, if you haven't already
|
59
|
+
[sudo] gem install capistrano_mailer
|
60
|
+
|
61
|
+
Then cd to your rails app to optionally freeze the gem into your app:
|
62
|
+
|
63
|
+
rake gems:freeze GEM=capistrano_mailer
|
64
|
+
# You do NOT need to add a config.gem line to environment.rb for capistrano mailer,
|
65
|
+
# But in order to use the gems:freeze task you DO need ot add it as a config.gem, at least temporarily.
|
66
|
+
|
67
|
+
Plugin using Git:
|
68
|
+
|
69
|
+
# Installation as plugin works... but the setup is slightly different. (See Usage below)
|
70
|
+
./script/plugin install git://github.com/pboling/capistrano_mailer.git
|
71
|
+
|
72
|
+
Using SVN (deprecated, repository is no longer updated):
|
73
|
+
|
74
|
+
./script/plugin install http://capistrano-mailer.googlecode.com/svn/trunk/capistrano_mailer
|
75
|
+
|
76
|
+
== Upgrading
|
77
|
+
|
78
|
+
From version 2.1.0 to version 3.x.x:
|
79
|
+
|
80
|
+
1. Update the way CapistranoMailer is configured using the new method: CapMailer.configure_capistrano_mailer, see below.
|
81
|
+
2. Update the require statement at the top of deploy.rb, see below (note for plugin change from capistrano_mailer to capistrano/mailer).
|
82
|
+
3. Change the mailer.send to mailer.send_notification_email in your cap recipe.
|
83
|
+
|
84
|
+
== Usage
|
85
|
+
|
86
|
+
1. Install as gem or plugin. You need to have already setup capistrano in the project, including the 'capify .' command.
|
87
|
+
|
88
|
+
2. Add this line to the top of your config/deploy.rb:
|
89
|
+
|
90
|
+
# For gem:
|
91
|
+
# You do NOT need to register the gem in your environment file using config.gem
|
92
|
+
require 'capistrano/mailer'
|
93
|
+
|
94
|
+
# For plugin:
|
95
|
+
# You must make capistrano_mailer's libraries available in Ruby's load path. This is one way to do that:
|
96
|
+
# Add to the top of your config/deploy.rb file:
|
97
|
+
$:.unshift 'vendor/plugins/capistrano_mailer/lib'
|
98
|
+
require 'capistrano/mailer'
|
99
|
+
|
100
|
+
3. Add cap_mailer configuration to deploy (or place it in another file and require it after capistrano/mailer':
|
101
|
+
|
102
|
+
# If installed as a plugin might need the require here as well
|
103
|
+
|
104
|
+
ActionMailer::Base.delivery_method = :smtp # or :sendmail, or whatever
|
105
|
+
ActionMailer::Base.smtp_settings = { # if using :smtp
|
106
|
+
:address => "mail.example.com",
|
107
|
+
:port => 25,
|
108
|
+
:domain => 'default.com',
|
109
|
+
:perform_deliveries => true,
|
110
|
+
:user_name => "releases@example.com",
|
111
|
+
:password => "mypassword",
|
112
|
+
:authentication => :login }
|
113
|
+
ActionMailer::Base.default_charset = "utf-8"# or "latin1" or whatever you are using
|
114
|
+
|
115
|
+
CapMailer.configure_capistrano_mailer do |config|
|
116
|
+
config[:recipient_addresses] = ["dev1@example.com"]
|
117
|
+
# 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.
|
118
|
+
# https://rails.lighthouseapp.com/projects/8994/tickets/2340
|
119
|
+
# Therefore %("Capistrano Deployment" <releases@example.com>) style addresses may not work in Rails 2.3.3
|
120
|
+
config[:sender_address] = "deployment@example.com"
|
121
|
+
config[:subject_prepend] = "[EMPTY-CAP-DEPLOY]"
|
122
|
+
config[:site_name] = "Empty Example.com App"
|
123
|
+
config[:email_content_type] = "text/html" # OR "text/plain" if you want the plain text version of the email
|
124
|
+
end
|
125
|
+
|
126
|
+
4. Add these two tasks to your deploy.rb:
|
127
|
+
|
128
|
+
namespace :show do
|
129
|
+
desc "Show some internal Cap-Fu: What's mah NAYM?!?"
|
130
|
+
task :me do
|
131
|
+
set :task_name, task_call_frames.first.task.fully_qualified_name
|
132
|
+
#puts "Running #{task_name} task"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
namespace :deploy do
|
137
|
+
...
|
138
|
+
|
139
|
+
desc "Send email notification of deployment (only send variables you want to be in the email)"
|
140
|
+
task :notify, :roles => :app do
|
141
|
+
show.me # this sets the task_name variable
|
142
|
+
mailer.send_notification_email(self)
|
143
|
+
end
|
144
|
+
|
145
|
+
...
|
146
|
+
end
|
147
|
+
|
148
|
+
Make _sure_ you've defined `rails_env`, `repository`, `deploy_to`, `host`, and `application`.
|
149
|
+
task_name is defined by the show:me task above, and the others are defined behind the scenes by Capistrano!
|
150
|
+
|
151
|
+
The only parameter to mailer.send_notification_email that is *required* is the first. _Minimally_ you need to define the capistrano variables:
|
152
|
+
:rails_env
|
153
|
+
:repository
|
154
|
+
:task_name (provided by the show:me task included in this readme)
|
155
|
+
:deploy_to
|
156
|
+
:host
|
157
|
+
:application
|
158
|
+
|
159
|
+
But there are tons of others - just take a look at lib/mailer/cap_mailer.rb.
|
160
|
+
|
161
|
+
If anyone has a cool way of recording the *output* into a capistrano accessible variable,
|
162
|
+
so that it can be shoved into the release email that would be an excellent contribution!
|
163
|
+
|
164
|
+
5. Then add the hook somewhere in your deploy.rb:
|
165
|
+
|
166
|
+
after "deploy", "deploy:notify"
|
167
|
+
|
168
|
+
6. Enjoy and Happy Capping!
|
169
|
+
|
170
|
+
7. Customization
|
171
|
+
|
172
|
+
If you want to use your own views you'll need to recreate the notification_email view:
|
173
|
+
First you need to define where your templates are:
|
174
|
+
|
175
|
+
CapMailer.configure_capistrano_mailer do |config|
|
176
|
+
config[:template_root] = "app/views/capistrano_mailer/"
|
177
|
+
end
|
178
|
+
|
179
|
+
Then you'll need to create templates there called:
|
180
|
+
notification_email.text.html.erb
|
181
|
+
and / or
|
182
|
+
notification_email.text.plain.erb
|
183
|
+
|
184
|
+
Take a look at the templates that comes with the plugin to see how it is done (views/cap_mailer/...)
|
185
|
+
|
186
|
+
|
187
|
+
----------------------------------------------------------------------------------
|
188
|
+
This plugin is a collaboration between Sagebit, LLC (http://www.sagebit.com) and Peter Boling (http://www.peterboling.com).
|
189
|
+
Written initially while Peter Boling was working at Sagebit for use in various projects.
|
190
|
+
|
191
|
+
Author: Peter Boling, peter.boling at gmail dot com
|
192
|
+
|
193
|
+
Copyright (c) 2009 Peter Boling of 9thBit LLC, released under the MIT license
|
194
|
+
Copyright (c) 2007-8 Sagebit LLC, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
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 = "textgoeshere-capistrano_mailer"
|
9
|
+
gemspec.summary = "Fork of Capistrano Deployment Email Notification"
|
10
|
+
gemspec.description = %q{Fork of Capistrano Deployment Email Notification. Keep the whole team informed of each release!}
|
11
|
+
gemspec.email = "dave@textgoeshere.org.uk"
|
12
|
+
gemspec.homepage = "http://github.com/textgoeshere/capistrano_mailer"
|
13
|
+
gemspec.authors = ["Peter Boling", "Dave Nolan"]
|
14
|
+
gemspec.add_dependency 'actionmailer'
|
15
|
+
gemspec.files = ["README.rdoc",
|
16
|
+
"capistrano_mailer.gemspec",
|
17
|
+
"init.rb",
|
18
|
+
"about.yml",
|
19
|
+
"lib/cap_mailer.rb",
|
20
|
+
"lib/capistrano/mailer.rb",
|
21
|
+
"Rakefile",
|
22
|
+
"views/cap_mailer/_section.html.erb",
|
23
|
+
"views/cap_mailer/_section.text.erb",
|
24
|
+
"views/cap_mailer/_section_custom.html.erb",
|
25
|
+
"views/cap_mailer/_section_custom.html.erb",
|
26
|
+
"views/cap_mailer/notification_email.text.html.erb",
|
27
|
+
"views/cap_mailer/notification_email.text.plain.erb",
|
28
|
+
"VERSION.yml"]
|
29
|
+
end
|
30
|
+
Jeweler::GemcutterTasks.new
|
31
|
+
rescue LoadError
|
32
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Default: run unit tests.'
|
36
|
+
task :default => :test
|
37
|
+
|
38
|
+
desc 'Test the capistrano_mailer gem.'
|
39
|
+
Rake::TestTask.new(:test) do |t|
|
40
|
+
t.libs << 'lib'
|
41
|
+
t.libs << 'test'
|
42
|
+
t.pattern = 'test/**/*_test.rb'
|
43
|
+
t.verbose = true
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Generate documentation for the capistrano_mailer gem.'
|
47
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = 'capistrano_mailer'
|
50
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
51
|
+
rdoc.rdoc_files.include('README.markdown')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION.yml
ADDED
data/about.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
author:
|
2
|
+
name: Peter Boling
|
3
|
+
homepage: http://www.peterboling.com
|
4
|
+
summary: Sends rails deployment notification emails from Capistrano
|
5
|
+
homepage: http://github.com/pboling/capistrano_mailer/tree/master
|
6
|
+
plugin: http://github.com/pboling/capistrano_mailer.git
|
7
|
+
license: MIT
|
8
|
+
version: 3.1.3
|
9
|
+
rails_version: 1.2.6+
|
data/init.rb
ADDED
data/lib/cap_mailer.rb
ADDED
@@ -0,0 +1,171 @@
|
|
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
|
+
self.template_root = default_base_config[:template_root]
|
25
|
+
|
26
|
+
def self.reloadable?() false end
|
27
|
+
|
28
|
+
def notification_email(cap, config = {}, *args)
|
29
|
+
@options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
|
30
|
+
@config = default_base_config.merge(config.reverse_merge({
|
31
|
+
:rails_env => cap.rails_env,
|
32
|
+
:host => cap.host,
|
33
|
+
:task_name => cap.task_name,
|
34
|
+
:application => cap.application,
|
35
|
+
:repository => cap.repository,
|
36
|
+
:scm => cap.scm,
|
37
|
+
:deploy_via => cap.deploy_via,
|
38
|
+
:deploy_to => cap.deploy_to,
|
39
|
+
:revision => cap.revision,
|
40
|
+
:real_revision => cap.real_revision,
|
41
|
+
:release_name => cap.release_name,
|
42
|
+
:version_dir => cap.version_dir,
|
43
|
+
:shared_dir => cap.shared_dir,
|
44
|
+
:current_dir => cap.current_dir,
|
45
|
+
:releases_path => cap.releases_path,
|
46
|
+
:shared_path => cap.shared_path,
|
47
|
+
:current_path => cap.current_path,
|
48
|
+
:release_path => cap.release_path,
|
49
|
+
:releases => cap.releases,
|
50
|
+
:current_release => cap.current_release,
|
51
|
+
:previous_release => cap.previous_release,
|
52
|
+
:current_revision => cap.current_revision,
|
53
|
+
:latest_revision => cap.latest_revision,
|
54
|
+
:previous_revision => cap.previous_revision,
|
55
|
+
:run_method => cap.run_method,
|
56
|
+
:latest_release => cap.latest_release,
|
57
|
+
:site_url => cap.site_url
|
58
|
+
}))
|
59
|
+
|
60
|
+
@date = Date.today.to_s
|
61
|
+
@time = Time.now.strftime("%I:%M %p").to_s
|
62
|
+
@inferred_command = "cap #{@config[:rails_env]} #{@config[:task_name]}"
|
63
|
+
@task_name = @config[:task_name] || "unknown"
|
64
|
+
|
65
|
+
repo = @config[:repository]
|
66
|
+
x = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
|
67
|
+
front = repo.slice(0..x)
|
68
|
+
back = repo.sub(front, '')
|
69
|
+
unless back == 'trunk'
|
70
|
+
x = front.include?('/') ? front.rindex('/') - 1 : front.length
|
71
|
+
front = front.slice(0..x)
|
72
|
+
end
|
73
|
+
@repo_end = repo.sub(front, '')
|
74
|
+
|
75
|
+
subject subject_line
|
76
|
+
recipients @config[:recipient_addresses]
|
77
|
+
from @config[:sender_address]
|
78
|
+
content_type @config[:email_content_type]
|
79
|
+
|
80
|
+
body body_data_hash
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def subject_line
|
86
|
+
config[:subject] || "[#{config[:application]}] #{inferred_command} by #{config[:user]}"
|
87
|
+
end
|
88
|
+
|
89
|
+
def body_data_hash
|
90
|
+
options[:data].merge({
|
91
|
+
:section_data => section_data_hash,
|
92
|
+
:date => date,
|
93
|
+
:time => time,
|
94
|
+
:task_name => task_name,
|
95
|
+
:inferred_command => inferred_command,
|
96
|
+
:repo_end => repo_end,
|
97
|
+
:site_name => config[:site_name],
|
98
|
+
:site_url => config[:site_url],
|
99
|
+
:application => config[:application],
|
100
|
+
:sections => config[:sections]
|
101
|
+
})
|
102
|
+
end
|
103
|
+
|
104
|
+
def section_data_hash
|
105
|
+
{
|
106
|
+
:deployment => section_hash_deployment,
|
107
|
+
:source_control => section_hash_source_control,
|
108
|
+
:latest_release => section_hash_latest_release,
|
109
|
+
:previous_release => section_hash_previous_release,
|
110
|
+
:other_deployment_info => section_hash_other_deployment_info,
|
111
|
+
:release_data => options[:release_data],
|
112
|
+
:extra_information => options[:extra_information]
|
113
|
+
}
|
114
|
+
end
|
115
|
+
|
116
|
+
def section_hash_deployment
|
117
|
+
{
|
118
|
+
:date => date,
|
119
|
+
:time => time,
|
120
|
+
:rails_env => config[:rails_env],
|
121
|
+
:task_name => task_name,
|
122
|
+
:inferred_command => inferred_command,
|
123
|
+
:host => config[:host],
|
124
|
+
:release_name => config[:release_name]
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
def section_hash_source_control
|
129
|
+
{
|
130
|
+
:revision => config[:revision],
|
131
|
+
:released => repo_end,
|
132
|
+
:repository => config[:repository],
|
133
|
+
:branch => config[:branch],
|
134
|
+
:scm => config[:scm],
|
135
|
+
:deploy_via => config[:deploy_via],
|
136
|
+
:deploy_to => config[:deploy_to]
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
def section_hash_latest_release
|
141
|
+
{
|
142
|
+
:latest_release => config[:latest_release],
|
143
|
+
:latest_revision => config[:latest_revision],
|
144
|
+
:release_path => config[:release_path],
|
145
|
+
:real_revision => config[:real_revision],
|
146
|
+
:current_path => config[:current_path]
|
147
|
+
}
|
148
|
+
end
|
149
|
+
|
150
|
+
def section_hash_previous_release
|
151
|
+
{
|
152
|
+
:current_release => config[:current_release],
|
153
|
+
:current_revision => config[:current_revision],
|
154
|
+
:previous_release => config[:previous_release],
|
155
|
+
:previous_revision => config[:previous_revision],
|
156
|
+
:releases => config[:releases]
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
def section_hash_other_deployment_info
|
161
|
+
{
|
162
|
+
:version_dir => config[:version_dir],
|
163
|
+
:shared_dir => config[:shared_dir],
|
164
|
+
:current_dir => config[:current_dir],
|
165
|
+
:releases_path => config[:releases_path],
|
166
|
+
:shared_path => config[:shared_path],
|
167
|
+
:run_method => config[:run_method],
|
168
|
+
:ip_address => config[:ip_address]
|
169
|
+
}
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems' unless defined?(Rubygems)
|
2
|
+
require 'capistrano' unless defined?(Capistrano)
|
3
|
+
require 'active_support'
|
4
|
+
|
5
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
6
|
+
abort "capistrano/mailer requires Capistrano 2"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'action_mailer' unless defined?(ActionMailer)
|
10
|
+
|
11
|
+
require 'cap_mailer' unless defined?(CapMailer)
|
12
|
+
|
13
|
+
|
14
|
+
module Capistrano
|
15
|
+
class Configuration
|
16
|
+
module CapistranoMailer
|
17
|
+
def send_notification_email(cap, config = {}, *args)
|
18
|
+
CapMailer.deliver_notification_email(cap, config, args)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
include CapistranoMailer
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Capistrano.plugin :mailer, Capistrano::Configuration::CapistranoMailer
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'yaml'
|
3
|
+
require 'rubygems/specification'
|
4
|
+
|
5
|
+
class BuildGemTest < Test::Unit::TestCase
|
6
|
+
def test_build_gem
|
7
|
+
data = File.read(File.join(File.dirname(__FILE__), '..', 'capistrano_mailer.gemspec'))
|
8
|
+
spec = nil
|
9
|
+
|
10
|
+
if data !~ %r{!ruby/object:Gem::Specification}
|
11
|
+
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
|
12
|
+
else
|
13
|
+
spec = YAML.load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
assert spec.validate
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +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]
|
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] : data[key].inspect %></span>
|
25
|
+
</p>
|
26
|
+
<% end -%>
|
27
|
+
<% end -%>
|
28
|
+
<% end -%>
|
29
|
+
<p style="clear:both"></p>
|
30
|
+
|
31
|
+
</div>
|
@@ -0,0 +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]
|
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 -%>
|
@@ -0,0 +1,15 @@
|
|
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;"><%= section_title.titleize unless section_title.nil? -%></h2>
|
4
|
+
<% if data.is_a?(Array) then data = data[0] end -%>
|
5
|
+
<% data.each do |key, value| -%>
|
6
|
+
<% if !key.nil? && !value.nil? -%>
|
7
|
+
<p style="margin: 10px; padding: 0px;">
|
8
|
+
<span style="float:left; width:150px; padding: 10px 10px 0;"><%= key %></span>
|
9
|
+
<span style="float:left; width:490px; padding: 10px 10px 0;"><%= value.is_a?(Array) ? value.to_sentence : value.is_a?(String) ? value : value.inspect%></span>
|
10
|
+
</p>
|
11
|
+
<% end -%>
|
12
|
+
<% end unless data.nil?-%>
|
13
|
+
<p style="clear:both"></p>
|
14
|
+
|
15
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
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
|
+
<p style="margin: 8px 0 20px 20px; padding: 0px; font-style: italic;" >
|
16
|
+
View site: <a href="<%= @site_url -%>"><%= @site_url -%></a>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<p style="margin: 10px 20px; font-weight: bold;">Released: <%= @date %> at <%= @time %></p>
|
20
|
+
|
21
|
+
<%= @sections.map { |section|
|
22
|
+
data = @section_data[section.to_sym]
|
23
|
+
if !data.empty?
|
24
|
+
if %w(extra_information release_data).include?(section)
|
25
|
+
render :partial => 'section_custom.html.erb', :locals => {:section_title => section, :data => data}
|
26
|
+
else
|
27
|
+
render :partial => 'section.html.erb', :locals => {:section_title => section, :data => data}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
}.join unless @sections.nil? %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<p style="margin: 8px 0 20px 20px; padding: 0px; font-style: italic;" >
|
34
|
+
Brought to you by: <a href="http://github.com/textgoeshere/capistrano_mailer">Capistrano Mailer</a>
|
35
|
+
</p>
|
36
|
+
</body>
|
37
|
+
</html>
|
@@ -0,0 +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 unless @sections.nil? %>
|
19
|
+
|
20
|
+
===========================================================
|
21
|
+
Copyright 2009 9thBit LLC under MIT License
|
22
|
+
Copyright 2007-8 Sagebit LLC under MIT License
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: textgoeshere-capistrano_mailer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Peter Boling
|
8
|
+
- Dave Nolan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2010-01-12 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: actionmailer
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
version:
|
26
|
+
description: Fork of Capistrano Deployment Email Notification. Keep the whole team informed of each release!
|
27
|
+
email: dave@textgoeshere.org.uk
|
28
|
+
executables: []
|
29
|
+
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files:
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- VERSION.yml
|
38
|
+
- about.yml
|
39
|
+
- init.rb
|
40
|
+
- lib/cap_mailer.rb
|
41
|
+
- lib/capistrano/mailer.rb
|
42
|
+
- views/cap_mailer/_section.html.erb
|
43
|
+
- views/cap_mailer/_section.text.erb
|
44
|
+
- views/cap_mailer/_section_custom.html.erb
|
45
|
+
- views/cap_mailer/notification_email.text.html.erb
|
46
|
+
- views/cap_mailer/notification_email.text.plain.erb
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://github.com/textgoeshere/capistrano_mailer
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --charset=UTF-8
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.5
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Fork of Capistrano Deployment Email Notification
|
75
|
+
test_files:
|
76
|
+
- test/build_gem_test.rb
|