Class: Fyi::Notifier::Email
- Inherits:
-
Object
- Object
- Fyi::Notifier::Email
- Defined in:
- lib/fyi/notifiers/email.rb
Overview
Emails the results of command execution via SMTP.
By default only failures are emailed.
Instance Method Summary collapse
-
#initialize(options) ⇒ Email
constructor
Options you may supply:.
- #notify(command, result, duration, output, error = '', host = '') ⇒ Object
Constructor Details
#initialize(options) ⇒ Email
Options you may supply:
from
: the from address to
: the to address on_success
: whether to notify when the command succeeded.
Optional. Defaults to false.
on_failure
: whether to notify when the command failed.
Optional. Defaults to true.
smtp
: you should supply SMTP config options under this key.
SMTP config options are: host
port
user
password
auth
domain
31 32 33 34 35 36 37 38 |
# File 'lib/fyi/notifiers/email.rb', line 31 def initialize @from = ['from'] @to = ['to'] @smtp = symbolize_keys ['smtp'] @on_success = ['on_success'] # Notify of failures by default. @on_failure = .has_key?('on_failure') ? ['on_failure'] : true end |
Instance Method Details
#notify(command, result, duration, output, error = '', host = '') ⇒ Object
40 41 42 |
# File 'lib/fyi/notifiers/email.rb', line 40 def notify command, result, duration, output, error = '', host = '' send_email(command, result, duration, output, error, host) if should_notify?(result) end |