terminal-notifier 1.6.1 → 1.7.0

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: 218cfb3307b0b828fa02370a9147889ee10f8914
4
- data.tar.gz: f9eafe935e42f5283b2e9b8d79fa5de114f07df8
3
+ metadata.gz: 96140bb35740bd35bddea3e2e202a32cf1617a1f
4
+ data.tar.gz: 2f170c56de4b2721ec500173a4103bd86fe60390
5
5
  SHA512:
6
- metadata.gz: 264cc3455acc386c6b726238823282b13166c8a9a75caa6ff9d795e9cac995fd971d61a20b0b97104caa5cd025871a4e65a026df643938ff65aca0ae87bc2df5
7
- data.tar.gz: d0869fb7ed2b942793ab1459fabd847ef729b5a42b84d67b7ff83b493e3d1f9f0879678e0d36985817dd94f8986126d9598136b622de596995f9bcfb38dbcae3
6
+ metadata.gz: 29ec5f7c96e9be0a0610a9151634edd0eb1e9761a48d6ed86a3b4e2d60338cf30a75bf1fd13068cb653bd32ffcf640f2fdbe9867c56cdb689b1d4eb4a8b319aa
7
+ data.tar.gz: 0ac46c139e48faf4d4140b6ae8f451b115c870e499450af99dd28989eb8768094fb2ab8c4d5ab893b1e44837988dbc4738cfa337ec736f016bce69e82ad61728
@@ -1,4 +1,5 @@
1
1
  require 'shellwords'
2
+ require 'rbconfig'
2
3
 
3
4
  module TerminalNotifier
4
5
  BIN_PATH = File.expand_path('../../vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier', __FILE__)
@@ -6,7 +7,7 @@ module TerminalNotifier
6
7
  class UnsupportedPlatformError < StandardError; end
7
8
  # Returns wether or not the current platform is Mac OS X 10.8, or higher.
8
9
  def self.available?
9
- @available ||= Gem::Version.new(version) > Gem::Version.new('10.8')
10
+ @available ||= (/darwin|mac os/ =~ RbConfig::CONFIG['host_os']) && Gem::Version.new(version) > Gem::Version.new('10.8')
10
11
  end
11
12
 
12
13
  def self.version
@@ -25,7 +26,7 @@ module TerminalNotifier
25
26
  end
26
27
  result
27
28
  else
28
- raise UnsupportedPlatformError, "terminal-notifier is only supported on Mac OS X 10.8, or higher."
29
+ STDERR.print "terminal-notifier is only supported on Mac OS X 10.8, or higher."
29
30
  end
30
31
  end
31
32
 
@@ -50,7 +51,7 @@ module TerminalNotifier
50
51
  # Raises if not supported on the current platform.
51
52
  def notify(message, options = {}, verbose = false)
52
53
  TerminalNotifier.execute(verbose, options.merge(:message => message))
53
- $?.success?
54
+ $? && $?.success?
54
55
  end
55
56
  module_function :notify
56
57
 
@@ -60,7 +61,7 @@ module TerminalNotifier
60
61
  # If no ‘group’ ID is given, all notifications are removed.
61
62
  def remove(group = 'ALL', verbose = false)
62
63
  TerminalNotifier.execute(verbose, :remove => group)
63
- $?.success?
64
+ $? && $?.success?
64
65
  end
65
66
  module_function :remove
66
67
 
@@ -27,7 +27,7 @@ which are available in Mac OS X 10.8 and higher.
27
27
  ## Download
28
28
 
29
29
  Prebuilt binaries are available from the
