Browse files

Ensure consistent code style for all notifiers.

  • Loading branch information...
1 parent bd213c8 commit e58c92d30ef744e582c30a019467531db2b1db1e @netzpirat netzpirat committed Sep 26, 2012
View
10 lib/guard/notifiers/emacs.rb
@@ -5,9 +5,9 @@ module Notifier
# Default options for EmacsClient
DEFAULTS = {
- :client => 'emacsclient',
+ :client => 'emacsclient',
:success => 'ForestGreen',
- :failed => 'Firebrick',
+ :failed => 'Firebrick',
:default => 'Black',
}
@@ -25,9 +25,9 @@ module Emacs
# @return [Boolean] the availability status
#
def available?(silent = false)
- result = `#{DEFAULTS[:client]} --eval '1' 2> /dev/null || echo 'N/A'`
+ result = `#{ DEFAULTS[:client] } --eval '1' 2> /dev/null || echo 'N/A'`
- if result.chomp! == "N/A"
+ if result.chomp! == 'N/A'
false
else
true
@@ -45,7 +45,7 @@ def available?(silent = false)
# @option options [String, Integer] priority specify an int or named key (default is 0)
#
def notify(type, title, message, image, options = { })
- system(%(#{DEFAULTS[:client]} --eval "(set-face-background 'modeline \\"#{emacs_color(type)}\\")"))
+ system(%(#{ DEFAULTS[:client] } --eval "(set-face-background 'modeline \\"#{ emacs_color(type) }\\")"))
end
# Get the Emacs color for the notification type.
View
2 lib/guard/notifiers/growl_notify.rb
@@ -41,7 +41,7 @@ def available?(silent = false)
begin
if ::GrowlNotify.application_name != 'Guard'
::GrowlNotify.config do |c|
- c.notifications = ['success', 'pending', 'failed', 'notify']
+ c.notifications = %w(success pending failed notify)
c.default_notifications = 'notify'
c.application_name = 'Guard'
end
View
2 lib/guard/notifiers/notifysend.rb
@@ -76,7 +76,7 @@ def notifysend_urgency(type)
#
def to_command_string(command, supported, options = {})
options.reduce(command) do |cmd, (flag, value)|
- supported.include?(flag) ? cmd + " -#{flag} '#{value}'" : cmd
+ supported.include?(flag) ? cmd + " -#{ flag } '#{ value }'" : cmd
end
end
end
View
12 lib/guard/notifiers/tmux.rb
@@ -12,11 +12,11 @@ module Tmux
extend self
DEFAULTS = {
- :client => 'tmux',
+ :client => 'tmux',
:tmux_environment => 'TMUX',
- :success => 'green',
- :failed => 'red',
- :default => 'green',
+ :success => 'green',
+ :failed => 'red',
+ :default => 'green'
}
# Test if currently running in a Tmux session
@@ -26,7 +26,7 @@ module Tmux
#
def available?(silent = false)
if ENV[DEFAULTS[:tmux_environment]].nil?
- ::Guard::UI.error 'The :tmux notifier runs only on when guard is executed inside of a tmux session.' unless silent
+ ::Guard::UI.error 'The :tmux notifier runs only on when Guard is executed inside of a tmux session.' unless silent
false
else
true
@@ -45,7 +45,7 @@ def available?(silent = false)
#
def notify(type, title, message, image, options = { })
color = tmux_color type, options
- system("#{DEFAULTS[:client]} set -g status-left-bg #{color}")
+ system("#{ DEFAULTS[:client] } set -g status-left-bg #{ color }")
end
# Get the Tmux color for the notification type.

0 comments on commit e58c92d

Please sign in to comment.