lib/slackistrano/tasks/slack.rake in slackistrano-0.0.12 vs lib/slackistrano/tasks/slack.rake in slackistrano-0.1.0
- old
+ new
@@ -6,10 +6,11 @@
if fetch(:slack_run_starting)
run_locally do
Slackistrano.post(
team: fetch(:slack_team),
token: fetch(:slack_token),
+ via_slackbot: fetch(:slack_via_slackbot),
payload: {
channel: fetch(:slack_channel),
username: fetch(:slack_username),
icon_url: fetch(:slack_icon_url),
icon_emoji: fetch(:slack_icon_emoji),
@@ -24,10 +25,11 @@
if fetch(:slack_run_finished)
run_locally do
Slackistrano.post(
team: fetch(:slack_team),
token: fetch(:slack_token),
+ via_slackbot: fetch(:slack_via_slackbot),
payload: {
channel: fetch(:slack_channel),
username: fetch(:slack_username),
icon_url: fetch(:slack_icon_url),
icon_emoji: fetch(:slack_icon_emoji),
@@ -42,16 +44,17 @@
if fetch(:slack_run_failed)
run_locally do
Slackistrano.post(
team: fetch(:slack_team),
token: fetch(:slack_token),
+ via_slackbot: fetch(:slack_via_slackbot),
payload: {
channel: fetch(:slack_channel),
username: fetch(:slack_username),
icon_url: fetch(:slack_icon_url),
icon_emoji: fetch(:slack_icon_emoji),
- text: fetch(:slack_msg_failed)
+ text: fetch(:slack_msg_failed),
}
)
end
end
end
@@ -75,7 +78,8 @@
set :slack_run_finished, ->{ true } # Set to false to disable finished message.
set :slack_run_failed, ->{ true } # Set to false to disable failure message.
set :slack_msg_starting, ->{ "#{ENV['USER'] || ENV['USERNAME']} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}." }
set :slack_msg_finished, ->{ "#{ENV['USER'] || ENV['USERNAME']} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}." }
set :slack_msg_failed, ->{ "*ERROR!* #{ENV['USER'] || ENV['USERNAME']} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}." }
+ set :slack_via_slackbot, ->{ false } # Set to true to send the message via slackbot instead of webhook
end
end