{"id":13685636,"url":"https://github.com/phallstrom/slackistrano","last_synced_at":"2025-12-17T21:22:13.977Z","repository":{"id":12674898,"uuid":"15346926","full_name":"phallstrom/slackistrano","owner":"phallstrom","description":"Slack integration for Capistrano deployments.","archived":false,"fork":false,"pushed_at":"2024-12-12T00:03:48.000Z","size":680,"stargazers_count":372,"open_issues_count":11,"forks_count":74,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-11T02:55:43.310Z","etag":null,"topics":["capistrano","ruby","slack"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phallstrom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-20T19:53:56.000Z","updated_at":"2025-04-23T16:47:39.000Z","dependencies_parsed_at":"2024-02-11T15:54:36.130Z","dependency_job_id":"aab5432a-7612-4bef-9642-3dd05c759059","html_url":"https://github.com/phallstrom/slackistrano","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallstrom%2Fslackistrano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallstrom%2Fslackistrano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallstrom%2Fslackistrano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallstrom%2Fslackistrano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phallstrom","download_url":"https://codeload.github.com/phallstrom/slackistrano/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301613,"owners_count":22047905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capistrano","ruby","slack"],"created_at":"2024-08-02T14:00:55.000Z","updated_at":"2025-12-17T21:22:13.920Z","avatar_url":"https://github.com/phallstrom.png","language":"Ruby","funding_links":[],"categories":["Ruby","Awesome Capistrano"],"sub_categories":["Gems"],"readme":"# Slackistrano\n\n[![Gem Version](https://badge.fury.io/rb/slackistrano.png)](http://badge.fury.io/rb/slackistrano)\n[![Code Climate](https://codeclimate.com/github/phallstrom/slackistrano.png)](https://codeclimate.com/github/phallstrom/slackistrano)\n[![Build Status](https://travis-ci.org/phallstrom/slackistrano.png?branch=master)](https://travis-ci.org/phallstrom/slackistrano)\n\nSend notifications to [Slack](https://slack.com) about [Capistrano](http://www.capistranorb.com) deployments.\n\n## Requirements\n\n- Capistrano \u003e= 3.8.1\n- Ruby \u003e= 2.0\n- A Slack account\n\n## Installation\n\n1. Add this line to your application's Gemfile:\n\n   ```ruby\n   gem 'slackistrano'\n   ```\n\n2. Execute:\n\n   ```\n   $ bundle\n   ```\n\n3. Require the library in your application's Capfile:\n\n   ```ruby\n   require 'slackistrano/capistrano'\n   ```\n\n## Configuration\n\nYou have two options to notify a channel in Slack when you deploy:\n\n1. Using *Incoming WebHooks* integration, offering more options but requires\n   one of the five free integrations. This option provides more messaging\n   flexibility.\n2. Using *Slackbot*, which will not use one of the five free integrations.\n\n### Incoming Webhook\n\n1. Configure your Slack's Incoming Webhook.\n2. Add the following to `config/deploy.rb`:\n\n   ```ruby\n   set :slackistrano, {\n     channel: '#your-channel',\n     webhook: 'your-incoming-webhook-url'\n   }\n   ```\n\n### Slackbot\n\n1. Configure your Slack's Slackbot (not Bot).\n2. Add the following to `config/deploy.rb`:\n\n   ```ruby\n   set :slackistrano, {\n     channel: '#your-channel',\n     team: 'your-team-name',\n     token: 'your-token'\n   }\n   ```\n\n### Optional Configuration \u0026 Overrides\n\nBy default Slackistrano will use a default icon and username. These, can be\noverriden if you are using the default messaging class (ie. have not specified\nyour own).\n\n1. Configure per instructions above.\n2. Add the following to `config/deploy.rb`:\n\n   ```ruby\n   set :slackistrano, {\n    ...\n    username: 'Foobar the Deployer',\n    icon_emoji: ':thumbsup:', # takes precedence over icon_url\n    icon_url: 'https://avatars2.githubusercontent.com/u/16705?v=4\u0026s=40',\n    ...\n   }\n   ```\n\n\n### Test your Configuration\n\nTest your setup by running the following command. This will post each stage's\nmessage to Slack in turn.\n\n```\n$ cap production slack:deploy:test\n```\n\n## Usage\n\nDeploy your application like normal and you should see messages in the channel\nyou specified.\n\n## Customizing the hooks\n\nIf you wish to take control over when and what slackistrano hooks are fired, then you can use the option in `deploy.rb`:\n\n```ruby\nset :use_custom_slackistrano_hooks, true\n```\n\nThis allows you to set custom hooks for all the slackistrano tasks:\n\n```ruby\n'slack:deploy:starting'\n'slack:deploy:updating'\n'slack:deploy:reverting'\n'slack:deploy:updated'\n'slack:deploy:reverted'\n'slack:deploy:failed'\n```\n\n## Customizing the Messaging\n\nYou can customize the messaging posted to Slack by providing your own messaging\nclass and overriding several methods. Here is one example:\n\n```ruby\nif defined?(Slackistrano::Messaging)\n   module Slackistrano\n     class CustomMessaging \u003c Messaging::Base\n\n       # Send failed message to #ops. Send all other messages to default channels.\n       # The #ops channel must exist prior.\n       def channels_for(action)\n         if action == :failed\n           \"#ops\"\n         else\n           super\n         end\n       end\n\n       # Suppress starting message.\n       def payload_for_starting\n         nil\n       end\n\n       # Suppress updating message.\n       def payload_for_updating\n         nil\n       end\n\n       # Suppress reverting message.\n       def payload_for_reverting\n         nil\n       end\n\n       # Fancy updated message.\n       # See https://api.slack.com/docs/message-attachments\n       def payload_for_updated\n         {\n           attachments: [{\n             color: 'good',\n             title: 'Integrations Application Deployed :boom::bangbang:',\n             fields: [{\n               title: 'Environment',\n               value: stage,\n               short: true\n             }, {\n               title: 'Branch',\n               value: branch,\n               short: true\n             }, {\n               title: 'Deployer',\n               value: deployer,\n               short: true\n             }, {\n               title: 'Time',\n               value: elapsed_time,\n               short: true\n             }],\n             fallback: super[:text]\n           }],\n           text: \"\u003c!here\u003e Application Deployed!\"\n         }\n       end\n\n       # Default reverted message.  Alternatively simply do not redefine this\n       # method.\n       def payload_for_reverted\n         super\n       end\n\n       # Slightly tweaked failed message.\n       # See https://api.slack.com/docs/message-formatting\n       def payload_for_failed\n         payload = super\n         payload[:text] = \"OMG :fire: #{payload[:text]}\"\n         payload\n       end\n\n       # Override the deployer helper to pull the best name available (git, password file, env vars).\n       # See https://github.com/phallstrom/slackistrano/blob/master/lib/slackistrano/messaging/helpers.rb\n       def deployer\n         name = `git config user.name`.strip\n         name = nil if name.empty?\n         name ||= Etc.getpwnam(ENV['USER']).gecos || ENV['USER'] || ENV['USERNAME']\n         name\n       end\n     end\n   end\nend\n```\n\nThe output would look like this:\n![Custom Messaging](https://raw.githubusercontent.com/phallstrom/slackistrano/overhaul/images/custom_messaging.jpg)\n\nTo set this up:\n\n1. Add the above class to your app, for example `lib/custom_messaging.rb`.\n\n2. Require the library after the requiring of Slackistrano in your application's Capfile.\n\n   ```ruby\n   require_relative 'lib/custom_messaging'\n   ```\n\n3. Update the `slackistrano` configuration in `config/deploy.rb` and add the `klass` option.\n\n   ```ruby\n   set :slackistrano, {\n     klass: Slackistrano::CustomMessaging,\n     channel: '#your-channel',\n     webhook: 'your-incoming-webhook-url'\n   }\n   ```\n\n4. If you come up with something that you think others would enjoy submit it as\n   an issue along with a screenshot of the output from `cap production\n   slack:deploy:test` and I'll add it to the Wiki.\n\n## Disabling posting to Slack\n\nYou can disable deployment notifications to a specific stage by setting the `:slackistrano`\nconfiguration variable to `false` instead of actual settings.\n\n```ruby\nset :slackistrano, false\n```\n\n## TODO\n\n- Notify about incorrect configuration settings.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphallstrom%2Fslackistrano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphallstrom%2Fslackistrano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphallstrom%2Fslackistrano/lists"}