Module: Capistrano::Mailgun
- Defined in:
- lib/capistrano-mailgun.rb,
lib/capistrano-mailgun/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Method Summary collapse
-
#find_template(t) ⇒ Object
kinda unused function for locating a provided template.
-
#notify_of_deploy(template_name) ⇒ Object
does a deploy notification leveraging variables defined in capistrano.
-
#send_email(template, subject, recipients, from_address) ⇒ Object
simple wrapper for sending an email with a given template.
Instance Method Details
#find_template(t) ⇒ Object
kinda unused function for locating a provided template
24 25 26 27 |
# File 'lib/capistrano-mailgun.rb', line 24 def find_template(t) return t File.join( File.dirname(__FILE__), t ) end |
#notify_of_deploy(template_name) ⇒ Object
does a deploy notification leveraging variables defined in capistrano.
19 20 21 |
# File 'lib/capistrano-mailgun.rb', line 19 def notify_of_deploy(template_name) send_email( template_name, mailgun_subject, build_recipients( mailgun_recipients ), mailgun_from ) end |
#send_email(template, subject, recipients, from_address) ⇒ Object
simple wrapper for sending an email with a given template
10 11 12 13 14 15 16 |
# File 'lib/capistrano-mailgun.rb', line 10 def send_email(template, subject, recipients, from_address) RestClient.post "https://api:#{ mailgun_api_key }@api.mailgun.net/v2/#{ mailgun_domain }/messages", :from => from_address, :to => build_recipients( recipients ).join(','), :subject => subject, :text => ERB.new( File.open( find_template(template), 'r' ).read ).result(self.binding) end |