guard 2.0.1 → 2.0.2
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 +4 -4
- data/lib/guard/dsl_describer.rb +1 -1
- data/lib/guard/notifiers/base.rb +4 -5
- data/lib/guard/notifiers/emacs.rb +1 -1
- data/lib/guard/notifiers/file_notifier.rb +1 -1
- data/lib/guard/notifiers/gntp.rb +1 -1
- data/lib/guard/notifiers/growl.rb +2 -2
- data/lib/guard/notifiers/growl_notify.rb +1 -1
- data/lib/guard/notifiers/libnotify.rb +1 -1
- data/lib/guard/notifiers/notifysend.rb +1 -1
- data/lib/guard/notifiers/rb_notifu.rb +1 -1
- data/lib/guard/notifiers/terminal_notifier.rb +2 -2
- data/lib/guard/notifiers/terminal_title.rb +1 -1
- data/lib/guard/notifiers/tmux.rb +13 -6
- data/lib/guard/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2904fe4ebe6903b8c0c69b0c9b6fd419041552fe
|
4
|
+
data.tar.gz: bdf69fc777ed5a8ebdc63822d3013d04663cc913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348997dc9b494a611354c55a179187d052331d7538b22ec9b76093e5a56c1d03a216fd048cee7508636804a296251f260aef218c951aee73f5fe3788ce692050
|
7
|
+
data.tar.gz: 75e6bb26d53e19d4cfe24561e465be64de99e4a49c7254cf0f37a6ebd1368221ba1e5cd5dbaf1e2e02aaff7f667438e0422193b2541ed1ed3c4ea01e57919cc9
|
data/lib/guard/dsl_describer.rb
CHANGED
@@ -90,7 +90,7 @@ module Guard
|
|
90
90
|
name = definition[0]
|
91
91
|
clazz = definition[1]
|
92
92
|
available = clazz.available?(silent: true) ? '✔' : '✘'
|
93
|
-
notifier = ::Guard::Notifier.notifiers.find{ |n| n[:name] == name }
|
93
|
+
notifier = ::Guard::Notifier.notifiers.find { |n| n[:name] == name }
|
94
94
|
used = notifier ? '✔' : '✘'
|
95
95
|
options = notifier ? notifier[:options] : {}
|
96
96
|
defaults = clazz.const_defined?(:DEFAULTS) ? clazz.const_get(:DEFAULTS) : {}
|
data/lib/guard/notifiers/base.rb
CHANGED
@@ -43,21 +43,20 @@ module Guard
|
|
43
43
|
# @return [Boolean] the availability status
|
44
44
|
#
|
45
45
|
def self.available?(opts = {})
|
46
|
-
options = { silent: false }.merge(opts)
|
47
|
-
|
48
46
|
unless _supported_host?
|
49
47
|
hosts = supported_hosts.map { |host| HOSTS[host.to_sym] }.join(', ')
|
50
|
-
::Guard::UI.error "The :#{name} notifier runs only on #{hosts}." unless
|
48
|
+
::Guard::UI.error "The :#{name} notifier runs only on #{hosts}." unless opts.fetch(:silent) { false }
|
51
49
|
return false
|
52
50
|
end
|
53
51
|
|
54
52
|
true
|
55
53
|
end
|
56
54
|
|
57
|
-
# This method must be
|
55
|
+
# This method must be overriden.
|
58
56
|
#
|
59
57
|
def notify(message, opts = {})
|
60
|
-
|
58
|
+
opts.replace(options.merge(opts))
|
59
|
+
normalize_standard_options!(opts)
|
61
60
|
end
|
62
61
|
|
63
62
|
# Returns the title of the notifier.
|
data/lib/guard/notifiers/gntp.rb
CHANGED
@@ -69,8 +69,8 @@ module Guard
|
|
69
69
|
# @option opts [Boolean] sticky make the notification sticky
|
70
70
|
#
|
71
71
|
def notify(message, opts = {})
|
72
|
+
super
|
72
73
|
self.class.require_gem_safely
|
73
|
-
normalize_standard_options!(opts)
|
74
74
|
|
75
75
|
opts = DEFAULTS.merge(
|
76
76
|
name: opts.delete(:type).to_s,
|
@@ -71,9 +71,9 @@ module Guard
|
|
71
71
|
# notifications
|
72
72
|
#
|
73
73
|
def notify(message, opts = {})
|
74
|
-
|
75
|
-
normalize_standard_options!(opts)
|
74
|
+
super
|
76
75
|
opts.delete(:type)
|
76
|
+
self.class.require_gem_safely
|
77
77
|
|
78
78
|
opts = DEFAULTS.merge(opts).merge(name: 'Guard')
|
79
79
|
|
@@ -50,9 +50,9 @@ module Guard
|
|
50
50
|
# @option opts [String] open some url or file
|
51
51
|
#
|
52
52
|
def notify(message, opts = {})
|
53
|
+
title = opts[:title] || options[:title]
|
54
|
+
super
|
53
55
|
self.class.require_gem_safely
|
54
|
-
title = opts[:title]
|
55
|
-
normalize_standard_options!(opts)
|
56
56
|
|
57
57
|
opts.delete(:image)
|
58
58
|
opts[:title] = title || [opts.delete(:app_name) { 'Guard' }, opts[:type].downcase.capitalize].join(' ')
|
data/lib/guard/notifiers/tmux.rb
CHANGED
@@ -30,6 +30,7 @@ module Guard
|
|
30
30
|
default_message_format: '%s - %s',
|
31
31
|
default_message_color: 'white',
|
32
32
|
line_separator: ' - ',
|
33
|
+
change_color: true,
|
33
34
|
color_location: 'status-left-bg'
|
34
35
|
}
|
35
36
|
|
@@ -52,8 +53,10 @@ module Guard
|
|
52
53
|
# use of a color based notification, changing the background color of the
|
53
54
|
# `color_location` to the color defined in either the `success`,
|
54
55
|
# `failed`, `pending` or `default`, depending on the notification type.
|
55
|
-
#
|
56
|
-
# by setting `display_message`
|
56
|
+
#
|
57
|
+
# You may enable an extra explicit message by setting `display_message`
|
58
|
+
# to true, and may further disable the colorization by setting
|
59
|
+
# `change_color` to false.
|
57
60
|
#
|
58
61
|
# @param [String] title the notification title
|
59
62
|
# @param [Hash] opts additional notification library options
|
@@ -61,19 +64,23 @@ module Guard
|
|
61
64
|
# 'pending', 'failed' or 'notify'
|
62
65
|
# @option opts [String] message the notification message body
|
63
66
|
# @option opts [String] image the path to the notification image
|
67
|
+
# @option opts [Boolean] change_color whether to show a color
|
68
|
+
# notification
|
64
69
|
# @option opts [String] color_location the location where to draw the
|
65
70
|
# color notification
|
66
71
|
# @option opts [Boolean] display_message whether to display a message
|
67
72
|
# or not
|
68
73
|
#
|
69
74
|
def notify(message, opts = {})
|
70
|
-
|
75
|
+
super
|
71
76
|
opts.delete(:image)
|
72
77
|
|
73
|
-
|
74
|
-
|
78
|
+
if opts.fetch(:change_color, DEFAULTS[:change_color])
|
79
|
+
color_location = opts.fetch(:color_location, DEFAULTS[:color_location])
|
80
|
+
color = tmux_color(opts[:type], opts)
|
75
81
|
|
76
|
-
|
82
|
+
_run_client "set #{ color_location } #{ color }"
|
83
|
+
end
|
77
84
|
|
78
85
|
if opts.fetch(:display_message, DEFAULTS[:display_message])
|
79
86
|
display_message(opts.delete(:type).to_s, opts.delete(:title), message, opts)
|
data/lib/guard/version.rb
CHANGED