README.md in slackistrano-0.1.12 vs README.md in slackistrano-1.0.0

- old
+ new

@@ -56,46 +56,72 @@ set :slack_team, "teamname" set :slack_token, "xxxxxxxxxxxxxxxxxxxxxxxx" set :slack_channel, '#general' ``` -Optionally, override the other slack settings: +Optionally, override the other slack settings. ```ruby -set :slack_icon_url, -> { 'http://gravatar.com/avatar/885e1c523b7975c4003de162d8ee8fee?r=g&s=40' } -set :slack_icon_emoji, -> { nil } # will override icon_url, Must be a string (ex: ':shipit:') -set :slack_channel, -> { nil } # Channel to post to. Optional. Defaults to WebHook setting. Required if using Slackbot. -set :slack_channel_starting, -> { nil } # Channel to post to. Optional. Defaults to :slack_channel. -set :slack_channel_finished, -> { nil } # Channel to post to. Optional. Defaults to :slack_channel. -set :slack_channel_failed, -> { nil } # Channel to post to. Optional. Defaults to :slack_channel. -set :slack_username, -> { 'Slackistrano' } -set :slack_run_starting, -> { true } -set :slack_run_finished, -> { true } -set :slack_run_failed, -> { true } -set :slack_deploy_user, -> { ENV['USER'] || ENV['USERNAME'] } -set :slack_msg_starting, -> { "#{fetch :slack_deploy_user} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" } -set :slack_msg_finished, -> { "#{fetch :slack_deploy_user} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" } -set :slack_msg_failed, -> { "#{fetch :slack_deploy_user} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" } -set :slack_fields_starting, -> { [] } -set :slack_fields_finished, -> { [] } -set :slack_fields_failed, -> { [] } -set :slack_fallback_starting, -> { nil } -set :slack_fallback_finished, -> { nil } -set :slack_fallback_failed, -> { nil } -set :slack_title_starting, -> { nil } -set :slack_title_finished, -> { nil } -set :slack_title_failed, -> { nil } +set :slack_channel_updating, -> { nil } # Channel to post to. Defaults to :slack_channel. +set :slack_channel_reverting, -> { nil } # Channel to post to. Defaults to :slack_channel. +set :slack_channel_updated, -> { nil } # Channel to post to. Defaults to :slack_channel. +set :slack_channel_reverted, -> { nil } # Channel to post to. Defaults to :slack_channel. +set :slack_channel_failed, -> { nil } # Channel to post to. Defaults to :slack_channel. + +set :slack_icon_url, -> { 'http://gravatar.com/avatar/885e1c523b7975c4003de162d8ee8fee?r=g&s=40' } +set :slack_icon_emoji, -> { nil } # Emoji to use. Overrides icon_url. Must be a string (ex: ':shipit:') +set :slack_username, -> { 'Slackistrano' } + +set :slack_run_updating, -> { true } # Set to false to disable deploy starting message. +set :slack_run_reverting, -> { true } # Set to false to disable rollback starting message. +set :slack_run_updated, -> { true } # Set to false to disable deploy finished message. +set :slack_run_reverted, -> { true } # Set to false to disable rollback finished message. +set :slack_run_failed, -> { true } # Set to false to disable failure message. + +set :slack_deploy_user, -> { ENV['USER'] || ENV['USERNAME'] } + +set :slack_msg_updating, -> { "#{fetch :slack_deploy_user} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}" } +set :slack_msg_reverting, -> { "#{fetch :slack_deploy_user} has started rolling back branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}" } +set :slack_msg_updated, -> { "#{fetch :slack_deploy_user} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}" } +set :slack_msg_reverted, -> { "#{fetch :slack_deploy_user} has finished rolling back branch of #{fetch :application} to #{fetch :stage, 'an unknown stage'}" } +set :slack_msg_failed, -> { "#{fetch :slack_deploy_user} has failed to #{fetch :slack_deploy_or_rollback} branch #{fetch :branch} of #{fetch :application} to #{fetch :stage, 'an unknown stage'}" } + +set :slack_fields_updating, -> { [] } +set :slack_fields_reverting, -> { [] } +set :slack_fields_updated, -> { [] } +set :slack_fields_reverted, -> { [] } +set :slack_fields_failed, -> { [] } + +set :slack_fallback_updating, -> { nil } +set :slack_fallback_reverting, -> { nil } +set :slack_fallback_updated, -> { nil } +set :slack_fallback_reverted, -> { nil } +set :slack_fallback_failed, -> { nil } + +set :slack_title_updating, -> { nil } +set :slack_title_reverting, -> { nil } +set :slack_title_updated, -> { nil } +set :slack_title_reverted, -> { nil } +set :slack_title_failed, -> { nil } + +set :slack_pretext_updating, -> { nil } +set :slack_pretext_reverting, -> { nil } +set :slack_pretext_updated, -> { nil } +set :slack_pretext_reverted, -> { nil } +set :slack_pretext_failed, -> { nil } ``` **Note**: You may wish to disable one of the notifications if another service (ex: Honeybadger) also displays a deploy notification. Test your setup by running: ```bash -$ cap production slack:deploy:starting -$ cap production slack:deploy:finished +$ cap production slack:deploy:updating +$ cap production slack:deploy:reverting +$ cap production slack:deploy:updated +$ cap production slack:deploy:reverted $ cap production slack:deploy:failed ``` ## Formatted messages @@ -133,10 +159,10 @@ It will produce the following format: ![Formatted message](https://raw.githubusercontent.com/phallstrom/slackistrano/master/examples/fomatting_with_fields.png) **Note 1:** *The `fallback` field is required in order to display notifications when using `fields`.* -**Note 2:** *The `fields` requires configuration requires you to use webhooks.* +**Note 2:** *The `fields` configuration requires you to use webhooks.* More information: [https://api.slack.com/docs/attachments](https://api.slack.com/docs/attachments) ## Usage