terminal-notifier-guard 1.6.2 → 1.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 847b7fdf031e5f756f6ad1e35108d8b8a4af7b7f
4
- data.tar.gz: 8c56f73c99e2decfef7ff9140dbf17b92b4a903d
3
+ metadata.gz: c457de656a8cec0edd86e15468dc7b7ec6a07293
4
+ data.tar.gz: 1d368877580f070c2f2035b2e2cb9b5108bf4fee
5
5
  SHA512:
6
- metadata.gz: 4b8719741b4fe1b9ef0507bfd5831781a8861b165dd3c8b661bc8ef34e5a2bed2419abf7920fb5b3ba2fcd1f446aa9ab1b2d0d5f2261ae0a694dd79c0900cc39
7
- data.tar.gz: 53f1fdc187a07af6394e1446562a3f12b8d7fada323db5c709378ab6aae0375bd84ff50f7a537eaac2b83f001bbd1a17375468c8ad5c018e459cd72590ed0a84
6
+ metadata.gz: 553bb299a08031794fdfc782e8938f37efda65b751e936070029c0ee011911d46d913d0b80a7e7ef6a3b90d66a2294c3f8955ae562090fb8f1dc11d6d0edc6f5
7
+ data.tar.gz: d9e1d1460d02ee251bdf95080c09002a230b09eb7f0fb9039770a7f8a91e9b1c1f04094b04b0d4ac4c335f0a65c9e189deea4f5152689556b1c6d6aeb985b84f
Binary file
@@ -1,18 +1,28 @@
1
1
  module TerminalNotifier
2
2
  module Guard
3
- VERSION = "1.6.2"
4
- BIN_PATH = "/usr/local/Cellar/terminal-notifier/1.6.1/terminal-notifier.app/Contents/MacOS/terminal-notifier"
3
+ VERSION = "1.6.3"
5
4
  ICONS_PATH = File.expand_path("../../icons", __FILE__)
6
- GUARD_ICON = File.join(ICONS_PATH, 'guard.png')
5
+ GUARD_ICON = File.join(ICONS_PATH, 'Guard.icns')
7
6
 
8
7
  def self.osx_version
9
8
  Gem::Version.new(`sw_vers -productVersion`.strip)
10
9
  end
11
10
 
11
+ def self.terminal_notifier_version
12
+ return unless installed?
13
+ Gem::Version.new(`#{bin_path}`.lines.first.match(/\d\.\d\.\d/)[0])
14
+ rescue
15
+ Gem::Version.new("0.0.0")
16
+ end
17
+
12
18
  def self.deprecation_check
13
19
  if osx_version <= Gem::Version.new('10.8')
14
20
  raise "OSX 10.8 is no longer supported by this gem. Please revert to version <= 1.5.3."
15
21
  end
22
+
23
+ if terminal_notifier_version < Gem::Version.new('1.6.0')
24
+ puts "Notice: Your terminal-notifier is older than what terminal-notifier-guard supports, consider upgrading."
25
+ end
16
26
  end
17
27
 
18
28
  # Returns wether or not the current platform is Mac OS X 10.8, or higher.
@@ -27,14 +37,18 @@ module TerminalNotifier
27
37
 
28
38
  # Whether or not the terminal notifier is installed
29
39
  def self.installed?
30
- return true if File.exist? BIN_PATH
40
+ File.exist? bin_path
41
+ end
42
+
43
+ def self.bin_path
44
+ @@binary ||= `which terminal-notifier`.chomp
31
45
  end
32
46
 
33
47
  def self.execute(verbose, options)
34
48
  if available? && installed?
35
- options.merge!({ :appIcon => GUARD_ICON, :contentImage => icon(options.delete(:type)) })
49
+ options.merge!({ :contentImage=> GUARD_ICON, :appIcon => icon(options.delete(:type)) })
36
50
 
37
- command = [BIN_PATH, *options.map { |k,v| ["-#{k}", v.to_s] }.flatten]
51
+ command = [bin_path, *options.map { |k,v| ["-#{k}", v.to_s] }.flatten]
38
52
  if RUBY_VERSION < '1.9'
39
53
  require 'shellwords'
40
54
  command = Shellwords.shelljoin(command)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-notifier-guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -77,10 +77,10 @@ extra_rdoc_files:
77
77
  files:
78
78
  - README.markdown
79
79
  - icons/Failed.icns
80
+ - icons/Guard.icns
80
81
  - icons/Notify.icns
81
82
  - icons/Pending.icns
82
83
  - icons/Success.icns
83
- - icons/guard.png
84
84
  - lib/terminal-notifier-guard.rb
85
85
  homepage: https://github.com/Springest/terminal-notifier-guard
86
86
  licenses: []
Binary file