forked from rhysd/vim-clang-format
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile
29 lines (25 loc) · 631 Bytes
/
Guardfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# encoding: utf-8
require 'terminal-notifier'
def which cmd
dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
File.join(dir, cmd) unless dir.nil?
end
def notify m
msg = "'#{m}\\n#{Time.now.to_s}'"
case
when which('terminal-notifier')
`terminal-notifier -message #{msg}`
when which('notify-send')
`notify-send #{msg}`
when which('tmux')
`tmux display-message #{msg}` if `tmux list-clients 1>/dev/null 2>&1` && $?.success?
end
end
guard :shell do
watch /^(autoload|plugin|t)\/.+\.vim$/ do
system "rake test"
unless $?
notify "test(s) failed"
end
end
end