Class: KapostDeploy::Plugins::SlackGithubDiff
- Inherits:
-
Object
- Object
- KapostDeploy::Plugins::SlackGithubDiff
- Defined in:
- lib/kapost_deploy/plugins/slack_github_diff.rb
Overview
Before-promotion plugin to notify slack with a github comparison warning
Instance Method Summary collapse
- #after ⇒ Object
- #before ⇒ Object
-
#initialize(config, notifier: KapostDeploy::Slack::Notifier.new(config.options.fetch(:slack_config, nil)), behind_releases: KapostDeploy::Heroku::AppReleases.new(config.to, token: config.heroku_api_token), ahead_releases: KapostDeploy::Heroku::AppReleases.new(config.app, token: config.heroku_api_token)) ⇒ SlackGithubDiff
constructor
A new instance of SlackGithubDiff.
Constructor Details
#initialize(config, notifier: KapostDeploy::Slack::Notifier.new(config.options.fetch(:slack_config, nil)), behind_releases: KapostDeploy::Heroku::AppReleases.new(config.to, token: config.heroku_api_token), ahead_releases: KapostDeploy::Heroku::AppReleases.new(config.app, token: config.heroku_api_token)) ⇒ SlackGithubDiff
Returns a new instance of SlackGithubDiff.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/kapost_deploy/plugins/slack_github_diff.rb', line 10 def initialize(config, notifier: KapostDeploy::Slack::Notifier.new(config..fetch(:slack_config, nil)), behind_releases: KapostDeploy::Heroku::AppReleases.new(config.to, token: config.heroku_api_token), ahead_releases: KapostDeploy::Heroku::AppReleases.new(config.app, token: config.heroku_api_token)) self.ahead_app = config.app self.behind_app = config.to self.git_config = config..fetch(:git_config, nil) self.notifier = notifier self.behind_releases = behind_releases self.ahead_releases = ahead_releases end |
Instance Method Details
#after ⇒ Object
32 33 |
# File 'lib/kapost_deploy/plugins/slack_github_diff.rb', line 32 def after end |
#before ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/kapost_deploy/plugins/slack_github_diff.rb', line 23 def before return unless configured? msg = "#{identity} is promoting <#{github_compare_url}|#{ahead_sha1}>"\ " from *#{ahead_app}* to *#{behind_app}*" notifier.notify(msg) end |