Skip to content

Instantly share code, notes, and snippets.

@nolan
Created January 25, 2011 23:00
Show Gist options
  • Save nolan/795883 to your computer and use it in GitHub Desktop.
Save nolan/795883 to your computer and use it in GitHub Desktop.
Working Growl Capistrano notifications for Snow Leopard
# ~/.caprc
# Loads all capistrano recipes in ~/.recipes/ folder
Dir["#{ENV['HOME']}/.recipes/*.rb"].each do |tasks|
load tasks
end
# ~/.recipes/growl.rb
set :stage, nil unless defined? stage
namespace :growl do
task :notify do
growl_send(ENV["GROWL_MESSAGE"] || "Wants your attention")
end
task :alert do
growl_send(ENV["GROWL_MESSAGE"] || "Needs your attention", 2)
end
end
after "deploy" do
ENV["GROWL_MESSAGE"] = "Deployed #{application} to #{stage}"
growl.notify
end
after "rollback" do
ENV["GROWL_MESSAGE"] = "Rolled back #{application} on #{stage}"
growl.alert
end
def growl_send(message, p = 1)
`growlnotify -n Capistrano -p #{p} -m #{message.inspect} Capistrano`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment