Notification for capistrano3. Sending notification to irc/slack/... after deployment completed.
Add this line to your application's Gemfile:
gem 'capistrano3-notification', require: false
in Capfile
:
require 'capistrano3/notification'
in deploy.rb
or staging files:
set :irc_host, 'example.com'
set :irc_port, 16667 # default: 6667
set :irc_channel, '#notice'
set :notifier, 'myproject' # default: 'capistrano'
set :notification, -> { "#{fetch(:application)} was deployed to #{fetch(:stage)}" } # this message is default
set :slack_webhook_url, 'https://hooks.slack.com/services/EX/AM/PLE'
set :slack_channel, '#notice'
set :slack_icon, ':ghost:' # use emoji
set :slack_icon, 'http://example.com/icon.png' # use image
set :notifier, 'myproject' # default: 'capistrano'
set :notification, -> { "#{fetch(:application)} was deployed to #{fetch(:stage)}" } # this message is default
contribute me!
You can use notify
method to send message.
# lib/capistrano/tasks/foo.rake
task :foo do
notify 'hello!'
end
- Fork it ( https://github.com/masarakki/capistrano3-notification/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request