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. diff --git a/lib/capistrano/slack.rb b/lib/capistrano/slack.rb index 465408e..6c0a7d9 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}" @@ -70,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