Skip to content

Instantly share code, notes, and snippets.

@jcleary
Created June 6, 2014 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcleary/9d26da4f017f0225d75b to your computer and use it in GitHub Desktop.
Save jcleary/9d26da4f017f0225d75b to your computer and use it in GitHub Desktop.
# ---------------------------------------------------------------------------
# Pushover for Capistrano 3.1
# Sends a pushover notification after deployment or rollback
#
# Instructions:
# - Save this file into lib/capistrano/tasks/notify.rb
# - Add this to your Gemfile
# gem 'rushover'
# - in this file or deploy.rb add these two lines (get this info from pushover.net)
# set :pushover_app_token, 'xxx'
# set :pushover_user_key, 'yyy'
# - include this file in your Capfile. You can do it by adding this line
# require_relative 'lib/capistrano/tasks/notify'
#
# ---------------------------------------------------------------------------
require 'rushover'
namespace :notify do
task :pushover do
client = Rushover::Client.new(fetch(:pushover_app_token))
client.notify(
fetch(:pushover_user_key),
"User #{ENV['USER']} deployed branch #{fetch(:branch)} to #{fetch(:stage)}",
:priority => 0,
:title => 'Deployment complete!'
)
end
end
after 'deploy:finishing', 'notify:pushover'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment