README.md in slackistrano-3.1.0.beta vs README.md in slackistrano-3.1.0
- old
+ new
@@ -4,11 +4,11 @@
[![Code Climate](https://codeclimate.com/github/phallstrom/slackistrano.png)](https://codeclimate.com/github/phallstrom/slackistrano)
[![Build Status](https://travis-ci.org/phallstrom/slackistrano.png?branch=master)](https://travis-ci.org/phallstrom/slackistrano)
Send notifications to [Slack](https://slack.com) about [Capistrano](http://www.capistranorb.com) deployments.
-**NOTE:** This README documents version 3.1.0.beta. You can read about 3.0.1 [here](https://github.com/phallstrom/slackistrano/tree/v3.0.1).
+**NOTE:** This README documents version >=3.1.0. You can read about 3.0.1 [here](https://github.com/phallstrom/slackistrano/tree/v3.0.1).
## Requirements
- Capistrano >= 3.5.0
- Ruby >= 2.0
@@ -90,10 +90,11 @@
```ruby
module Slackistrano
class CustomMessaging < Messaging::Base
# Send failed message to #ops. Send all other messages to default channels.
+ # The #ops channel must exist prior.
def channels_for(action)
if action == :failed
"#ops"
else
super
@@ -113,42 +114,52 @@
# Fancy updated message.
# See https://api.slack.com/docs/message-attachments
def payload_for_updated
{
attachments: [{
- color: 'good',
- title: "Application Deployed",
- fields: [
- {title: "Project", value: application, short: true},
- {title: "Environment", value: stage, short: true},
- {title: "Deployer", value: deployer, short: true},
- {title: "Time", value: elapsed_time, short: true},
- ],
- fallback: super[:text],
- }]}
+ color: 'good',
+ title: 'Integrations Application Deployed :boom::bangbang:',
+ fields: [{
+ title: 'Environment',
+ value: stage,
+ short: true
+ }, {
+ title: 'Branch',
+ value: branch,
+ short: true
+ }, {
+ title: 'Deployer',
+ value: deployer,
+ short: true
+ }, {
+ title: 'Time',
+ value: elapsed_time,
+ short: true
+ }],
+ fallback: super[:text]
+ }]
+ }
end
- # Default reverted message. Alternatively we could have simply not
- # redefined this method at all.
+ # Default reverted message. Alternatively simply do not redefine this
+ # method.
def payload_for_reverted
super
end
# Slightly tweaked failed message.
# See https://api.slack.com/docs/message-formatting
def payload_for_failed
payload = super
- payload[:text] = ":fire: #{payload[:text]}"
+ payload[:text] = "OMG :fire: #{payload[:text]}"
payload
end
- # Override the deployer helper to pull the full name from the password
- # file.
+ # Override the deployer helper to pull the full name from the password file.
# See https://github.com/phallstrom/slackistrano/blob/master/lib/slackistrano/messaging/helpers.rb
def deployer
Etc.getpwnam(ENV['USER']).gecos
end
-
end
end
```
The output would look like this: