terminal-notifier 1.6.0 → 1.6.1

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: bc0d510f599b6936ce8b16fbda223456053c2280
4
- data.tar.gz: 314e51d3fdb3859e55a6b5500abe8fead4bbb6f6
3
+ metadata.gz: 218cfb3307b0b828fa02370a9147889ee10f8914
4
+ data.tar.gz: f9eafe935e42f5283b2e9b8d79fa5de114f07df8
5
5
  SHA512:
6
- metadata.gz: a21300312cffba5d3d617becb181325a4bdc93c5d6de395343f87c505bed0bfbde2d2c8bca0a288e789d2e723e1cda39d99487952c7ca94ad7cad6b230e0c5b1
7
- data.tar.gz: 2f54d00f7f18b78aac700484634db6c43531496fcc299a51a8a2f9a9cfca75405d5df4d4f01d6584ea62508019ceb8a2901012e6eeecf9264bca650b5a6a1f9c
6
+ metadata.gz: 264cc3455acc386c6b726238823282b13166c8a9a75caa6ff9d795e9cac995fd971d61a20b0b97104caa5cd025871a4e65a026df643938ff65aca0ae87bc2df5
7
+ data.tar.gz: d0869fb7ed2b942793ab1459fabd847ef729b5a42b84d67b7ff83b493e3d1f9f0879678e0d36985817dd94f8986126d9598136b622de596995f9bcfb38dbcae3
@@ -6,7 +6,11 @@ module TerminalNotifier
6
6
  class UnsupportedPlatformError < StandardError; end
7
7
  # Returns wether or not the current platform is Mac OS X 10.8, or higher.
8
8
  def self.available?
9
- @available ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
9
+ @available ||= Gem::Version.new(version) > Gem::Version.new('10.8')
10
+ end
11
+
12
+ def self.version
13
+ @version ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip
10
14
  end
11
15
 
12
16
  def self.execute(verbose, options)
@@ -166,17 +166,17 @@ For information on the `ID` see the `-activate` option.
166
166
 
167
167
  -------------------------------------------------------------------------------
168
168
 
169
- `-appIcon URL` **[10.9+ only]**
169
+ `-appIcon PATH` **[10.9+ only]**
170
170
 
171
- Specifies The URL of an image to display instead of the application icon.
171
+ Specifies The PATH of an image to display instead of the application icon.
172
172
 
173
173
  **WARNING: This option is subject to change since it relies on a private method.**
174
174
 
175
175
  -------------------------------------------------------------------------------
176
176
 
177
- `-contentImage URL` **[10.9+ only]**
177
+ `-contentImage PATH` **[10.9+ only]**
178
178
 
179
- Specifies The URL of an image to display attached inside the notification.
179
+ Specifies The PATH of an image to display attached inside the notification.
180
180
 
181
181
  **WARNING: This option is subject to change since it relies on a private method.**
182
182
 
@@ -6,7 +6,11 @@ module TerminalNotifier
6
6
  class UnsupportedPlatformError < StandardError; end
7
7
  # Returns wether or not the current platform is Mac OS X 10.8, or higher.
8
8
  def self.available?
9
- @available ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
9
+ @available ||= Gem::Version.new(version) > Gem::Version.new('10.8')
10
+ end
11
+
12
+ def self.version
13
+ @version ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip
10
14
  end
11
15
 
12
16
  def self.execute(verbose, options)
@@ -190,9 +190,22 @@ isMavericks()
190
190
  if (defaults[@"activate"]) options[@"bundleID"] = defaults[@"activate"];
191
191
  if (defaults[@"group"]) options[@"groupID"] = defaults[@"group"];
192
192
  if (defaults[@"execute"]) options[@"command"] = defaults[@"execute"];
193
- if (defaults[@"open"]) options[@"open"] = [defaults[@"open"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
194
193
  if (defaults[@"appIcon"]) options[@"appIcon"] = defaults[@"appIcon"];
195
194
  if (defaults[@"contentImage"]) options[@"contentImage"] = defaults[@"contentImage"];
195
+ if (defaults[@"open"]) {
196
+ /*
197
+ * it may be better to use stringByAddingPercentEncodingWithAllowedCharacters instead of stringByAddingPercentEscapesUsingEncoding,
198
+ * but stringByAddingPercentEncodingWithAllowedCharacters is only available on OS X 10.9 or higher.
199
+ */
200
+ NSString *encodedURL = [defaults[@"open"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
201
+ NSURL *url = [NSURL URLWithString:defaults[@"open"]];
202
+ NSString *fragment = [url fragment];
203
+ if (fragment) {
204
+ options[@"open"] = [self decodeFragmentInURL:encodedURL fragment:fragment];
205
+ } else {
206
+ options[@"open"] = encodedURL;
207
+ }
208
+ }
196
209
 
197
210
  [self deliverNotificationWithTitle:defaults[@"title"] ?: @"Terminal"
198
211
  subtitle:subtitle
@@ -205,13 +218,28 @@ isMavericks()
205
218
 
206
219
  - (NSImage*)getImageFromURL:(NSString *) url;
207
220
  {
208
- if(!contains(url, @"file://")){ // Prefix file:// if not present
209
- url = [NSString stringWithFormat:@"%@%@", @"file://", url];
210
- }
211
221
  NSURL *imageURL = [NSURL URLWithString:url];
222
+ if([[imageURL scheme] length] == 0){
223
+ // Prefix 'file://' if no scheme
224
+ imageURL = [NSURL fileURLWithPath:url];
225
+ }
212
226
  return [[NSImage alloc] initWithContentsOfURL:imageURL];
213
227
  }
214
228
 
229
+ /**
230
+ * Decode fragment identifier
231
+ *
232
+ * @see http://tools.ietf.org/html/rfc3986#section-2.1
233
+ * @see http://en.wikipedia.org/wiki/URI_scheme
234
+ */
235
+ - (NSString*)decodeFragmentInURL:(NSString *) encodedURL fragment:(NSString *) framgent
236
+ {
237
+ NSString *beforeStr = [@"%23" stringByAppendingString:framgent];
238
+ NSString *afterStr = [@"#" stringByAppendingString:framgent];
239
+ NSString *decodedURL = [encodedURL stringByReplacingOccurrencesOfString:beforeStr withString:afterStr];
240
+ return decodedURL;
241
+ }
242
+
215
243
  - (void)deliverNotificationWithTitle:(NSString *)title
216
244
  subtitle:(NSString *)subtitle
217
245
  message:(NSString *)message
@@ -17,11 +17,11 @@
17
17
  <key>CFBundlePackageType</key>
18
18
  <string>APPL</string>
19
19
  <key>CFBundleShortVersionString</key>
20
- <string>1.6.0</string>
20
+ <string>1.6.1</string>
21
21
  <key>CFBundleSignature</key>
22
22
  <string>????</string>
23
23
  <key>CFBundleVersion</key>
24
- <string>11</string>
24
+ <string>12</string>
25
25
  <key>LSMinimumSystemVersion</key>
26
26
  <string>${MACOSX_DEPLOYMENT_TARGET}</string>
27
27
  <key>LSUIElement</key>
@@ -3,7 +3,7 @@
3
3
  <plist version="1.0">
4
4
  <dict>
5
5
  <key>BuildMachineOSBuild</key>
6
- <string>13C64</string>
6
+ <string>13E28</string>
7
7
  <key>CFBundleDevelopmentRegion</key>
8
8
  <string>en</string>
9
9
  <key>CFBundleExecutable</key>
@@ -19,15 +19,15 @@
19
19
  <key>CFBundlePackageType</key>
20
20
  <string>APPL</string>
21
21
  <key>CFBundleShortVersionString</key>
22
- <string>1.6.0</string>
22
+ <string>1.6.1</string>
23
23
  <key>CFBundleSignature</key>
24
24
  <string>????</string>
25
25
  <key>CFBundleVersion</key>
26
- <string>11</string>
26
+ <string>12</string>
27
27
  <key>DTCompiler</key>
28
28
  <string>com.apple.compilers.llvm.clang.1_0</string>
29
29
  <key>DTPlatformBuild</key>
30
- <string>5B130a</string>
30
+ <string>5B1008</string>
31
31
  <key>DTPlatformVersion</key>
32
32
  <string>GM</string>
33
33
  <key>DTSDKBuild</key>
@@ -35,9 +35,9 @@
35
35
  <key>DTSDKName</key>
36
36
  <string>macosx10.9</string>
37
37
  <key>DTXcode</key>
38
- <string>0510</string>
38
+ <string>0511</string>
39
39
  <key>DTXcodeBuild</key>
40
- <string>5B130a</string>
40
+ <string>5B1008</string>
41
41
  <key>LSMinimumSystemVersion</key>
42
42
  <string>10.8</string>
43
43
  <key>LSUIElement</key>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bacon