capistrano_mailer 3.2.5 → 3.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +21 -0
- data/README.rdoc +198 -218
- data/Rakefile +52 -53
- data/VERSION.yml +3 -3
- data/capistrano_mailer.gemspec +55 -55
- data/lib/cap_mailer.rb +180 -180
- data/lib/capistrano/mailer.rb +25 -25
- data/views/cap_mailer/_section.html.erb +31 -31
- data/views/cap_mailer/_section.text.erb +23 -23
- data/views/cap_mailer/_section_custom.text.erb +9 -0
- data/views/cap_mailer/notification_email.text.html.erb +39 -39
- data/views/cap_mailer/notification_email.text.plain.erb +22 -22
- metadata +39 -54
- data/about.yml +0 -9
- data/init.rb +0 -3
- data/test/build_gem_test.rb +0 -18
data/capistrano_mailer.gemspec
CHANGED
@@ -1,55 +1,55 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{capistrano_mailer}
|
8
|
-
s.version = "3.2.5"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Peter Boling", "Dave Nolan"]
|
12
|
-
s.date = %q{2010-04-29}
|
13
|
-
s.description = %q{Capistrano Deployment Email Notification. Keep the whole team informed of each release!}
|
14
|
-
s.email = ["peter.boling@gmail.com", "dave@textgoeshere.org.uk"]
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"README.rdoc",
|
20
|
-
"Rakefile",
|
21
|
-
"VERSION.yml",
|
22
|
-
"about.yml",
|
23
|
-
"capistrano_mailer.gemspec",
|
24
|
-
"init.rb",
|
25
|
-
"lib/cap_mailer.rb",
|
26
|
-
"lib/capistrano/mailer.rb",
|
27
|
-
"views/cap_mailer/_section.html.erb",
|
28
|
-
"views/cap_mailer/_section.text.erb",
|
29
|
-
"views/cap_mailer/_section_custom.html.erb",
|
30
|
-
"views/cap_mailer/notification_email.text.html.erb",
|
31
|
-
"views/cap_mailer/notification_email.text.plain.erb"
|
32
|
-
]
|
33
|
-
s.homepage = %q{http://github.com/pboling/capistrano_mailer}
|
34
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
-
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.6}
|
37
|
-
s.summary = %q{Capistrano Deployment Email Notification}
|
38
|
-
s.test_files = [
|
39
|
-
"test/build_gem_test.rb"
|
40
|
-
]
|
41
|
-
|
42
|
-
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
-
s.specification_version = 3
|
45
|
-
|
46
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<actionmailer>, [">= 0"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<actionmailer>, [">= 0"])
|
50
|
-
end
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<actionmailer>, [">= 0"])
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{capistrano_mailer}
|
8
|
+
s.version = "3.2.5"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Peter Boling", "Dave Nolan"]
|
12
|
+
s.date = %q{2010-04-29}
|
13
|
+
s.description = %q{Capistrano Deployment Email Notification. Keep the whole team informed of each release!}
|
14
|
+
s.email = ["peter.boling@gmail.com", "dave@textgoeshere.org.uk"]
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION.yml",
|
22
|
+
"about.yml",
|
23
|
+
"capistrano_mailer.gemspec",
|
24
|
+
"init.rb",
|
25
|
+
"lib/cap_mailer.rb",
|
26
|
+
"lib/capistrano/mailer.rb",
|
27
|
+
"views/cap_mailer/_section.html.erb",
|
28
|
+
"views/cap_mailer/_section.text.erb",
|
29
|
+
"views/cap_mailer/_section_custom.html.erb",
|
30
|
+
"views/cap_mailer/notification_email.text.html.erb",
|
31
|
+
"views/cap_mailer/notification_email.text.plain.erb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/pboling/capistrano_mailer}
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.6}
|
37
|
+
s.summary = %q{Capistrano Deployment Email Notification}
|
38
|
+
s.test_files = [
|
39
|
+
"test/build_gem_test.rb"
|
40
|
+
]
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<actionmailer>, [">= 0"])
|
48
|
+
else
|
49
|
+
s.add_dependency(%q<actionmailer>, [">= 0"])
|
50
|
+
end
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<actionmailer>, [">= 0"])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
data/lib/cap_mailer.rb
CHANGED
@@ -1,180 +1,180 @@
|
|
1
|
-
class CapMailer < ActionMailer::Base
|
2
|
-
|
3
|
-
@@default_base_config ||= {
|
4
|
-
:sender_address => %("#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")} Capistrano Deployment" <capistrano.mailer@example.com>),
|
5
|
-
:recipient_addresses => [],
|
6
|
-
# Customize the subject line
|
7
|
-
:subject_prepend => "[DEPLOYMENT]-[#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")}] ",
|
8
|
-
:subject_append => nil,
|
9
|
-
# Include which sections of the deployment email?
|
10
|
-
:sections => %w(deployment release_data source_control latest_release previous_release other_deployment_info extra_information),
|
11
|
-
:site_name => "",
|
12
|
-
:email_content_type => "text/html",
|
13
|
-
:template_root => "#{File.dirname(__FILE__)}/../views"
|
14
|
-
}
|
15
|
-
|
16
|
-
cattr_accessor :default_base_config
|
17
|
-
attr_accessor :config, :options
|
18
|
-
attr_accessor :date, :time, :inferred_command, :task_name, :repo_end
|
19
|
-
|
20
|
-
def self.configure(&block)
|
21
|
-
yield @@default_base_config
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.configure_capistrano_mailer(&block)
|
25
|
-
puts "Deprecated 'configure_capistrano_mailer'. Please update your capistrano_mailer configuration to use 'configure' instead of 'configure_capistrano_mailer'"
|
26
|
-
end
|
27
|
-
|
28
|
-
self.template_root = default_base_config[:template_root]
|
29
|
-
|
30
|
-
def self.reloadable?() false end
|
31
|
-
|
32
|
-
def notification_email(cap, config = {}, *args)
|
33
|
-
@options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
|
34
|
-
@config = default_base_config.merge(config.reverse_merge({
|
35
|
-
:rails_env => cap.rails_env,
|
36
|
-
:host => cap.host,
|
37
|
-
:task_name => cap.task_name,
|
38
|
-
:application => cap.application,
|
39
|
-
:repository => cap.repository,
|
40
|
-
:scm => cap.scm,
|
41
|
-
:deploy_via => cap.deploy_via,
|
42
|
-
:deploy_to => cap.deploy_to,
|
43
|
-
:revision => cap.revision,
|
44
|
-
:real_revision => cap.real_revision,
|
45
|
-
:release_name => cap.release_name,
|
46
|
-
:version_dir => cap.version_dir,
|
47
|
-
:shared_dir => cap.shared_dir,
|
48
|
-
:current_dir => cap.current_dir,
|
49
|
-
:releases_path => cap.releases_path,
|
50
|
-
:shared_path => cap.shared_path,
|
51
|
-
:current_path => cap.current_path,
|
52
|
-
:release_path => cap.release_path,
|
53
|
-
:releases => cap.releases,
|
54
|
-
:current_release => cap.current_release,
|
55
|
-
:previous_release => cap.previous_release,
|
56
|
-
:current_revision => cap.current_revision,
|
57
|
-
:latest_revision => cap.latest_revision,
|
58
|
-
:previous_revision => cap.previous_revision,
|
59
|
-
:run_method => cap.run_method,
|
60
|
-
:latest_release => cap.latest_release
|
61
|
-
|
62
|
-
#This does not appear to be a capistrano variable:
|
63
|
-
#:site_url => cap.site_url
|
64
|
-
}))
|
65
|
-
|
66
|
-
@date = Date.today.to_s
|
67
|
-
@time = Time.now.strftime("%I:%M %p").to_s
|
68
|
-
@inferred_command = "cap #{@config[:rails_env]} #{@config[:task_name]}"
|
69
|
-
@task_name = @config[:task_name] || "unknown"
|
70
|
-
|
71
|
-
repo = @config[:repository]
|
72
|
-
x = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
|
73
|
-
front = repo.slice(0..x)
|
74
|
-
back = repo.sub(front, '')
|
75
|
-
unless back == 'trunk'
|
76
|
-
x = front.include?('/') ? front.rindex('/') - 1 : front.length
|
77
|
-
front = front.slice(0..x)
|
78
|
-
end
|
79
|
-
@repo_end = repo.sub(front, '')
|
80
|
-
|
81
|
-
subject subject_line
|
82
|
-
recipients @config[:recipient_addresses]
|
83
|
-
from @config[:sender_address]
|
84
|
-
content_type @config[:email_content_type]
|
85
|
-
|
86
|
-
body body_data_hash
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def subject_line
|
92
|
-
#The subject prepend and append are useful for people to setup filters in mail clients.
|
93
|
-
user = config[:user] ? " by #{config[:user]}" : ""
|
94
|
-
middle = config[:subject] ? config[:subject] : "[#{config[:rails_env].upcase}][#{repo_end}] #{inferred_command}#{user}"
|
95
|
-
"#{config[:subject_prepend]}#{middle}#{config[:subject_append]}"
|
96
|
-
end
|
97
|
-
|
98
|
-
def body_data_hash
|
99
|
-
options[:data].merge({
|
100
|
-
:section_data => section_data_hash,
|
101
|
-
:date => date,
|
102
|
-
:time => time,
|
103
|
-
:task_name => task_name,
|
104
|
-
:inferred_command => inferred_command,
|
105
|
-
:repo_end => repo_end,
|
106
|
-
:site_name => config[:site_name],
|
107
|
-
:site_url => config[:site_url],
|
108
|
-
:application => config[:application],
|
109
|
-
:sections => config[:sections]
|
110
|
-
})
|
111
|
-
end
|
112
|
-
|
113
|
-
def section_data_hash
|
114
|
-
{
|
115
|
-
:deployment => section_hash_deployment,
|
116
|
-
:source_control => section_hash_source_control,
|
117
|
-
:latest_release => section_hash_latest_release,
|
118
|
-
:previous_release => section_hash_previous_release,
|
119
|
-
:other_deployment_info => section_hash_other_deployment_info,
|
120
|
-
:release_data => options[:release_data],
|
121
|
-
:extra_information => options[:extra_information]
|
122
|
-
}
|
123
|
-
end
|
124
|
-
|
125
|
-
def section_hash_deployment
|
126
|
-
{
|
127
|
-
:date => date,
|
128
|
-
:time => time,
|
129
|
-
:rails_env => config[:rails_env],
|
130
|
-
:task_name => task_name,
|
131
|
-
:inferred_command => inferred_command,
|
132
|
-
:host => config[:host],
|
133
|
-
:release_name => config[:release_name]
|
134
|
-
}
|
135
|
-
end
|
136
|
-
|
137
|
-
def section_hash_source_control
|
138
|
-
{
|
139
|
-
:revision => config[:revision],
|
140
|
-
:released => repo_end,
|
141
|
-
:repository => config[:repository],
|
142
|
-
:branch => config[:branch],
|
143
|
-
:scm => config[:scm],
|
144
|
-
:deploy_via => config[:deploy_via],
|
145
|
-
:deploy_to => config[:deploy_to]
|
146
|
-
}
|
147
|
-
end
|
148
|
-
|
149
|
-
def section_hash_latest_release
|
150
|
-
{
|
151
|
-
:latest_release => config[:latest_release],
|
152
|
-
:latest_revision => config[:latest_revision],
|
153
|
-
:release_path => config[:release_path],
|
154
|
-
:real_revision => config[:real_revision],
|
155
|
-
:current_path => config[:current_path]
|
156
|
-
}
|
157
|
-
end
|
158
|
-
|
159
|
-
def section_hash_previous_release
|
160
|
-
{
|
161
|
-
:current_release => config[:current_release],
|
162
|
-
:current_revision => config[:current_revision],
|
163
|
-
:previous_release => config[:previous_release],
|
164
|
-
:previous_revision => config[:previous_revision],
|
165
|
-
:releases => config[:releases]
|
166
|
-
}
|
167
|
-
end
|
168
|
-
|
169
|
-
def section_hash_other_deployment_info
|
170
|
-
{
|
171
|
-
:version_dir => config[:version_dir],
|
172
|
-
:shared_dir => config[:shared_dir],
|
173
|
-
:current_dir => config[:current_dir],
|
174
|
-
:releases_path => config[:releases_path],
|
175
|
-
:shared_path => config[:shared_path],
|
176
|
-
:run_method => config[:run_method],
|
177
|
-
:ip_address => config[:ip_address]
|
178
|
-
}
|
179
|
-
end
|
180
|
-
end
|
1
|
+
class CapMailer < ActionMailer::Base
|
2
|
+
|
3
|
+
@@default_base_config ||= {
|
4
|
+
:sender_address => %("#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")} Capistrano Deployment" <capistrano.mailer@example.com>),
|
5
|
+
:recipient_addresses => [],
|
6
|
+
# Customize the subject line
|
7
|
+
:subject_prepend => "[DEPLOYMENT]-[#{(defined?(Rails) ? Rails.env.capitalize : defined?(RAILS_ENV) ? RAILS_ENV.capitalize : defined?(ENV) ? ENV['RAILS_ENV'] : "")}] ",
|
8
|
+
:subject_append => nil,
|
9
|
+
# Include which sections of the deployment email?
|
10
|
+
:sections => %w(deployment release_data source_control latest_release previous_release other_deployment_info extra_information),
|
11
|
+
:site_name => "",
|
12
|
+
:email_content_type => "text/html",
|
13
|
+
:template_root => "#{File.dirname(__FILE__)}/../views"
|
14
|
+
}
|
15
|
+
|
16
|
+
cattr_accessor :default_base_config
|
17
|
+
attr_accessor :config, :options
|
18
|
+
attr_accessor :date, :time, :inferred_command, :task_name, :repo_end
|
19
|
+
|
20
|
+
def self.configure(&block)
|
21
|
+
yield @@default_base_config
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.configure_capistrano_mailer(&block)
|
25
|
+
puts "Deprecated 'configure_capistrano_mailer'. Please update your capistrano_mailer configuration to use 'configure' instead of 'configure_capistrano_mailer'"
|
26
|
+
end
|
27
|
+
|
28
|
+
self.template_root = default_base_config[:template_root]
|
29
|
+
|
30
|
+
def self.reloadable?() false end
|
31
|
+
|
32
|
+
def notification_email(cap, config = {}, *args)
|
33
|
+
@options = { :release_data => {}, :extra_information => {}, :data => {} }.merge(args.extract_options!)
|
34
|
+
@config = default_base_config.merge(config.reverse_merge({
|
35
|
+
:rails_env => cap.rails_env,
|
36
|
+
:host => cap.host,
|
37
|
+
:task_name => cap.task_name,
|
38
|
+
:application => cap.application,
|
39
|
+
:repository => cap.repository,
|
40
|
+
:scm => cap.scm,
|
41
|
+
:deploy_via => cap.deploy_via,
|
42
|
+
:deploy_to => cap.deploy_to,
|
43
|
+
:revision => cap.revision,
|
44
|
+
:real_revision => cap.real_revision,
|
45
|
+
:release_name => cap.release_name,
|
46
|
+
:version_dir => cap.version_dir,
|
47
|
+
:shared_dir => cap.shared_dir,
|
48
|
+
:current_dir => cap.current_dir,
|
49
|
+
:releases_path => cap.releases_path,
|
50
|
+
:shared_path => cap.shared_path,
|
51
|
+
:current_path => cap.current_path,
|
52
|
+
:release_path => cap.release_path,
|
53
|
+
:releases => cap.releases,
|
54
|
+
:current_release => cap.current_release,
|
55
|
+
:previous_release => cap.previous_release,
|
56
|
+
:current_revision => cap.current_revision,
|
57
|
+
:latest_revision => cap.latest_revision,
|
58
|
+
:previous_revision => cap.previous_revision,
|
59
|
+
:run_method => cap.run_method,
|
60
|
+
:latest_release => cap.latest_release
|
61
|
+
|
62
|
+
#This does not appear to be a capistrano variable:
|
63
|
+
#:site_url => cap.site_url
|
64
|
+
}))
|
65
|
+
|
66
|
+
@date = Date.today.to_s
|
67
|
+
@time = Time.now.strftime("%I:%M %p").to_s
|
68
|
+
@inferred_command = "cap #{@config[:rails_env]} #{@config[:task_name]}"
|
69
|
+
@task_name = @config[:task_name] || "unknown"
|
70
|
+
|
71
|
+
repo = @config[:repository]
|
72
|
+
x = repo.include?('/') ? repo.rindex('/') - 1 : repo.length
|
73
|
+
front = repo.slice(0..x)
|
74
|
+
back = repo.sub(front, '')
|
75
|
+
unless back == 'trunk'
|
76
|
+
x = front.include?('/') ? front.rindex('/') - 1 : front.length
|
77
|
+
front = front.slice(0..x)
|
78
|
+
end
|
79
|
+
@repo_end = repo.sub(front, '')
|
80
|
+
|
81
|
+
subject subject_line
|
82
|
+
recipients @config[:recipient_addresses]
|
83
|
+
from @config[:sender_address]
|
84
|
+
content_type @config[:email_content_type]
|
85
|
+
|
86
|
+
body body_data_hash
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def subject_line
|
92
|
+
#The subject prepend and append are useful for people to setup filters in mail clients.
|
93
|
+
user = config[:user] ? " by #{config[:user]}" : ""
|
94
|
+
middle = config[:subject] ? config[:subject] : "[#{config[:rails_env].upcase}][#{repo_end}] #{inferred_command}#{user}"
|
95
|
+
"#{config[:subject_prepend]}#{middle}#{config[:subject_append]}"
|
96
|
+
end
|
97
|
+
|
98
|
+
def body_data_hash
|
99
|
+
options[:data].merge({
|
100
|
+
:section_data => section_data_hash,
|
101
|
+
:date => date,
|
102
|
+
:time => time,
|
103
|
+
:task_name => task_name,
|
104
|
+
:inferred_command => inferred_command,
|
105
|
+
:repo_end => repo_end,
|
106
|
+
:site_name => config[:site_name],
|
107
|
+
:site_url => config[:site_url],
|
108
|
+
:application => config[:application],
|
109
|
+
:sections => config[:sections]
|
110
|
+
})
|
111
|
+
end
|
112
|
+
|
113
|
+
def section_data_hash
|
114
|
+
{
|
115
|
+
:deployment => section_hash_deployment,
|
116
|
+
:source_control => section_hash_source_control,
|
117
|
+
:latest_release => section_hash_latest_release,
|
118
|
+
:previous_release => section_hash_previous_release,
|
119
|
+
:other_deployment_info => section_hash_other_deployment_info,
|
120
|
+
:release_data => options[:release_data],
|
121
|
+
:extra_information => options[:extra_information]
|
122
|
+
}
|
123
|
+
end
|
124
|
+
|
125
|
+
def section_hash_deployment
|
126
|
+
{
|
127
|
+
:date => date,
|
128
|
+
:time => time,
|
129
|
+
:rails_env => config[:rails_env],
|
130
|
+
:task_name => task_name,
|
131
|
+
:inferred_command => inferred_command,
|
132
|
+
:host => config[:host],
|
133
|
+
:release_name => config[:release_name]
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def section_hash_source_control
|
138
|
+
{
|
139
|
+
:revision => config[:revision],
|
140
|
+
:released => repo_end,
|
141
|
+
:repository => config[:repository],
|
142
|
+
:branch => config[:branch],
|
143
|
+
:scm => config[:scm],
|
144
|
+
:deploy_via => config[:deploy_via],
|
145
|
+
:deploy_to => config[:deploy_to]
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
def section_hash_latest_release
|
150
|
+
{
|
151
|
+
:latest_release => config[:latest_release],
|
152
|
+
:latest_revision => config[:latest_revision],
|
153
|
+
:release_path => config[:release_path],
|
154
|
+
:real_revision => config[:real_revision],
|
155
|
+
:current_path => config[:current_path]
|
156
|
+
}
|
157
|
+
end
|
158
|
+
|
159
|
+
def section_hash_previous_release
|
160
|
+
{
|
161
|
+
:current_release => config[:current_release],
|
162
|
+
:current_revision => config[:current_revision],
|
163
|
+
:previous_release => config[:previous_release],
|
164
|
+
:previous_revision => config[:previous_revision],
|
165
|
+
:releases => config[:releases]
|
166
|
+
}
|
167
|
+
end
|
168
|
+
|
169
|
+
def section_hash_other_deployment_info
|
170
|
+
{
|
171
|
+
:version_dir => config[:version_dir],
|
172
|
+
:shared_dir => config[:shared_dir],
|
173
|
+
:current_dir => config[:current_dir],
|
174
|
+
:releases_path => config[:releases_path],
|
175
|
+
:shared_path => config[:shared_path],
|
176
|
+
:run_method => config[:run_method],
|
177
|
+
:ip_address => config[:ip_address]
|
178
|
+
}
|
179
|
+
end
|
180
|
+
end
|
data/lib/capistrano/mailer.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
require 'rubygems' unless defined?(Rubygems)
|
2
|
-
require 'capistrano' unless defined?(Capistrano)
|
3
|
-
|
4
|
-
unless Capistrano::Configuration.respond_to?(:instance)
|
5
|
-
abort "capistrano/mailer requires Capistrano 2"
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'action_mailer' unless defined?(ActionMailer)
|
9
|
-
|
10
|
-
require 'cap_mailer' unless defined?(CapMailer)
|
11
|
-
|
12
|
-
|
13
|
-
module Capistrano
|
14
|
-
class Configuration
|
15
|
-
module CapistranoMailer
|
16
|
-
def send_notification_email(cap, config = {}, *args)
|
17
|
-
CapMailer.deliver_notification_email(cap, config, args)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
include CapistranoMailer
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
Capistrano.plugin :mailer, Capistrano::Configuration::CapistranoMailer
|
1
|
+
require 'rubygems' unless defined?(Rubygems)
|
2
|
+
require 'capistrano' unless defined?(Capistrano)
|
3
|
+
|
4
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
5
|
+
abort "capistrano/mailer requires Capistrano 2"
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'action_mailer' unless defined?(ActionMailer)
|
9
|
+
|
10
|
+
require 'cap_mailer' unless defined?(CapMailer)
|
11
|
+
|
12
|
+
|
13
|
+
module Capistrano
|
14
|
+
class Configuration
|
15
|
+
module CapistranoMailer
|
16
|
+
def send_notification_email(cap, config = {}, *args)
|
17
|
+
CapMailer.deliver_notification_email(cap, config, *args)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
include CapistranoMailer
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Capistrano.plugin :mailer, Capistrano::Configuration::CapistranoMailer
|
@@ -1,31 +1,31 @@
|
|
1
|
-
<div style="margin: 20px; padding: 0 0 20px 0;">
|
2
|
-
|
3
|
-
<h2 style="margin: 0px; padding: 10px 10px 5px 10px; background: #eee; border-left: 10px solid #ccc; color: #333;">
|
4
|
-
<%= section_title.titleize unless section_title.nil? -%>
|
5
|
-
</h2>
|
6
|
-
<% if data.is_a?(Array) then data = data[0] end -%>
|
7
|
-
<% arr = case section_title
|
8
|
-
when 'deployment'
|
9
|
-
[:date,:time,:rails_env,:task_name,:inferred_command,:host,:release_name]
|
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>
|
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>
|
@@ -1,23 +1,23 @@
|
|
1
|
-
<%= section_title.titleize unless section_title.nil? -%>
|
2
|
-
===========================================================
|
3
|
-
|
4
|
-
<% if data.is_a?(Array) then data = data[0] end -%>
|
5
|
-
<% arr = case section_title
|
6
|
-
when 'deployment'
|
7
|
-
[:date,:time,:rails_env,:task,:inferred_command,:host,:release_name]
|
8
|
-
when 'source_control'
|
9
|
-
[:scm,:released,:branch,:revision,:deploy_via,:deploy_to,:repository]
|
10
|
-
when 'latest_release'
|
11
|
-
[:latest_release,:latest_revision,:real_revision,:release_path,:current_path]
|
12
|
-
when 'previous_release'
|
13
|
-
[:current_release,:current_revision,:previous_release,:previous_revision,:releases]
|
14
|
-
when 'other_deployment_info'
|
15
|
-
[:ip_address,:run_method,:source,:strategy,:version_dir,:shared_dir,:current_dir,:releases_path,:shared_path]
|
16
|
-
end -%>
|
17
|
-
<% if !arr.nil? && arr.is_a?(Array) %>
|
18
|
-
<% arr.each do |key| -%>
|
19
|
-
<% if key.is_a?(Symbol) && !data[key].nil?-%>
|
20
|
-
<%= key.to_s.titleize %> <%= data[key].is_a?(Array) ? data[key].to_sentence : data[key].is_a?(String) ? data[key] : data[key].inspect %>
|
21
|
-
<% end -%>
|
22
|
-
<% end -%>
|
23
|
-
<% end -%>
|
1
|
+
<%= section_title.titleize unless section_title.nil? -%>
|
2
|
+
===========================================================
|
3
|
+
|
4
|
+
<% if data.is_a?(Array) then data = data[0] end -%>
|
5
|
+
<% arr = case section_title
|
6
|
+
when 'deployment'
|
7
|
+
[:date,:time,:rails_env,:task,:inferred_command,:host,:release_name]
|
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,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?-%>
|