Add libnotify and notify-send notifiers
This commit is contained in:
parent
eb4d25975f
commit
72eefab5f2
0
lib/capistrano-send.rb
Normal file
0
lib/capistrano-send.rb
Normal 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'
|
||||
|
1
lib/capistrano/send/libnotify.rb
Normal file
1
lib/capistrano/send/libnotify.rb
Normal file
@ -0,0 +1 @@
|
||||
load File.expand_path('../../tasks/libnotify.cap', __FILE__)
|
1
lib/capistrano/send/notify-send.rb
Normal file
1
lib/capistrano/send/notify-send.rb
Normal file
@ -0,0 +1 @@
|
||||
load File.expand_path('../../tasks/notify-send.cap', __FILE__)
|
21
lib/capistrano/tasks/libnotify.cap
Normal file
21
lib/capistrano/tasks/libnotify.cap
Normal 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'
|
14
lib/capistrano/tasks/notify-send.cap
Normal file
14
lib/capistrano/tasks/notify-send.cap
Normal 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'
|
Loading…
x
Reference in New Issue
Block a user