Skip to content

Commit

Permalink
Merge pull request #17 from DNNX/master
Browse files Browse the repository at this point in the history
Add :slack_application_url support
  • Loading branch information
Justin McNally committed Jul 18, 2014
2 parents 5514c68 + 342186f commit 92ed09b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions lib/capistrano/slack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 92ed09b

Please sign in to comment.