capistrano_mailer_railsless 3.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +202 -0
- data/Rakefile +23 -0
- data/VERSION.yml +5 -0
- data/about.yml +8 -0
- data/capistrano_mailer_railsless.gemspec +35 -0
- data/init.rb +3 -0
- data/lib/cap_railsless_mailer.rb +162 -0
- data/lib/capistrano/railsless_mailer.rb +29 -0
- data/test/build_gem_test.rb +18 -0
- data/views/cap_railsless_mailer/_section.html.erb +31 -0
- data/views/cap_railsless_mailer/_section.text.erb +23 -0
- data/views/cap_railsless_mailer/_section_custom.html.erb +15 -0
- data/views/cap_railsless_mailer/_section_custom.text.erb +9 -0
- data/views/cap_railsless_mailer/notification_email.html.erb +36 -0
- data/views/cap_railsless_mailer/notification_email.text.erb +17 -0
- metadata +102 -0
data/README.rdoc
ADDED
@@ -0,0 +1,202 @@
|
|
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 (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
|
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 Capistrano 2.4.3 (might work with capistrano as old as 2.1.0, but has not been tested)
|
36
|
+
|
37
|
+
* Known to be compatible with SCMs as of version 3.1.2: Perforce, SVN, and Git
|
38
|
+
|
39
|
+
* Known to be compatible with, but does not require, the deprec gem.
|
40
|
+
|
41
|
+
== Installation
|
42
|
+
|
43
|
+
Gem Using Git building from source:
|
44
|
+
|
45
|
+
mkdir -p ~/src
|
46
|
+
cd ~/src
|
47
|
+
git clone git://github.com/pboling/capistrano_mailer.git
|
48
|
+
cd capistrano_mailer
|
49
|
+
gem build capistrano_mailer.gemspec
|
50
|
+
sudo gem install capistrano_mailer-3.1.6.gem # (Or whatever version gets built)
|
51
|
+
|
52
|
+
Gemcutter is the hot new gem host, and you can use it like this:
|
53
|
+
|
54
|
+
[sudo] gem install gemcutter
|
55
|
+
[sudo] gem tumble # makes gemcutter gem source first in line, if you haven't already
|
56
|
+
[sudo] gem install capistrano_mailer_railsless
|
57
|
+
|
58
|
+
Then cd to your rails app to optionally freeze the gem into your app:
|
59
|
+
|
60
|
+
rake gems:freeze GEM=capistrano_mailer
|
61
|
+
# You do NOT need to add a config.gem line to environment.rb for capistrano mailer,
|
62
|
+
# But in order to use the gems:freeze task you DO need to add it as a config.gem, at least temporarily.
|
63
|
+
|
64
|
+
Plugin using Git:
|
65
|
+
|
66
|
+
# Installation as plugin works... but the setup is slightly different. (See Usage below)
|
67
|
+
./script/plugin install git://github.com/3crowd/capistrano_mailer_railsless.git
|
68
|
+
|
69
|
+
== Usage
|
70
|
+
|
71
|
+
1. Install as gem or plugin. You need to have already setup capistrano in the project, including the 'capify .' command.
|
72
|
+
|
73
|
+
2. Add this line to the top of your config/deploy.rb:
|
74
|
+
|
75
|
+
# For plugin:
|
76
|
+
# You must make capistrano_mailer's libraries available in Ruby's load path. This is one way to do that:
|
77
|
+
# Add to the top of your config/deploy.rb file:
|
78
|
+
$:.unshift 'vendor/plugins/capistrano_mailer/lib'
|
79
|
+
|
80
|
+
# For frozen gem:
|
81
|
+
# You must make capistrano_mailer's libraries available in Ruby's load path. This is one way to do that:
|
82
|
+
# Add to the top of your config/deploy.rb file:
|
83
|
+
$:.unshift 'vendor/gems/capistrano_mailer-x.x.x/lib'
|
84
|
+
|
85
|
+
# then for gem or plugin:
|
86
|
+
####################################
|
87
|
+
# Capistrano Plugins go here
|
88
|
+
require 'capistrano/mailer'
|
89
|
+
#configure capistrano_mailer:
|
90
|
+
# The configuration file can go anywhere, but in past versions of the gem it was required to be in the config/ dir.
|
91
|
+
require 'config/cap_mailer_settings'
|
92
|
+
####################################
|
93
|
+
|
94
|
+
3. Configure Caistrano Mailer in the settings file required in step 2:
|
95
|
+
|
96
|
+
# If installed as a plugin might need the require here as well
|
97
|
+
|
98
|
+
ActionMailer::Base.delivery_method = :smtp # or :sendmail, or whatever
|
99
|
+
ActionMailer::Base.smtp_settings = { # if using :smtp
|
100
|
+
:address => "mail.example.com",
|
101
|
+
:port => 25,
|
102
|
+
:domain => 'default.com',
|
103
|
+
:perform_deliveries => true,
|
104
|
+
:user_name => "releases@example.com",
|
105
|
+
:password => "mypassword",
|
106
|
+
:authentication => :login }
|
107
|
+
ActionMailer::Base.default_charset = "utf-8"# or "latin1" or whatever you are using
|
108
|
+
|
109
|
+
CapMailer.configure do |config|
|
110
|
+
config[:recipient_addresses] = ["dev1@example.com"]
|
111
|
+
# 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.
|
112
|
+
# https://rails.lighthouseapp.com/projects/8994/tickets/2340
|
113
|
+
# Therefore %("Capistrano Deployment" <releases@example.com>) style addresses may not work in Rails 2.3.3
|
114
|
+
config[:sender_address] = "deployment@example.com"
|
115
|
+
config[:subject_prepend] = "[EMPTY-CAP-DEPLOY]"
|
116
|
+
config[:site_name] = "Empty Example.com App"
|
117
|
+
config[:email_content_type] = "text/html" # OR "text/plain" if you want the plain text version of the email
|
118
|
+
end
|
119
|
+
|
120
|
+
4. Add these two tasks to your deploy.rb:
|
121
|
+
|
122
|
+
namespace :show do
|
123
|
+
desc "Show some internal Cap-Fu: What's mah NAYM?!?"
|
124
|
+
task :me do
|
125
|
+
set :task_name, task_call_frames.first.task.fully_qualified_name
|
126
|
+
#puts "Running #{task_name} task"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
namespace :deploy do
|
131
|
+
...
|
132
|
+
|
133
|
+
desc "Send email notification of deployment (only send variables you want to be in the email)"
|
134
|
+
task :notify, :roles => :app do
|
135
|
+
show.me # this sets the task_name variable
|
136
|
+
mailer.send_notification_email(self)
|
137
|
+
end
|
138
|
+
|
139
|
+
...
|
140
|
+
end
|
141
|
+
|
142
|
+
Make _sure_ you've defined `rails_env`, `repository`, `deploy_to`, `host`, and `application`.
|
143
|
+
task_name is defined by the show:me task above, and the others are defined behind the scenes by Capistrano!
|
144
|
+
|
145
|
+
The only parameter to mailer.send_notification_email that is *required* is the first. _Minimally_ you need to define the capistrano variables:
|
146
|
+
:rails_env
|
147
|
+
:repository
|
148
|
+
:task_name (provided by the show:me task included in this readme)
|
149
|
+
:deploy_to
|
150
|
+
:host
|
151
|
+
:application
|
152
|
+
|
153
|
+
But there are tons of others - just take a look at lib/mailer/cap_mailer.rb.
|
154
|
+
|
155
|
+
If anyone has a cool way of recording the *output* into a capistrano accessible variable,
|
156
|
+
so that it can be shoved into the release email that would be an excellent contribution!
|
157
|
+
|
158
|
+
5. Then add the hook somewhere in your deploy.rb:
|
159
|
+
|
160
|
+
after "deploy", "deploy:notify"
|
161
|
+
|
162
|
+
6. Enjoy and Happy Capping!
|
163
|
+
|
164
|
+
7. Customization
|
165
|
+
|
166
|
+
If you want to use your own views you'll need to recreate the notification_email view:
|
167
|
+
First you need to define where your templates are:
|
168
|
+
|
169
|
+
CapMailer.configure_capistrano_mailer do |config|
|
170
|
+
config[:template_root] = "app/views/capistrano_mailer/"
|
171
|
+
end
|
172
|
+
|
173
|
+
Then you'll need to create templates there called:
|
174
|
+
notification_email.text.html.erb
|
175
|
+
and / or
|
176
|
+
notification_email.text.plain.erb
|
177
|
+
|
178
|
+
Take a look at the templates that comes with the plugin to see how it is done (views/cap_mailer/...)
|
179
|
+
|
180
|
+
== Authors
|
181
|
+
|
182
|
+
Peter Boling (pboling) - Wrote original
|
183
|
+
Dave Nolan (textgoeshere) - lots of refactoring merged into 3.2 release
|
184
|
+
Justin Lynn - removed rails specificity and defaults from codebase
|
185
|
+
|
186
|
+
== Contributors
|
187
|
+
|
188
|
+
Dustin Deyoung - HTML Email Templates
|
189
|
+
mixonix - SCMs compatibility
|
190
|
+
greut - SCMs compatibility
|
191
|
+
|
192
|
+
----------------------------------------------------------------------------------
|
193
|
+
Modified by Justin Lynn to no longer require Rails, 3Crowd Technologies, Inc. (http://www.3crowd.com).
|
194
|
+
|
195
|
+
This plugin is a collaboration between Sagebit, LLC (http://www.sagebit.com) and Peter Boling (http://www.peterboling.com).
|
196
|
+
Written initially while Peter Boling was working at Sagebit for use in various projects.
|
197
|
+
|
198
|
+
Author: Peter Boling, peter.boling at gmail dot com
|
199
|
+
|
200
|
+
Copyright (c) 2010 3Crowd Technologies, Inc. released under the MIT license
|
201
|
+
Copyright (c) 2009 Peter Boling of 9thBit LLC, released under the MIT license
|
202
|
+
Copyright (c) 2007-8 Sagebit LLC, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the capistrano_mailer gem.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'test'
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate documentation for the capistrano_mailer gem.'
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
19
|
+
rdoc.title = 'capistrano_mailer'
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
+
rdoc.rdoc_files.include('README.markdown')
|
22
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
+
end
|
data/VERSION.yml
ADDED
data/about.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
author:
|
2
|
+
name: 3Crowd Technologies, Justin Lynn, Peter Boling
|
3
|
+
homepage: http://www.3crowd.com, http://www.peterboling.com
|
4
|
+
summary: Sends rails deployment notification emails from Capistrano without Rails Requirments
|
5
|
+
homepage: http://github.com/3crowd/capistrano_mailer_railsless/tree/master
|
6
|
+
plugin: http://github.com/3crowd/capistrano_mailer_railsless.git
|
7
|
+
license: MIT
|
8
|
+
version: 3.2.1
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "capistrano_mailer_railsless"
|
3
|
+
s.version = "3.2.6"
|
4
|
+
|
5
|
+
s.authors = ["3Crowd Technologies, Inc.", "Justin Lynn", "Peter Boling", "Dave Nolan"]
|
6
|
+
|
7
|
+
s.date = %q{2010-04-29}
|
8
|
+
|
9
|
+
s.description = %q{Capistrano Deployment Email Notification without Rails. Keep the whole team informed of each release! Graciously derived from capistrano_mailer.}
|
10
|
+
|
11
|
+
s.email = ["eng@3crowd.com"]
|
12
|
+
|
13
|
+
s.extra_rdoc_files = [
|
14
|
+
"README.rdoc"
|
15
|
+
]
|
16
|
+
|
17
|
+
s.files = Dir.glob("{lib,views}/**/*") + %w(README.rdoc Rakefile VERSION.yml about.yml capistrano_mailer_railsless.gemspec init.rb)
|
18
|
+
|
19
|
+
s.homepage = %q{http://github.com/3crowd/capistrano_mailer_railsless}
|
20
|
+
|
21
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
22
|
+
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
|
25
|
+
s.summary = %q{Capistrano Deployment Email Notification, not requiring Rails}
|
26
|
+
|
27
|
+
s.test_files = [
|
28
|
+
"test/build_gem_test.rb"
|
29
|
+
]
|
30
|
+
|
31
|
+
s.add_dependency('actionmailer', '>=3.0.0')
|
32
|
+
s.required_rubygems_version = ">= 1.3.6"
|
33
|
+
|
34
|
+
end
|
35
|
+
|
data/init.rb
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
class CapRailslessMailer < ActionMailer::Base
|
2
|
+
|
3
|
+
@@default_base_config ||= {
|
4
|
+
:sender_address => %("Capistrano Deployment" <capistrano.mailer@example.com>),
|
5
|
+
:recipient_addresses => [],
|
6
|
+
# Customize the subject line
|
7
|
+
:subject_prepend => "[DEPLOYMENT] ",
|
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
|
+
:format => :html,
|
13
|
+
:view_path => "#{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
|
+
|
23
|
+
self.view_paths = [default_base_config[:view_path]]
|
24
|
+
|
25
|
+
default :format => default_base_config[:format].to_s
|
26
|
+
default :from => default_base_config[:sender_address]
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.reloadable?() false end
|
30
|
+
|
31
|
+
def notification_email(cap, config = {}, *args)
|
32
|
+
@options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
|
33
|
+
@config = default_base_config.merge(config.reverse_merge({
|
34
|
+
:task_name => cap.task_name,
|
35
|
+
:application => cap.application,
|
36
|
+
:repository => cap.repository,
|
37
|
+
:scm => cap.scm,
|
38
|
+
:deploy_via => cap.deploy_via,
|
39
|
+
:deploy_to => cap.deploy_to,
|
40
|
+
:revision => cap.revision,
|
41
|
+
:real_revision => cap.real_revision,
|
42
|
+
:release_name => cap.release_name,
|
43
|
+
:version_dir => cap.version_dir,
|
44
|
+
:shared_dir => cap.shared_dir,
|
45
|
+
:current_dir => cap.current_dir,
|
46
|
+
:releases_path => cap.releases_path,
|
47
|
+
:shared_path => cap.shared_path,
|
48
|
+
:current_path => cap.current_path,
|
49
|
+
:release_path => cap.release_path,
|
50
|
+
:releases => cap.releases,
|
51
|
+
:current_release => cap.current_release,
|
52
|
+
:previous_release => cap.previous_release,
|
53
|
+
:current_revision => cap.current_revision,
|
54
|
+
:latest_revision => cap.latest_revision,
|
55
|
+
:previous_revision => cap.previous_revision,
|
56
|
+
:run_method => cap.run_method,
|
57
|
+
:latest_release => cap.latest_release
|
58
|
+
}))
|
59
|
+
|
60
|
+
@date = Date.today.to_s
|
61
|
+
@time = Time.now.strftime("%I:%M %p").to_s
|
62
|
+
@inferred_command = "cap #{@config[:task_name]}"
|
63
|
+
@task_name = @config[:task_name] || "unknown"
|
64
|
+
@site_name = @config[:site_name]
|
65
|
+
@sections = @config[:sections]
|
66
|
+
@section_data = section_data_hash
|
67
|
+
@site_url = @config[:site_url]
|
68
|
+
@application = @config[:application]
|
69
|
+
@repo_end = repo_end
|
70
|
+
|
71
|
+
mail(:to => @config[:recipient_addresses], :subject => subject_line)
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def repo_end
|
77
|
+
repo = @config[:repository]
|
78
|
+
x = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
|
79
|
+
front = repo.slice(0..x)
|
80
|
+
back = repo.sub(front, '')
|
81
|
+
unless back == 'trunk'
|
82
|
+
x = front.include?('/') ? front.rindex('/') - 1 : front.length
|
83
|
+
front = front.slice(0..x)
|
84
|
+
end
|
85
|
+
|
86
|
+
repo.sub(front, '')
|
87
|
+
end
|
88
|
+
|
89
|
+
def subject_line
|
90
|
+
#The subject prepend and append are useful for people to setup filters in mail clients.
|
91
|
+
user = config[:user] ? " by #{config[:user]}" : ""
|
92
|
+
middle = config[:subject] ? config[:subject] : "[#{repo_end}] #{inferred_command}#{user}"
|
93
|
+
"#{config[:subject_prepend]}#{middle}#{config[:subject_append]}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def section_data_hash
|
97
|
+
{
|
98
|
+
:deployment => section_hash_deployment,
|
99
|
+
:source_control => section_hash_source_control,
|
100
|
+
:latest_release => section_hash_latest_release,
|
101
|
+
:previous_release => section_hash_previous_release,
|
102
|
+
:other_deployment_info => section_hash_other_deployment_info,
|
103
|
+
:release_data => options[:release_data],
|
104
|
+
:extra_information => options[:extra_information]
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
def section_hash_deployment
|
109
|
+
{
|
110
|
+
:date => date,
|
111
|
+
:time => time,
|
112
|
+
:task_name => task_name,
|
113
|
+
:inferred_command => inferred_command,
|
114
|
+
:host => config[:host],
|
115
|
+
:release_name => config[:release_name]
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
def section_hash_source_control
|
120
|
+
{
|
121
|
+
:revision => config[:revision],
|
122
|
+
:released => repo_end,
|
123
|
+
:repository => config[:repository],
|
124
|
+
:branch => config[:branch],
|
125
|
+
:scm => config[:scm],
|
126
|
+
:deploy_via => config[:deploy_via],
|
127
|
+
:deploy_to => config[:deploy_to]
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
131
|
+
def section_hash_latest_release
|
132
|
+
{
|
133
|
+
:latest_release => config[:latest_release],
|
134
|
+
:latest_revision => config[:latest_revision],
|
135
|
+
:release_path => config[:release_path],
|
136
|
+
:real_revision => config[:real_revision],
|
137
|
+
:current_path => config[:current_path]
|
138
|
+
}
|
139
|
+
end
|
140
|
+
|
141
|
+
def section_hash_previous_release
|
142
|
+
{
|
143
|
+
:current_release => config[:current_release],
|
144
|
+
:current_revision => config[:current_revision],
|
145
|
+
:previous_release => config[:previous_release],
|
146
|
+
:previous_revision => config[:previous_revision],
|
147
|
+
:releases => config[:releases]
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
151
|
+
def section_hash_other_deployment_info
|
152
|
+
{
|
153
|
+
:version_dir => config[:version_dir],
|
154
|
+
:shared_dir => config[:shared_dir],
|
155
|
+
:current_dir => config[:current_dir],
|
156
|
+
:releases_path => config[:releases_path],
|
157
|
+
:shared_path => config[:shared_path],
|
158
|
+
:run_method => config[:run_method],
|
159
|
+
:ip_address => config[:ip_address]
|
160
|
+
}
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems' unless defined?(Rubygems)
|
2
|
+
require 'capistrano' unless defined?(Capistrano)
|
3
|
+
|
4
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
5
|
+
abort "capistrano/railsless_mailer requires Capistrano 2"
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'action_mailer' unless defined?(ActionMailer)
|
9
|
+
|
10
|
+
require 'cap_railsless_mailer' unless defined?(CapRailslessMailer)
|
11
|
+
|
12
|
+
|
13
|
+
module Capistrano
|
14
|
+
class Configuration
|
15
|
+
module RailslessCapistranoMailer
|
16
|
+
def send_notification_email(cap, config = {}, *args)
|
17
|
+
if CapRailslessMailer.respond_to? :notification_email
|
18
|
+
CapRailslessMailer.notification_email(cap, config, args).deliver
|
19
|
+
else
|
20
|
+
CapRailslessMailer.deliver_notification_email(cap, config, args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
include RailslessCapistranoMailer
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Capistrano.plugin :railsless_mailer, Capistrano::Configuration::RailslessCapistranoMailer
|
@@ -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_railsless.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,9 @@
|
|
1
|
+
<%= section_title.titleize unless section_title.nil? -%>
|
2
|
+
===========================================================
|
3
|
+
|
4
|
+
<% if data.is_a?(Array) then data = data[0] end -%>
|
5
|
+
<% data.each do |key, value| -%>
|
6
|
+
<% if !key.nil? && !value.nil? -%>
|
7
|
+
<%= key %> <%= value.is_a?(Array) ? value.to_sentence : value.is_a?(String) ? value : value.inspect%>
|
8
|
+
<% end -%>
|
9
|
+
<% end unless data.nil?-%>
|
@@ -0,0 +1,36 @@
|
|
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 -%>"><%= @site_url -%></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
|
+
</body>
|
36
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= @site_name %> Notification
|
2
|
+
===========================================================
|
3
|
+
|
4
|
+
<%= @site_name %> <%=@task_name.titleize unless @task_name.nil? %>
|
5
|
+
===========================================================
|
6
|
+
Released: <%= @date %> at <%= @time %>
|
7
|
+
|
8
|
+
<% @sections.each do |section| %>
|
9
|
+
<% data = @section_data[section.to_sym] %>
|
10
|
+
<% if !data.empty? %>
|
11
|
+
<% if %w(extra_information release_data).include?(section) %>
|
12
|
+
<%= render :partial => 'section_custom.text.erb', :locals => {:section_title => section, :data => data} %>
|
13
|
+
<% else %>
|
14
|
+
<%= render :partial => 'section.text.erb', :locals => {:section_title => section, :data => data} %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<% end unless @sections.nil? %>
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano_mailer_railsless
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 3
|
8
|
+
- 2
|
9
|
+
- 6
|
10
|
+
version: 3.2.6
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- 3Crowd Technologies, Inc.
|
14
|
+
- Justin Lynn
|
15
|
+
- Peter Boling
|
16
|
+
- Dave Nolan
|
17
|
+
autorequire:
|
18
|
+
bindir: bin
|
19
|
+
cert_chain: []
|
20
|
+
|
21
|
+
date: 2010-04-29 00:00:00 -07:00
|
22
|
+
default_executable:
|
23
|
+
dependencies:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: actionmailer
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
hash: 7
|
33
|
+
segments:
|
34
|
+
- 3
|
35
|
+
- 0
|
36
|
+
- 0
|
37
|
+
version: 3.0.0
|
38
|
+
type: :runtime
|
39
|
+
version_requirements: *id001
|
40
|
+
description: Capistrano Deployment Email Notification without Rails. Keep the whole team informed of each release! Graciously derived from capistrano_mailer.
|
41
|
+
email:
|
42
|
+
- eng@3crowd.com
|
43
|
+
executables: []
|
44
|
+
|
45
|
+
extensions: []
|
46
|
+
|
47
|
+
extra_rdoc_files:
|
48
|
+
- README.rdoc
|
49
|
+
files:
|
50
|
+
- lib/capistrano/railsless_mailer.rb
|
51
|
+
- lib/cap_railsless_mailer.rb
|
52
|
+
- views/cap_railsless_mailer/_section.html.erb
|
53
|
+
- views/cap_railsless_mailer/_section_custom.text.erb
|
54
|
+
- views/cap_railsless_mailer/notification_email.text.erb
|
55
|
+
- views/cap_railsless_mailer/_section_custom.html.erb
|
56
|
+
- views/cap_railsless_mailer/_section.text.erb
|
57
|
+
- views/cap_railsless_mailer/notification_email.html.erb
|
58
|
+
- README.rdoc
|
59
|
+
- Rakefile
|
60
|
+
- VERSION.yml
|
61
|
+
- about.yml
|
62
|
+
- capistrano_mailer_railsless.gemspec
|
63
|
+
- init.rb
|
64
|
+
- test/build_gem_test.rb
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: http://github.com/3crowd/capistrano_mailer_railsless
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --charset=UTF-8
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 23
|
89
|
+
segments:
|
90
|
+
- 1
|
91
|
+
- 3
|
92
|
+
- 6
|
93
|
+
version: 1.3.6
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 1.3.7
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Capistrano Deployment Email Notification, not requiring Rails
|
101
|
+
test_files:
|
102
|
+
- test/build_gem_test.rb
|