Skip to content

Instantly share code, notes, and snippets.

@stephencelis
Created March 2, 2009 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stephencelis/72796 to your computer and use it in GitHub Desktop.
Save stephencelis/72796 to your computer and use it in GitHub Desktop.
# ~/.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} #{stage}"
growl.notify
end
after "rollback" do
ENV["GROWL_MESSAGE"] = "rolled back #{application} #{stage}"
growl.alert
end
def growl_send(message, p = 1)
require 'meow'
icon = OSX::NSWorkspace.sharedWorkspace.iconForFile(`which cap`.chomp)
Meow.notify("cap", "Capistrano", message, :priority => p, :icon => icon)
rescue LoadError
`growlnotify -ncap -p#{priority} -m #{message.inspect} Capistrano`
end
@gbirke
Copy link

gbirke commented Aug 14, 2012

The fallback on line 29 must be

 `growlnotify -ncap -p#{p} -m #{message.inspect} Capistrano`

@Pickachu
Copy link

Pickachu commented May 2, 2013

👍 on fallback update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment