Add libnotify and notify-send notifiers

This commit is contained in:
Guillaume Dott 2015-05-22 11:53:26 +02:00
parent eb4d25975f
commit 72eefab5f2
6 changed files with 39 additions and 7 deletions

0
lib/capistrano-send.rb Normal file
View File

View File

@ -1,7 +1,2 @@
require "capistrano/send/version"
module Capistrano
module Send
# Your code goes here...
end
end
require 'capistrano/send/libnotify'
require 'capistrano/send/notify-send'

View File

@ -0,0 +1 @@
load File.expand_path('../../tasks/libnotify.cap', __FILE__)

View File

@ -0,0 +1 @@
load File.expand_path('../../tasks/notify-send.cap', __FILE__)

View File

@ -0,0 +1,21 @@
begin
require 'libnotify'
rescue LoadError
end
namespace :send do
namespace :libnotify do
desc "Display a notification using libnotify"
task :notify do
if defined?(Libnotify)
Libnotify.show(
summary: "Deploy successful on #{fetch(:stage)}!",
body: revision_log_message,
timeout: 10,
)
end
end
end
end
after 'deploy:finished', 'send:libnotify:notify'

View File

@ -0,0 +1,14 @@
namespace :send do
namespace :'notify-send' do
desc "Display a notification using notify-send"
task :notify do
expire_time = 10000
summary = "Deploy successful on #{fetch(:stage)}!"
body = revision_log_message
`notify-send --expire-time=#{expire_time} '#{summary}' '#{body}'`
end
end
end
after 'deploy:finished', 'send:notify-send:notify'