class Taperole::Notifier

Attributes

observers[RW]

Public Class Methods

config() click to toggle source
# File lib/taperole/core/notifier.rb, line 27
def config
  @config ||= YAML.load_file("#{tapefiles_dir}/tape_vars.yml")
end
deploy_info(options) click to toggle source
# File lib/taperole/core/notifier.rb, line 31
def deploy_info(options)
  {
    app_name: config["app_name"],
    user: `whoami`.chomp,
    hosts: options[:limit] || 'default',
    repo: config["be_app_repo"] || ''
  }
end
new() click to toggle source
# File lib/taperole/core/notifier.rb, line 10
def initialize
  @observers = []
end
notify_observers(state) click to toggle source
# File lib/taperole/core/notifier.rb, line 40
def notify_observers(state)
  instance.observers.each do |observer|
    observer.update(state)
  end
end
register_notifiers(options) click to toggle source
# File lib/taperole/core/notifier.rb, line 17
def register_notifiers(options)
  if config["slack_webhook_url"]
    slack_notifier = Taperole::Notifiers::Slack.new(
      config["slack_webhook_url"],
      deploy_info(options)
    )
    instance.observers.push(slack_notifier)
  end
end