Skip to content

Commit

Permalink
Added a nice Guard icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wouter de Vos committed Oct 23, 2014
1 parent c44d970 commit f9d8c62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Binary file added icons/guard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion lib/terminal-notifier-guard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Guard
VERSION = "1.6.1"
BIN_PATH = "/usr/local/Cellar/terminal-notifier/1.6.1/terminal-notifier.app/Contents/MacOS/terminal-notifier"
ICONS_PATH = File.expand_path("../../icons", __FILE__)
GUARD_ICON = File.join(ICONS_PATH, 'guard.png')

# Returns wether or not the current platform is Mac OS X 10.8, or higher.
def self.available?
Expand All @@ -20,7 +21,7 @@ def self.installed?

def self.execute(verbose, options)
if available? && installed?
options.merge!({ :appIcon => icon(options.delete(:type)) })
options.merge!({ :appIcon => GUARD_ICON, :contentImage => icon(options.delete(:type)) })

command = [BIN_PATH, *options.map { |k,v| ["-#{k}", v.to_s] }.flatten]
if RUBY_VERSION < '1.9'
Expand Down
10 changes: 5 additions & 5 deletions spec/terminal-notifier-guard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
describe "TerminalNotifier::Guard" do
describe ".execute" do
it "executes the tool with the given options" do
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard.icon]
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard::GUARD_ICON, '-contentImage', TerminalNotifier::Guard.icon]
if RUBY_VERSION < '1.9'
require 'shellwords'
command = Shellwords.shelljoin(command)
Expand All @@ -21,7 +21,7 @@
end

it "executes with the right icon path according to the type option" do
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard.icon(:success)]
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard::GUARD_ICON, '-contentImage', TerminalNotifier::Guard.icon(:success)]
if RUBY_VERSION < '1.9'
require 'shellwords'
command = Shellwords.shelljoin(command)
Expand Down Expand Up @@ -87,7 +87,7 @@

describe ".failed" do
it "executes with the 'failed' icon flag" do
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard.icon(:failed)]
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard::GUARD_ICON, '-contentImage', TerminalNotifier::Guard.icon(:failed)]
if RUBY_VERSION < '1.9'
require 'shellwords'
command = Shellwords.shelljoin(command)
Expand All @@ -99,7 +99,7 @@

describe ".success" do
it "executes with the 'success' icon flag" do
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard.icon(:success)]
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard::GUARD_ICON, '-contentImage', TerminalNotifier::Guard.icon(:success)]
if RUBY_VERSION < '1.9'
require 'shellwords'
command = Shellwords.shelljoin(command)
Expand All @@ -111,7 +111,7 @@

describe ".pending" do
it "executes with the 'pending' icon flag" do
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard.icon(:pending)]
command = [TerminalNotifier::Guard::BIN_PATH, '-message', 'ZOMG', '-appIcon', TerminalNotifier::Guard::GUARD_ICON, '-contentImage', TerminalNotifier::Guard.icon(:pending)]
if RUBY_VERSION < '1.9'
require 'shellwords'
command = Shellwords.shelljoin(command)
Expand Down

0 comments on commit f9d8c62

Please sign in to comment.