<commit_before># Slackistrano

[![Gem Version](https://badge.fury.io/rb/slackistrano.png)](http://badge.fury.io/rb/slackistrano)
[![Code Climate](https://codeclimate.com/github/supremegolf/slackistrano.png)](https://codeclimate.com/github/supremegolf/slackistrano)
[![Build Status](https://travis-ci.org/supremegolf/slackistrano.png?branch=master)](https://travis-ci.org/supremegolf/slackistrano)

Send notifications to [Slack](https://slack.com) about [Capistrano](http://www.capistranorb.com) deployments.

If you need Capistrano v2 support, check out [capistrano-slack](https://github.com/j-mcnally/capistrano-slack).

## Requirements

- Capistrano >= 3.1.0
- Ruby >= 2.0
- A Slack account

## Installation

Add this line to your application's Gemfile:

    gem 'slackistrano', require: false

And then execute:

    $ bundle

## Configuration

You have two options to notify a channel in Slack when you deploy:

 1. Using *Incoming WebHooks* integration, offering more options but requires one of the five free integrations. This is the default option.
 2. Using *Slackbot*, which will not use one of the five free integrations. Enable via the `:slack_via_slackbot` option.

In both case, you need to enable the integration inside Slack and get the token and/or webhook url that will be needed later.



Require the library in your application's Capfile:

    require 'slackistrano'

If you post using *Incoming Webhooks* you need to set your webhook url in your application's config/deploy.rb:

    set :slack_webhook, "<KEY>"

If you choose to post using *Slackbot* you **must** set your team and and token in your application's config/deploy.rb:

    set :slack_via_slackbot, true
    set :slack_team, "supremegolf"
    set :slack_token, "xxxxxxxxxxxxxxxxxxxxxxxx"

Optionally, override the other slack settings:

    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,          -> { '#general' }
    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_msg_starting,     -> { "#{ENV['USER'] || ENV['USERNAME']} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" }
    set :slack_msg_finished,     -> { "#{ENV['USER'] || ENV['USERNAME']} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" }
    set :slack_msg_failed,       -> { "#{ENV['USER'] || ENV['USERNAME']} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" }
    set :slack_title_starting,   -> { nil }
    set :slack_title_finished,   -> { nil }
    set :slack_title_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:
<commit_msg>Update readme to reflect mandatory slack_channel configuration.<commit_after># Slackistrano

[![Gem Version](https://badge.fury.io/rb/slackistrano.png)](http://badge.fury.io/rb/slackistrano)
[![Code Climate](https://codeclimate.com/github/supremegolf/slackistrano.png)](https://codeclimate.com/github/supremegolf/slackistrano)
[![Build Status](https://travis-ci.org/supremegolf/slackistrano.png?branch=master)](https://travis-ci.org/supremegolf/slackistrano)

Send notifications to [Slack](https://slack.com) about [Capistrano](http://www.capistranorb.com) deployments.

If you need Capistrano v2 support, check out [capistrano-slack](https://github.com/j-mcnally/capistrano-slack).

## Requirements

- Capistrano >= 3.1.0
- Ruby >= 2.0
- A Slack account

## Installation

Add this line to your application's Gemfile:

    gem 'slackistrano', require: false

And then execute:

    $ bundle

## Configuration

You have two options to notify a channel in Slack when you deploy:

 1. Using *Incoming WebHooks* integration, offering more options but requires one of the five free integrations. This is the default option.
 2. Using *Slackbot*, which will not use one of the five free integrations. Enable via the `:slack_via_slackbot` option.

In both case, you need to enable the integration inside Slack and get the token and/or webhook url that will be needed later.



Require the library in your application's Capfile:

    require 'slackistrano'

If you post using *Incoming Webhooks* you need to set your webhook url in your application's config/deploy.rb:

    set :slack_webhook, "<KEY>"

and the channel you want slackistrano to post to:

    set :slack_channel, '#general'

If you choose to post using *Slackbot* you **must** set your team and and token in your application's config/deploy.rb:

    set :slack_via_slackbot, true
    set :slack_team, "supremegolf"
    set :slack_token, "<KEY>"

Optionally, override the other slack settings:

    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_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_msg_starting,     -> { "#{ENV['USER'] || ENV['USERNAME']} has started deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" }
    set :slack_msg_finished,     -> { "#{ENV['USER'] || ENV['USERNAME']} has finished deploying branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" }
    set :slack_msg_failed,       -> { "#{ENV['USER'] || ENV['USERNAME']} failed to deploy branch #{fetch :branch} of #{fetch :application} to #{fetch :rails_env, 'production'}" }
    set :slack_title_starting,   -> { nil }
    set :slack_title_finished,   -> { nil }
    set :slack_title_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:

{'fraction_non_alphanumeric': 0.1233644859813084, 'fraction_numerical': 0.008626887131560028, 'mean_word_length': 3.9971264367816093, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 41, 'https://': 14, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5463369', 'n_tokens_mistral': 2324, 'n_tokens_neox': 2219, 'n_words': 685}