Class: Blankpad::DeploymentNotifier::Mailer
- Inherits:
-
Object
- Object
- Blankpad::DeploymentNotifier::Mailer
- Defined in:
- lib/blankpad/deployment_notifier.rb
Overview
Responsible for taking the e-mail to send, and sending it using the remote server’s sendmail command.
Instance Attribute Summary collapse
-
#capistrano ⇒ Object
readonly
Returns the value of attribute capistrano.
Instance Method Summary collapse
-
#deliver! ⇒ Object
Delivers a notification e-mail.
-
#delivery_command ⇒ Object
Constructs the final command which will be sent run on the server.
-
#initialize(capistrano) ⇒ Mailer
constructor
A new instance of Mailer.
- #message ⇒ Object
- #mta_command ⇒ Object
Constructor Details
#initialize(capistrano) ⇒ Mailer
Returns a new instance of Mailer.
35 36 37 |
# File 'lib/blankpad/deployment_notifier.rb', line 35 def initialize(capistrano) @capistrano = capistrano end |
Instance Attribute Details
#capistrano ⇒ Object (readonly)
Returns the value of attribute capistrano.
33 34 35 |
# File 'lib/blankpad/deployment_notifier.rb', line 33 def capistrano @capistrano end |
Instance Method Details
#deliver! ⇒ Object
Delivers a notification e-mail
40 41 42 |
# File 'lib/blankpad/deployment_notifier.rb', line 40 def deliver! capistrano.run(delivery_command) end |
#delivery_command ⇒ Object
Constructs the final command which will be sent run on the server.
45 46 47 |
# File 'lib/blankpad/deployment_notifier.rb', line 45 def delivery_command "echo -en '#{message}' | #{mta_command}" end |
#message ⇒ Object
53 54 55 |
# File 'lib/blankpad/deployment_notifier.rb', line 53 def Message.new(capistrano, Blankpad::DeploymentNotifier.deployer).to_s.gsub(/\n/, "\\n") end |
#mta_command ⇒ Object
49 50 51 |
# File 'lib/blankpad/deployment_notifier.rb', line 49 def mta_command "/usr/sbin/sendmail #{DeploymentNotifier.recipients.join(" ")}" end |