guard 1.4.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +1 -677
- data/LICENSE +4 -2
- data/README.md +91 -753
- data/bin/_guard-core +11 -0
- data/bin/guard +108 -3
- data/lib/guard/aruba_adapter.rb +59 -0
- data/lib/guard/cli/environments/bundler.rb +22 -0
- data/lib/guard/cli/environments/evaluate_only.rb +35 -0
- data/lib/guard/cli/environments/valid.rb +69 -0
- data/lib/guard/cli.rb +129 -128
- data/lib/guard/commander.rb +104 -0
- data/lib/guard/commands/all.rb +37 -0
- data/lib/guard/commands/change.rb +31 -0
- data/lib/guard/commands/notification.rb +26 -0
- data/lib/guard/commands/pause.rb +29 -0
- data/lib/guard/commands/reload.rb +36 -0
- data/lib/guard/commands/scope.rb +38 -0
- data/lib/guard/commands/show.rb +24 -0
- data/lib/guard/config.rb +18 -0
- data/lib/guard/deprecated/dsl.rb +45 -0
- data/lib/guard/deprecated/evaluator.rb +39 -0
- data/lib/guard/deprecated/guard.rb +328 -0
- data/lib/guard/deprecated/guardfile.rb +84 -0
- data/lib/guard/deprecated/watcher.rb +27 -0
- data/lib/guard/dsl.rb +332 -363
- data/lib/guard/dsl_describer.rb +132 -122
- data/lib/guard/dsl_reader.rb +51 -0
- data/lib/guard/group.rb +34 -14
- data/lib/guard/guardfile/evaluator.rb +232 -0
- data/lib/guard/guardfile/generator.rb +128 -0
- data/lib/guard/guardfile.rb +24 -60
- data/lib/guard/interactor.rb +31 -255
- data/lib/guard/internals/debugging.rb +68 -0
- data/lib/guard/internals/groups.rb +40 -0
- data/lib/guard/internals/helpers.rb +13 -0
- data/lib/guard/internals/plugins.rb +53 -0
- data/lib/guard/internals/queue.rb +51 -0
- data/lib/guard/internals/scope.rb +121 -0
- data/lib/guard/internals/session.rb +180 -0
- data/lib/guard/internals/state.rb +25 -0
- data/lib/guard/internals/tracing.rb +33 -0
- data/lib/guard/internals/traps.rb +10 -0
- data/lib/guard/jobs/base.rb +21 -0
- data/lib/guard/jobs/pry_wrapper.rb +336 -0
- data/lib/guard/jobs/sleep.rb +26 -0
- data/lib/guard/notifier.rb +46 -212
- data/lib/guard/options.rb +22 -0
- data/lib/guard/plugin.rb +303 -0
- data/lib/guard/plugin_util.rb +191 -0
- data/lib/guard/rake_task.rb +42 -0
- data/lib/guard/runner.rb +80 -140
- data/lib/guard/templates/Guardfile +14 -0
- data/lib/guard/terminal.rb +13 -0
- data/lib/guard/ui/colors.rb +56 -0
- data/lib/guard/ui/config.rb +70 -0
- data/lib/guard/ui/logger.rb +30 -0
- data/lib/guard/ui.rb +163 -128
- data/lib/guard/version.rb +1 -2
- data/lib/guard/watcher/pattern/deprecated_regexp.rb +45 -0
- data/lib/guard/watcher/pattern/match_result.rb +18 -0
- data/lib/guard/watcher/pattern/matcher.rb +33 -0
- data/lib/guard/watcher/pattern/pathname_path.rb +15 -0
- data/lib/guard/watcher/pattern/simple_path.rb +23 -0
- data/lib/guard/watcher/pattern.rb +24 -0
- data/lib/guard/watcher.rb +52 -95
- data/lib/guard.rb +108 -376
- data/lib/tasks/releaser.rb +116 -0
- data/man/guard.1 +12 -9
- data/man/guard.1.html +18 -12
- metadata +148 -77
- data/images/guard.png +0 -0
- data/lib/guard/guard.rb +0 -156
- data/lib/guard/hook.rb +0 -120
- data/lib/guard/interactors/coolline.rb +0 -64
- data/lib/guard/interactors/helpers/completion.rb +0 -32
- data/lib/guard/interactors/helpers/terminal.rb +0 -46
- data/lib/guard/interactors/readline.rb +0 -94
- data/lib/guard/interactors/simple.rb +0 -19
- data/lib/guard/notifiers/emacs.rb +0 -69
- data/lib/guard/notifiers/gntp.rb +0 -118
- data/lib/guard/notifiers/growl.rb +0 -99
- data/lib/guard/notifiers/growl_notify.rb +0 -92
- data/lib/guard/notifiers/libnotify.rb +0 -96
- data/lib/guard/notifiers/notifysend.rb +0 -84
- data/lib/guard/notifiers/rb_notifu.rb +0 -102
- data/lib/guard/notifiers/terminal_notifier.rb +0 -66
- data/lib/guard/notifiers/tmux.rb +0 -69
- data/lib/guard/version.rbc +0 -130
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'guard/ui'
|
3
|
-
|
4
|
-
module Guard
|
5
|
-
module Notifier
|
6
|
-
|
7
|
-
# System notifications using the [GrowlNotify](https://github.com/scottdavis/growl_notify) gem.
|
8
|
-
#
|
9
|
-
# This gem is available for OS X and sends system notifications to
|
10
|
-
# [Growl](http://growl.info) through AppleScript.
|
11
|
-
#
|
12
|
-
# @example Add the `growl_notify` gem to your `Gemfile`
|
13
|
-
# group :development
|
14
|
-
# gem 'growl_notify'
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# @example Add the `:growl_notify` notifier to your `Guardfile`
|
18
|
-
# notification :growl_notify
|
19
|
-
#
|
20
|
-
# @example Add the `:growl_notify` notifier with configuration options to your `Guardfile`
|
21
|
-
# notification :growl_notify, :sticky => true
|
22
|
-
#
|
23
|
-
module GrowlNotify
|
24
|
-
extend self
|
25
|
-
|
26
|
-
# Default options for growl_notify gem
|
27
|
-
DEFAULTS = {
|
28
|
-
:sticky => false,
|
29
|
-
:priority => 0
|
30
|
-
}
|
31
|
-
|
32
|
-
# Test if the notification library is available.
|
33
|
-
#
|
34
|
-
# @param [Boolean] silent true if no error messages should be shown
|
35
|
-
# @return [Boolean] the availability status
|
36
|
-
#
|
37
|
-
def available?(silent = false)
|
38
|
-
if RbConfig::CONFIG['host_os'] =~ /darwin/
|
39
|
-
require 'growl_notify'
|
40
|
-
|
41
|
-
begin
|
42
|
-
if ::GrowlNotify.application_name != 'Guard'
|
43
|
-
::GrowlNotify.config do |c|
|
44
|
-
c.notifications = %w(success pending failed notify)
|
45
|
-
c.default_notifications = 'notify'
|
46
|
-
c.application_name = 'Guard'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
true
|
51
|
-
|
52
|
-
rescue ::GrowlNotify::GrowlNotFound
|
53
|
-
::Guard::UI.error 'Please install Growl from http://growl.info' unless silent
|
54
|
-
false
|
55
|
-
end
|
56
|
-
|
57
|
-
else
|
58
|
-
::Guard::UI.error 'The :growl_notify notifier runs only on Mac OS X.' unless silent
|
59
|
-
false
|
60
|
-
end
|
61
|
-
|
62
|
-
rescue LoadError, NameError
|
63
|
-
::Guard::UI.error "Please add \"gem 'growl_notify'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent
|
64
|
-
false
|
65
|
-
end
|
66
|
-
|
67
|
-
# Show a system notification.
|
68
|
-
#
|
69
|
-
# @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
|
70
|
-
# @param [String] title the notification title
|
71
|
-
# @param [String] message the notification message body
|
72
|
-
# @param [String] image the path to the notification image
|
73
|
-
# @param [Hash] options additional notification library options
|
74
|
-
# @option options [Boolean] sticky if the message should stick to the screen
|
75
|
-
# @option options [Integer] priority the importance of message from -2 (very low) to 2 (emergency)
|
76
|
-
#
|
77
|
-
def notify(type, title, message, image, options = { })
|
78
|
-
require 'growl_notify'
|
79
|
-
|
80
|
-
::GrowlNotify.send_notification(DEFAULTS.merge(options).merge({
|
81
|
-
:application_name => 'Guard',
|
82
|
-
:with_name => type,
|
83
|
-
:title => title,
|
84
|
-
:description => message,
|
85
|
-
:icon => image
|
86
|
-
}))
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
@@ -1,96 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'guard/ui'
|
3
|
-
|
4
|
-
module Guard
|
5
|
-
module Notifier
|
6
|
-
|
7
|
-
# System notifications using the [libnotify](https://github.com/splattael/libnotify) gem.
|
8
|
-
#
|
9
|
-
# This gem is available for Linux, FreeBSD, OpenBSD and Solaris and sends system notifications to
|
10
|
-
# Gnome [libnotify](http://developer.gnome.org/libnotify):
|
11
|
-
#
|
12
|
-
# @example Add the `libnotify` gem to your `Gemfile`
|
13
|
-
# group :development
|
14
|
-
# gem 'libnotify'
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# @example Add the `:libnotify` notifier to your `Guardfile`
|
18
|
-
# notification :libnotify
|
19
|
-
#
|
20
|
-
# @example Add the `:libnotify` notifier with configuration options to your `Guardfile`
|
21
|
-
# notification :libnotify, :timeout => 5, :transient => true, :append => false, :urgency => :critical
|
22
|
-
#
|
23
|
-
module Libnotify
|
24
|
-
extend self
|
25
|
-
|
26
|
-
# Default options for libnotify gem
|
27
|
-
DEFAULTS = {
|
28
|
-
:transient => false,
|
29
|
-
:append => true,
|
30
|
-
:timeout => 3
|
31
|
-
}
|
32
|
-
|
33
|
-
# Test if the notification library is available.
|
34
|
-
#
|
35
|
-
# @param [Boolean] silent true if no error messages should be shown
|
36
|
-
# @return [Boolean] the availability status
|
37
|
-
#
|
38
|
-
def available?(silent = false)
|
39
|
-
if RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/
|
40
|
-
require 'libnotify'
|
41
|
-
|
42
|
-
true
|
43
|
-
|
44
|
-
else
|
45
|
-
::Guard::UI.error 'The :libnotify notifier runs only on Linux, FreeBSD, OpenBSD and Solaris.' unless silent
|
46
|
-
false
|
47
|
-
end
|
48
|
-
|
49
|
-
rescue LoadError
|
50
|
-
::Guard::UI.error "Please add \"gem 'libnotify'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent
|
51
|
-
false
|
52
|
-
end
|
53
|
-
|
54
|
-
# Show a system notification.
|
55
|
-
#
|
56
|
-
# @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
|
57
|
-
# @param [String] title the notification title
|
58
|
-
# @param [String] message the notification message body
|
59
|
-
# @param [String] image the path to the notification image
|
60
|
-
# @param [Hash] options additional notification library options
|
61
|
-
# @option options [Boolean] transient keep the notifications around after display
|
62
|
-
# @option options [Boolean] append append onto existing notification
|
63
|
-
# @option options [Number, Boolean] timeout the number of seconds to display (1.5 (s), 1000 (ms), false)
|
64
|
-
#
|
65
|
-
def notify(type, title, message, image, options = { })
|
66
|
-
require 'libnotify'
|
67
|
-
|
68
|
-
options = DEFAULTS.merge(options).merge({
|
69
|
-
:summary => title,
|
70
|
-
:body => message,
|
71
|
-
:icon_path => image
|
72
|
-
})
|
73
|
-
options[:urgency] ||= libnotify_urgency(type)
|
74
|
-
::Libnotify.show(options)
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
|
79
|
-
# Convert Guards notification type to the best matching
|
80
|
-
# libnotify urgency.
|
81
|
-
#
|
82
|
-
# @param [String] type the Guard notification type
|
83
|
-
# @return [Symbol] the libnotify urgency
|
84
|
-
#
|
85
|
-
def libnotify_urgency(type)
|
86
|
-
case type
|
87
|
-
when 'failed'
|
88
|
-
:normal
|
89
|
-
else
|
90
|
-
:low
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'guard/ui'
|
3
|
-
|
4
|
-
module Guard
|
5
|
-
module Notifier
|
6
|
-
|
7
|
-
# System notifications using notify-send, a binary that ships with
|
8
|
-
# the libnotify-bin package on many Debian-based distributions.
|
9
|
-
#
|
10
|
-
# @example Add the `:notifysend` notifier to your `Guardfile`
|
11
|
-
# notification :notifysend
|
12
|
-
#
|
13
|
-
module NotifySend
|
14
|
-
extend self
|
15
|
-
|
16
|
-
# Default options for the notify-send program
|
17
|
-
DEFAULTS = {
|
18
|
-
:t => 3000, # Default timeout is 3000ms
|
19
|
-
:h => 'int:transient:1' # Automatically close the notification
|
20
|
-
}
|
21
|
-
|
22
|
-
# Full list of options supported by notify-send
|
23
|
-
SUPPORTED = [:u, :t, :i, :c, :h]
|
24
|
-
|
25
|
-
# Test if the notification program is available.
|
26
|
-
#
|
27
|
-
# @param [Boolean] silent true if no error messages should be shown
|
28
|
-
# @return [Boolean] the availability status
|
29
|
-
#
|
30
|
-
def available?(silent = false)
|
31
|
-
if (RbConfig::CONFIG['host_os'] =~ /linux|freebsd|openbsd|sunos|solaris/) and (not `which notify-send`.empty?)
|
32
|
-
true
|
33
|
-
else
|
34
|
-
::Guard::UI.error 'The :notifysend notifier runs only on Linux, FreeBSD, OpenBSD and Solaris with the libnotify-bin package installed.' unless silent
|
35
|
-
false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Show a system notification.
|
40
|
-
#
|
41
|
-
# @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
|
42
|
-
# @param [String] title the notification title
|
43
|
-
# @param [String] message the notification message body
|
44
|
-
# @param [String] image the path to the notification image
|
45
|
-
# @param [Hash] options additional notification library options
|
46
|
-
# @option options [String] c the notification category
|
47
|
-
# @option options [Number] t the number of milliseconds to display (1000, 3000)
|
48
|
-
#
|
49
|
-
def notify(type, title, message, image, options = { })
|
50
|
-
command = "notify-send '#{title}' '#{message}'"
|
51
|
-
options = DEFAULTS.merge(options).merge({
|
52
|
-
:i => image
|
53
|
-
})
|
54
|
-
options[:u] ||= notifysend_urgency(type)
|
55
|
-
system(to_command_string(command, SUPPORTED, options))
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
# Convert Guards notification type to the best matching
|
61
|
-
# notify-send urgency.
|
62
|
-
#
|
63
|
-
# @param [String] type the Guard notification type
|
64
|
-
# @return [String] the notify-send urgency
|
65
|
-
#
|
66
|
-
def notifysend_urgency(type)
|
67
|
-
{ 'failed' => 'normal', 'pending' => 'low' }.fetch(type, 'low')
|
68
|
-
end
|
69
|
-
|
70
|
-
# Build a shell command out of a command string and option hash.
|
71
|
-
#
|
72
|
-
# @param [String] command the command execute
|
73
|
-
# @param [Array] supported list of supported option flags
|
74
|
-
# @param [Hash] options additional command options
|
75
|
-
# @return [String] the command and its options converted to a shell command.
|
76
|
-
#
|
77
|
-
def to_command_string(command, supported, options = {})
|
78
|
-
options.reduce(command) do |cmd, (flag, value)|
|
79
|
-
supported.include?(flag) ? cmd + " -#{ flag } '#{ value }'" : cmd
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'guard/ui'
|
3
|
-
|
4
|
-
module Guard
|
5
|
-
module Notifier
|
6
|
-
|
7
|
-
# System notifications using the [rb-notifu](https://github.com/stereobooster/rb-notifu) gem.
|
8
|
-
#
|
9
|
-
# This gem is available for Windows and sends system notifications to
|
10
|
-
# [Notifu](http://www.paralint.com/projects/notifu/index.html):
|
11
|
-
#
|
12
|
-
# @example Add the `rb-notifu` gem to your `Gemfile`
|
13
|
-
# group :development
|
14
|
-
# gem 'rb-notifu'
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# @example Add the `:notifu` notifier to your `Guardfile`
|
18
|
-
# notification :notifu
|
19
|
-
#
|
20
|
-
# @example Add the `:notifu` notifier with configuration options to your `Guardfile`
|
21
|
-
# notification :notifu, :time => 5, :nosound => true, :xp => true
|
22
|
-
#
|
23
|
-
module Notifu
|
24
|
-
extend self
|
25
|
-
|
26
|
-
# Default options for rb-notifu gem
|
27
|
-
DEFAULTS = {
|
28
|
-
:time => 3,
|
29
|
-
:icon => false,
|
30
|
-
:baloon => false,
|
31
|
-
:nosound => false,
|
32
|
-
:noquiet => false,
|
33
|
-
:xp => false
|
34
|
-
}
|
35
|
-
|
36
|
-
# Test if the notification library is available.
|
37
|
-
#
|
38
|
-
# @param [Boolean] silent true if no error messages should be shown
|
39
|
-
# @return [Boolean] the availability status
|
40
|
-
#
|
41
|
-
def available?(silent = false)
|
42
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
|
43
|
-
require 'rb-notifu'
|
44
|
-
|
45
|
-
true
|
46
|
-
|
47
|
-
else
|
48
|
-
::Guard::UI.error 'The :notifu notifier runs only on Windows.' unless silent
|
49
|
-
false
|
50
|
-
end
|
51
|
-
|
52
|
-
rescue LoadError
|
53
|
-
::Guard::UI.error "Please add \"gem 'rb-notifu'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent
|
54
|
-
false
|
55
|
-
end
|
56
|
-
|
57
|
-
# Show a system notification.
|
58
|
-
#
|
59
|
-
# @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
|
60
|
-
# @param [String] title the notification title
|
61
|
-
# @param [String] message the notification message body
|
62
|
-
# @param [String] image the path to the notification image
|
63
|
-
# @param [Hash] options additional notification library options
|
64
|
-
# @option options [Number] time the number of seconds to display (0 for infinit)
|
65
|
-
# @option options [Boolean] icon specify an icon to use ("parent" uses the icon of the parent process)
|
66
|
-
# @option options [Boolean] baloon enable ballon tips in the registry (for this user only)
|
67
|
-
# @option options [Boolean] nosound do not play a sound when the tooltip is displayed
|
68
|
-
# @option options [Boolean] noquiet show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
|
69
|
-
# @option options [Boolean] xp use IUserNotification interface event when IUserNotification2 is available
|
70
|
-
#
|
71
|
-
def notify(type, title, message, image, options = { })
|
72
|
-
require 'rb-notifu'
|
73
|
-
|
74
|
-
::Notifu.show(DEFAULTS.merge(options).merge({
|
75
|
-
:type => notifu_type(type),
|
76
|
-
:title => title,
|
77
|
-
:message => message
|
78
|
-
}))
|
79
|
-
end
|
80
|
-
|
81
|
-
private
|
82
|
-
|
83
|
-
# Convert Guards notification type to the best matching
|
84
|
-
# Notifu type.
|
85
|
-
#
|
86
|
-
# @param [String] type the Guard notification type
|
87
|
-
# @return [Symbol] the Notify notification type
|
88
|
-
#
|
89
|
-
def notifu_type(type)
|
90
|
-
case type
|
91
|
-
when 'failed'
|
92
|
-
:error
|
93
|
-
when 'pending'
|
94
|
-
:warn
|
95
|
-
else
|
96
|
-
:info
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'guard/ui'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
module Notifier
|
5
|
-
|
6
|
-
# System notifications using the [terminal-notifier-guard](https://github.com/Springest/terminal-notifier-guard gem.
|
7
|
-
#
|
8
|
-
# This gem is available for OS X 10.8 Mountain Lion and sends notifications to the OS X
|
9
|
-
# notification center.
|
10
|
-
#
|
11
|
-
# @example Add the `terminal-notifier-guard` gem to your `Gemfile`
|
12
|
-
# group :development
|
13
|
-
# gem 'terminal-notifier-guard'
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# @example Add the `:terminal_notifier` notifier to your `Guardfile`
|
17
|
-
# notification :terminal_notifier
|
18
|
-
#
|
19
|
-
# @example Add the `:terminal_notifier` notifier with configuration options to your `Guardfile`
|
20
|
-
# notification :terminal_notifier, app_name: "MyApp"
|
21
|
-
#
|
22
|
-
module TerminalNotifier
|
23
|
-
extend self
|
24
|
-
|
25
|
-
# Test if the notification library is available.
|
26
|
-
#
|
27
|
-
# @param [Boolean] silent true if no error messages should be shown
|
28
|
-
# @return [Boolean] the availability status
|
29
|
-
#
|
30
|
-
def available?(silent=false)
|
31
|
-
require 'terminal-notifier-guard'
|
32
|
-
|
33
|
-
if ::TerminalNotifier::Guard.available?
|
34
|
-
true
|
35
|
-
else
|
36
|
-
::Guard::UI.error 'The :terminal_notifier only runs on Mac OS X 10.8 and later.' unless silent
|
37
|
-
false
|
38
|
-
end
|
39
|
-
|
40
|
-
rescue LoadError, NameError
|
41
|
-
::Guard::UI.error "Please add \"gem 'terminal-notifier-guard'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent
|
42
|
-
false
|
43
|
-
end
|
44
|
-
|
45
|
-
# Show a system notification.
|
46
|
-
#
|
47
|
-
# @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
|
48
|
-
# @param [String] title the notification title
|
49
|
-
# @param [String] message the notification message body
|
50
|
-
# @param [String] image the path to the notification image (ignored)
|
51
|
-
# @param [Hash] options additional notification library options
|
52
|
-
# @option options [String] app_name name of your app
|
53
|
-
# @option options [String] execute a command
|
54
|
-
# @option options [String] activate an app bundle
|
55
|
-
# @option options [String] open some url or file
|
56
|
-
#
|
57
|
-
def notify(type, title, message, image, options = { })
|
58
|
-
require 'terminal-notifier-guard'
|
59
|
-
options[:title] = title || [options[:app_name] || 'Guard', type.downcase.capitalize].join(' ')
|
60
|
-
options.merge!(:type => type.to_sym, :message => message)
|
61
|
-
options.delete :app_name if options[:app_name]
|
62
|
-
::TerminalNotifier::Guard.execute(false, options)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
data/lib/guard/notifiers/tmux.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
module Guard
|
2
|
-
module Notifier
|
3
|
-
|
4
|
-
# Default options for Tmux
|
5
|
-
|
6
|
-
# Changes the color of the Tmux status bar
|
7
|
-
#
|
8
|
-
# @example Add the `:tmux` notifier to your `Guardfile`
|
9
|
-
# notification :tmux
|
10
|
-
#
|
11
|
-
module Tmux
|
12
|
-
extend self
|
13
|
-
|
14
|
-
DEFAULTS = {
|
15
|
-
:client => 'tmux',
|
16
|
-
:tmux_environment => 'TMUX',
|
17
|
-
:success => 'green',
|
18
|
-
:failed => 'red',
|
19
|
-
:default => 'green'
|
20
|
-
}
|
21
|
-
|
22
|
-
# Test if currently running in a Tmux session
|
23
|
-
#
|
24
|
-
# @param [Boolean] silent true if no error messages should be shown
|
25
|
-
# @return [Boolean] the availability status
|
26
|
-
#
|
27
|
-
def available?(silent = false)
|
28
|
-
if ENV[DEFAULTS[:tmux_environment]].nil?
|
29
|
-
::Guard::UI.error 'The :tmux notifier runs only on when Guard is executed inside of a tmux session.' unless silent
|
30
|
-
false
|
31
|
-
else
|
32
|
-
true
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Show a system notification.
|
37
|
-
#
|
38
|
-
# @param [String] type the notification type. Either 'success', 'pending', 'failed' or 'notify'
|
39
|
-
# @param [String] title the notification title
|
40
|
-
# @param [String] message the notification message body
|
41
|
-
# @param [String] image the path to the notification image
|
42
|
-
# @param [Hash] options additional notification library options
|
43
|
-
# @option options [Boolean] sticky make the notification sticky
|
44
|
-
# @option options [String, Integer] priority specify an int or named key (default is 0)
|
45
|
-
#
|
46
|
-
def notify(type, title, message, image, options = { })
|
47
|
-
color = tmux_color type, options
|
48
|
-
system("#{ DEFAULTS[:client] } set -g status-left-bg #{ color }")
|
49
|
-
end
|
50
|
-
|
51
|
-
# Get the Tmux color for the notification type.
|
52
|
-
# You can configure your own color by overwriting the defaults.
|
53
|
-
#
|
54
|
-
# @param [String] type the notification type
|
55
|
-
# @return [String] the name of the emacs color
|
56
|
-
#
|
57
|
-
def tmux_color(type, options = { })
|
58
|
-
case type
|
59
|
-
when 'success'
|
60
|
-
options[:success] || DEFAULTS[:success]
|
61
|
-
when 'failed'
|
62
|
-
options[:failed] || DEFAULTS[:failed]
|
63
|
-
else
|
64
|
-
options[:default] || DEFAULTS[:default]
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
data/lib/guard/version.rbc
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
!RBIX
|
2
|
-
9595534255132031488
|
3
|
-
x
|
4
|
-
M
|
5
|
-
1
|
6
|
-
n
|
7
|
-
n
|
8
|
-
x
|
9
|
-
10
|
10
|
-
__script__
|
11
|
-
i
|
12
|
-
28
|
13
|
-
99
|
14
|
-
7
|
15
|
-
0
|
16
|
-
65
|
17
|
-
49
|
18
|
-
1
|
19
|
-
2
|
20
|
-
13
|
21
|
-
99
|
22
|
-
12
|
23
|
-
7
|
24
|
-
2
|
25
|
-
12
|
26
|
-
7
|
27
|
-
3
|
28
|
-
12
|
29
|
-
65
|
30
|
-
12
|
31
|
-
49
|
32
|
-
4
|
33
|
-
4
|
34
|
-
15
|
35
|
-
49
|
36
|
-
2
|
37
|
-
0
|
38
|
-
15
|
39
|
-
2
|
40
|
-
11
|
41
|
-
I
|
42
|
-
6
|
43
|
-
I
|
44
|
-
0
|
45
|
-
I
|
46
|
-
0
|
47
|
-
I
|
48
|
-
0
|
49
|
-
n
|
50
|
-
p
|
51
|
-
5
|
52
|
-
x
|
53
|
-
5
|
54
|
-
Guard
|
55
|
-
x
|
56
|
-
11
|
57
|
-
open_module
|
58
|
-
x
|
59
|
-
15
|
60
|
-
__module_init__
|
61
|
-
M
|
62
|
-
1
|
63
|
-
n
|
64
|
-
n
|
65
|
-
x
|
66
|
-
5
|
67
|
-
Guard
|
68
|
-
i
|
69
|
-
12
|
70
|
-
5
|
71
|
-
66
|
72
|
-
65
|
73
|
-
7
|
74
|
-
0
|
75
|
-
7
|
76
|
-
1
|
77
|
-
64
|
78
|
-
49
|
79
|
-
2
|
80
|
-
2
|
81
|
-
11
|
82
|
-
I
|
83
|
-
3
|
84
|
-
I
|
85
|
-
0
|
86
|
-
I
|
87
|
-
0
|
88
|
-
I
|
89
|
-
0
|
90
|
-
n
|
91
|
-
p
|
92
|
-
3
|
93
|
-
x
|
94
|
-
7
|
95
|
-
VERSION
|
96
|
-
s
|
97
|
-
5
|
98
|
-
1.3.1
|
99
|
-
x
|
100
|
-
9
|
101
|
-
const_set
|
102
|
-
p
|
103
|
-
3
|
104
|
-
I
|
105
|
-
2
|
106
|
-
I
|
107
|
-
3
|
108
|
-
I
|
109
|
-
c
|
110
|
-
x
|
111
|
-
52
|
112
|
-
/Users/michi/Repositories/guard/lib/guard/version.rb
|
113
|
-
p
|
114
|
-
0
|
115
|
-
x
|
116
|
-
13
|
117
|
-
attach_method
|
118
|
-
p
|
119
|
-
3
|
120
|
-
I
|
121
|
-
0
|
122
|
-
I
|
123
|
-
1
|
124
|
-
I
|
125
|
-
1c
|
126
|
-
x
|
127
|
-
52
|
128
|
-
/Users/michi/Repositories/guard/lib/guard/version.rb
|
129
|
-
p
|
130
|
-
0
|