Skip to content
Browse files

added terminal-notifier gem as dependency. server now detects termina…

…l-notifier binary.
  • Loading branch information...
1 parent 48e95a6 commit ee575635025daffe5f72ec2a5025874e77d89fe9 @allolex allolex committed
Showing with 13 additions and 5 deletions.
  1. +12 −5 lib/synack/server.rb
  2. +1 −0 synack.gemspec
View
17 lib/synack/server.rb
@@ -7,13 +7,11 @@ class Server
DEFAULT_OPTIONS = {
host: 'localhost',
- port: 11113
+ port: 11113,
}
attr_reader :host, :port, :socket
- # Class methods ================================================================================
-
def self.start(options={})
options = DEFAULT_OPTIONS.merge(options)
@host = options[:host]
@@ -28,7 +26,15 @@ def self.stop
::DRb.stop_service
end
- # Instance methods =============================================================================
+ def binary
+ binary = '/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier'
+ unless File.exists? binary
+ binary = `which "terminal-notifier"`
+ binary.chomp!
+ raise "terminal-notifier could not be found in path" unless $? == 0
+ end
+ binary
+ end
def sanitize(message)
message && message.gsub(/[^0-9A-z\.\-\'\, ]/, '_')
@@ -36,7 +42,8 @@ def sanitize(message)
def say(message)
puts message
- system "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -message \"#{sanitize(message)}\""
+ STDERR.puts command = "#{self.binary} -message \"#{sanitize(message)}\""
+ system command
end
end
View
1 synack.gemspec
@@ -68,5 +68,6 @@ Gem::Specification.new do |s|
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<simplecov>, [">= 0"])
end
+ s.add_dependency "terminal-notifier"
end

0 comments on commit ee57563

Please sign in to comment.
Something went wrong with that request. Please try again.