30
- [releases section](https://github.com/alloy/terminal-notifier/releases).
30
+ [releases section](https://github.com/julienXX/terminal-notifier/releases).
31
31
 
32
32
  Or if you want to use this from
33
33
  [Ruby](https://github.com/alloy/terminal-notifier/tree/master/Ruby), you can
@@ -37,7 +37,7 @@ install it through RubyGems:
37
37
  $ [sudo] gem install terminal-notifier
38
38
  ```
39
39
 
40
- You can also install it via [Homebrew](https://github.com/mxcl/homebrew):
40
+ You can also install it via [Homebrew](https://github.com/Homebrew/homebrew):
41
41
  ```
42
42
  $ brew install terminal-notifier
43
43
  ```
@@ -62,9 +62,28 @@ This will obviously be a bit slower than using the tool without the wrapper.
62
62
 
63
63
  Some examples are:
64
64
 
65
+ Display piped data with a sound
65
66
  ```
66
67
  $ echo 'Piped Message Data!' | terminal-notifier -sound default
68
+ ```
69
+
70
+ Multiple actions and custom dropdown list
71
+ ```
72
+ $ terminal-notifier -message "Deploy now on UAT ?" -actions Now,"Later today","Tomorrow" -dropdownLabel "When ?"
73
+ ```
74
+
75
+ Yes or No ?
76
+ ```
77
+ $ terminal-notifier -title ProjectX -subtitle "new tag detected" -message "Deploy now on UAT ?" -closeLabel No -actions Yes -appIcon http://vjeantet.fr/images/logo.png
78
+ ```
79
+
80
+ Open an URL when the notification is clicked
81
+ ```
67
82
  $ terminal-notifier -title '💰' -message 'Check your Apple stock!' -open 'http://finance.yahoo.com/q?s=AAPL'
83
+ ```
84
+
85
+ Open an app when the notification is clicked
86
+ ```
68
87
  $ terminal-notifier -group 'address-book-sync' -title 'Address Book Sync' -subtitle 'Finished' -message 'Imported 42 contacts.' -activate 'com.apple.AddressBook'
69
88
  ```
70
89
 
@@ -104,6 +123,46 @@ in Sound Preferences. Use 'default' for the default notification sound.
104
123
 
105
124
  -------------------------------------------------------------------------------
106
125
 
126
+ `-reply`
127
+
128
+ The notification will be displayed as a reply type alert.
129
+
130
+ -------------------------------------------------------------------------------
131
+
132
+ `-actions VALUE1,VALUE2,"VALUE 3"`
133
+
134
+ The notification actions avalaible.
135
+ When you provide more than one value, a dropdown will be displayed.
136
+ You can customize this dropdown label with the next option
137
+ Does not work when -reply is used
138
+
139
+ -------------------------------------------------------------------------------
140
+
141
+ `-dropdownLabel VALUE`
142
+
143
+ The notification actions dropdown title (only when multiples -actions values are provided).
144
+ Does not work when -reply is used
145
+
146
+ -------------------------------------------------------------------------------
147
+
148
+ `-closeLabel VALUE`
149
+
150
+ The notification "Close" button label.
151
+
152
+ -------------------------------------------------------------------------------
153
+
154
+ `-timeout NUMBER`
155
+
156
+ Auto close the alert notification after NUMBER seconds.
157
+
158
+ -------------------------------------------------------------------------------
159
+
160
+ `-json`
161
+
162
+ Outputs the event as JSON.
163
+
164
+ -------------------------------------------------------------------------------
165
+
107
166
  `-group ID`
108
167
 
109
168
  Specifies the ‘group’ a notification belongs to. For any ‘group’ only _one_
@@ -159,8 +218,8 @@ application instead, including using its icon.
159
218
  Using this option fakes the sender application, so that the notification system
160
219
  will launch that application when the notification is clicked. Because of this
161
220
  it is important to note that you cannot combine this with options like
162
- `-execute` and `-activate` which depend on the sender of the notification to be
163
- ‘terminal-notifier’ to perform its work.
221
+ `-execute`, `-open`, and `-activate` which depend on the sender of the
222
+ notification to be ‘terminal-notifier’ to perform its work.
164
223
 
165
224
  For information on the `ID` see the `-activate` option.
166
225
 
@@ -200,7 +259,8 @@ All the works are available under the MIT license. **Except** for
200
259
  ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
201
260
  copyright of Apple.
202
261
 
203
- Copyright (C) 2012-2013 Eloy Durán <eloy.de.enige@gmail.com>
262
+ Copyright (C) 2012-2015 Eloy Durán <eloy.de.enige@gmail.com>, Julien Blanchard
263
+ <julien@sideburns.eu>
204
264
 
205
265
  Permission is hereby granted, free of charge, to any person obtaining a copy of
206
266
  this software and associated documentation files (the "Software"), to deal in
@@ -2,7 +2,8 @@ All the works are available under the MIT license. **Except** for
2
2
  ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
3
3
  copyright of Apple.
4
4
 
5
- Copyright (C) 2012-2013 Eloy Durán <eloy.de.enige@gmail.com>
5
+ Copyright (C) 2012-2013 Eloy Durán <eloy.de.enige@gmail.com>, Julien Blanchard
6
+ <julien@sideburns.eu>
6
7
 
7
8
  Permission is hereby granted, free of charge, to any person obtaining a copy of
8
9
  this software and associated documentation files (the "Software"), to deal in
@@ -15,34 +15,34 @@ end
15
15
 
16
16
  task :clean do
17
17
  rm zipfile
18
- rm_rf "vendor"
18
+ rm_rf 'vendor'
19
19
  end
20
20
 
21
- desc "Fetch latest build from the GitHub releases"
21
+ desc 'Fetch latest build from the GitHub releases'
22
22
  task :update_build do
23
23
  unless File.exist?(zipfile)
24
24
  sh "curl -L -O 'https://github.com/alloy/terminal-notifier/archive/#{zipfile}'"
25
25
  end
26
26
 
27
- rm_rf "vendor"
28
- mkdir "vendor"
27
+ rm_rf 'vendor'
28
+ mkdir 'vendor'
29
29
 
30
30
  sh "unzip -o -d vendor #{zipfile}"
31
31
  mv "vendor/#{filename}", 'vendor/terminal-notifier'
32
32
 
33
- %x(xcodebuild -project '../Terminal\ Notifier.xcodeproj' -target terminal-notifier SYMROOT=build -verbose)
33
+ sh 'cd .. && xcodebuild -target terminal-notifier SYMROOT=build -verbose && cd -'
34
34
  mv '../build/Release/terminal-notifier.app', 'vendor/terminal-notifier/'
35
35
  chmod 0755, 'vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier'
36
36
  end
37
37
 
38
- desc "Build gem"
38
+ desc 'Build gem'
39
39
  task :gem => :update_build do
40
- sh "gem build terminal-notifier.gemspec"
40
+ sh 'gem build terminal-notifier.gemspec'
41
41
  end
42
42
 
43
- desc "Run specs"
43
+ desc 'Run specs'
44
44
  task :spec do
45
- sh "bundle exec ruby spec/terminal-notifier_spec.rb"
45
+ sh 'bundle exec ruby spec/terminal-notifier_spec.rb'
46
46
  end
47
47
 
48
48
  task :default => :spec
@@ -1,4 +1,5 @@
1
1
  require 'shellwords'
2
+ require 'rbconfig'
2
3
 
3
4
  module TerminalNotifier
4
5
  BIN_PATH = File.expand_path('../../vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier', __FILE__)
@@ -6,7 +7,7 @@ module TerminalNotifier
6
7
  class UnsupportedPlatformError < StandardError; end
7
8
  # Returns wether or not the current platform is Mac OS X 10.8, or higher.
8
9
  def self.available?
9
- @available ||= Gem::Version.new(version) > Gem::Version.new('10.8')
10
+ @available ||= (/darwin|mac os/ =~ RbConfig::CONFIG['host_os']) && Gem::Version.new(version) > Gem::Version.new('10.8')
10
11
  end
11
12
 
12
13
  def self.version
@@ -25,7 +26,7 @@ module TerminalNotifier
25
26
  end
26
27
  result
27
28
  else
28
- raise UnsupportedPlatformError, "terminal-notifier is only supported on Mac OS X 10.8, or higher."
29
+ STDERR.print "terminal-notifier is only supported on Mac OS X 10.8, or higher."
29
30
  end
30
31
  end
31
32
 
@@ -50,7 +51,7 @@ module TerminalNotifier
50
51
  # Raises if not supported on the current platform.
51
52
  def notify(message, options = {}, verbose = false)
52
53
  TerminalNotifier.execute(verbose, options.merge(:message => message))
53
- $?.success?
54
+ $? && $?.success?
54
55
  end
55
56
  module_function :notify
56
57
 
@@ -60,7 +61,7 @@ module TerminalNotifier
60
61
  # If no ‘group’ ID is given, all notifications are removed.
61
62
  def remove(group = 'ALL', verbose = false)
62
63
  TerminalNotifier.execute(verbose, :remove => group)
63
- $?.success?
64
+ $? && $?.success?
64
65
  end
65
66
  module_function :remove
66
67
 
@@ -9,8 +9,8 @@ Gem::Specification.new do |gem|
9
9
  gem.name = "terminal-notifier"
10
10
  gem.version = version
11
11
  gem.summary = 'Send User Notifications on Mac OS X 10.8 or higher.'
12
- gem.authors = ["Eloy Duran"]
13
- gem.email = ["eloy.de.enige@gmail.com"]
12
+ gem.authors = ["Eloy Duran", "Julien Blanchard"]
13
+ gem.email = ["eloy.de.enige@gmail.com", "julien@sideburns.eu"]
14
14
  gem.homepage = 'https://github.com/alloy/terminal-notifier'
15
15
  gem.license = 'MIT'
16
16