From 78d82b5c79d80331a23540ce709030c18d6571ce Mon Sep 17 00:00:00 2001 From: Viktar Basharymau Date: Wed, 21 May 2014 18:17:12 +0300 Subject: [PATCH 1/3] Add slack_application_url support to slack:starting task --- lib/capistrano/slack.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/capistrano/slack.rb b/lib/capistrano/slack.rb index 465408e..37aa223 100644 --- a/lib/capistrano/slack.rb +++ b/lib/capistrano/slack.rb @@ -32,9 +32,10 @@ def self.extended(configuration) slack_username = fetch(:slack_username) || "deploybot" slack_application = fetch(:slack_application) || application slack_subdomain = fetch(:slack_subdomain) + slack_application_url = fetch(:slack_application_url, nil) return if slack_token.nil? announced_deployer = ActiveSupport::Multibyte::Chars.new(fetch(:deployer)).mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/,'').to_s - announced_stage = fetch(:stage, 'production') + announced_stage = slack_application_url || fetch(:stage, 'production') announcement = if fetch(:branch, nil) "#{announced_deployer} is deploying #{slack_application}'s #{branch}" From f4508a7a032ff015434caf0aa2bdeacaff37d691 Mon Sep 17 00:00:00 2001 From: Viktar Basharymau Date: Wed, 21 May 2014 18:30:42 +0300 Subject: [PATCH 2/3] Add slack_application_url support to slack:finished task --- lib/capistrano/slack.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/capistrano/slack.rb b/lib/capistrano/slack.rb index 37aa223..6c0a7d9 100644 --- a/lib/capistrano/slack.rb +++ b/lib/capistrano/slack.rb @@ -71,9 +71,10 @@ def self.extended(configuration) slack_username = fetch(:slack_username) || "deploybot" slack_application = fetch(:slack_application) || application slack_subdomain = fetch(:slack_subdomain) + slack_application_url = fetch(:slack_application_url, nil) return if slack_token.nil? announced_deployer = fetch(:deployer) - announced_stage = fetch(:stage, 'production') + announced_stage = slack_application_url || fetch(:stage, 'production') end_time = Time.now start_time = fetch(:start_time) elapsed = end_time.to_i - start_time.to_i From 342186ff6f412c4dec8799c2cb87a7ebefb09c8a Mon Sep 17 00:00:00 2001 From: Viktar Basharymau Date: Wed, 21 May 2014 18:33:42 +0300 Subject: [PATCH 3/3] Describe :slack_application_url in README --- README.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.markdown b/README.markdown index cebe8bd..d931b16 100644 --- a/README.markdown +++ b/README.markdown @@ -27,6 +27,8 @@ set :slack_subdomain, "kohactive" # if your subdomain is kohactive.slack.com set :slack_application, "Rocketman" set :slack_username, "Elton John" set :slack_emoji, ":rocket:" +set :slack_application_url, "http://my-awesome-app.example.com" +# set(:slack_application_url) { "http://{ fetch :domain_aliases }" } ``` You can obtain your `webhook_token` from the integrations section of the team page in Slack.