Sha256: 1cc4ef6683371ef7dbcad13322d05064dddeeabc91b6bc89ae52b9f1d07ea4f0
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true require "kapost_deploy/slack/notifier" module KapostDeploy module Plugins # After-promotion plugin to notify via slack after a promotion is complete with an # optional message. class SlackAfterPromote def initialize(config, notifier: KapostDeploy::Slack::Notifier.new(config.options.fetch(:slack_config, nil))) self.config = config self.notifier = notifier end def before end def after return unless notifier.configured? message = "#{identity} promoted *#{config.app}* to *#{config.to}*#{additional_message}" notifier.notify(message) end private def additional_message slack_config = config.options.fetch(:slack_config) addl = "" addl = slack_config.fetch(:additional_message, "") unless slack_config.nil? addl = "\n#{addl}" unless addl.empty? addl end def identity @identity ||= `whoami`.chomp end attr_accessor :notifier attr_accessor :config attr_accessor :slack_config end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kapost_deploy-0.2.0 | lib/kapost_deploy/plugins/slack_after_promote.rb |