|
1 | 1 | # Ember-cli-deploy-slack
|
2 | 2 |
|
3 |
| -This README outlines the details of collaborating on this Ember addon. |
| 3 | +An ember-cli-deploy-plugin for sending deployment messages to [Slack](https://slack.com/). |
4 | 4 |
|
5 |
| -## Installation |
| 5 | +## Usage |
6 | 6 |
|
7 |
| -* `git clone` this repository |
8 |
| -* `npm install` |
9 |
| -* `bower install` |
| 7 | +This plugin will only work with the upcoming 0.5.0-release of |
| 8 | +[ember-cli-deploy](https://github.com/ember-cli/ember-cli-deploy). Right now |
| 9 | +you have to use my [didFail branch](levelbossmike/ember-cli-deploy#didFail-hook-). |
10 | 10 |
|
11 |
| -## Running |
| 11 | +To setup ember-cli-deploy-slack you need to add a `slack`-entry into your |
| 12 | +`deploy.js` configuration file: |
12 | 13 |
|
13 |
| -* `ember server` |
14 |
| -* Visit your app at http://localhost:4200. |
| 14 | +```js |
| 15 | +module.exports = function(environment) { |
| 16 | + var environments = { |
| 17 | + "development": { |
| 18 | + // ... |
| 19 | + "slack": { |
| 20 | + "webhookURL": "https://hooks.slack.com/services/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", |
| 21 | + "channel": "#notifications", |
| 22 | + "username": "ember-cli-deploy" |
| 23 | + }, |
| 24 | + // ... |
| 25 | + }, |
15 | 26 |
|
16 |
| -## Running Tests |
| 27 | + "staging": { |
| 28 | + // ... |
| 29 | + }, |
17 | 30 |
|
18 |
| -* `ember test` |
19 |
| -* `ember test --server` |
| 31 | + "production": { |
| 32 | + // ... |
| 33 | + } |
| 34 | + }; |
20 | 35 |
|
21 |
| -## Building |
| 36 | + return environments[environment]; |
| 37 | +}; |
| 38 | +``` |
22 | 39 |
|
23 |
| -* `ember build` |
| 40 | +## Customization |
24 | 41 |
|
25 |
| -For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). |
| 42 | +`ember-cli-deploy-slack` will send default messages on the `didDeploy`- and |
| 43 | +`didFail`-hooks on the pipeline. Because every team is different and people |
| 44 | +tend to customize their automatic slack notifications messages can be |
| 45 | +customized. |
| 46 | + |
| 47 | +To customize a message you simply add a function to your slack configuration |
| 48 | +options that is named the same as the hook notification you want to customize: |
| 49 | + |
| 50 | +```js |
| 51 | +module.exports = function(environment) { |
| 52 | + var environments = { |
| 53 | + "development": { |
| 54 | + // ... |
| 55 | + "slack": { |
| 56 | + "webhookURL": "https://hooks.slack.com/services/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", |
| 57 | + "channel": "#notifications", |
| 58 | + "username": "ember-cli-deploy", |
| 59 | + "didDeploy": function(context, slack) { |
| 60 | + return slack.notify({ |
| 61 | + text: 'w00t I can haz custumizations!' |
| 62 | + }); |
| 63 | + } |
| 64 | + }, |
| 65 | + // ... |
| 66 | + }, |
| 67 | +``` |
| 68 | +
|
| 69 | +
|
| 70 | +Notification hooks will be passed the deployment context and the slackNotifier |
| 71 | +utility class. The SlackNotifier uses [node-slackr](https://github.com/chenka/node-slackr) under the hood so you can use its `notify`-function accordingly. This enables you to customize your messages in any way possible. You can even add custom properties to the deployment context if that's what you need to do. |
| 72 | +
|
| 73 | +Please see the [Slack API documentation for message formatting](https://api.slack.com/docs/formatting) |
| 74 | +to see how you can customize your messages. |
| 75 | +
|
| 76 | +### Available hooks |
| 77 | +
|
| 78 | +`willDeploy`, `willBuild`, `build`, `didBuild`, `willActivate`, `activate`, |
| 79 | +`didActivate`, `didDeploy`, `didFail` |
0 commit comments