Class: Blankpad::DeploymentNotifier::Message
- Inherits:
-
Object
- Object
- Blankpad::DeploymentNotifier::Message
- Defined in:
- lib/blankpad/deployment_notifier.rb
Instance Attribute Summary collapse
-
#capistrano ⇒ Object
readonly
Returns the value of attribute capistrano.
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(capistrano, deployer) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize(capistrano, deployer) ⇒ Message
Returns a new instance of Message.
61 62 63 64 |
# File 'lib/blankpad/deployment_notifier.rb', line 61 def initialize(capistrano, deployer) @capistrano = capistrano @deployer = deployer end |
Instance Attribute Details
#capistrano ⇒ Object (readonly)
Returns the value of attribute capistrano.
59 60 61 |
# File 'lib/blankpad/deployment_notifier.rb', line 59 def capistrano @capistrano end |
Instance Method Details
#body ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/blankpad/deployment_notifier.rb', line 75 def body body = <<EOM #{@deployer} has deployed revision #{capistrano[:current_revision]} of #{capistrano[:application]} to #{capistrano[:stage]} Application: #{capistrano[:application]} Stage: #{capistrano[:stage]} Repository: #{capistrano[:repository]} Current Revision: #{capistrano[:current_revision]} Previous revision: #{capistrano[:previous_revision]} EOM body = capistrano[:message] + "\n\n#{body}" if capistrano[:message] body end |
#headers ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/blankpad/deployment_notifier.rb', line 66 def headers { "Subject" => "[DEPLOY] #{capistrano[:application]} #{capistrano[:stage]}", "From" => DeploymentNotifier.from, "To" => DeploymentNotifier.recipients.join(", "), "X-Mailer" => "DeploymentNotifier" } end |
#to_s ⇒ Object
90 91 92 |
# File 'lib/blankpad/deployment_notifier.rb', line 90 def to_s headers.collect { |key, value| "#{key}: #{value}" }.join("\n") << "\n\n#{body}" end |