terminal-notifier 2.0.0 → 3.0.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.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/README.markdown +53 -2
  3. data/bin/terminal-notifier +4 -9
  4. data/lib/terminal-notifier/cli.rb +21 -0
  5. data/lib/terminal-notifier/version.rb +10 -0
  6. data/lib/terminal-notifier.rb +174 -38
  7. data/vendor/terminal-notifier/terminal-notifier.app/Contents/Info.plist +3 -32
  8. data/vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier +0 -0
  9. data/vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/InfoPlist.strings +0 -0
  10. data/vendor/terminal-notifier/terminal-notifier.app/Contents/_CodeSignature/CodeResources +146 -0
  11. metadata +18 -88
  12. data/vendor/terminal-notifier/LICENSE.md +0 -9
  13. data/vendor/terminal-notifier/README.markdown +0 -256
  14. data/vendor/terminal-notifier/Ruby/Gemfile +0 -2
  15. data/vendor/terminal-notifier/Ruby/Gemfile.lock +0 -23
  16. data/vendor/terminal-notifier/Ruby/README.markdown +0 -48
  17. data/vendor/terminal-notifier/Ruby/Rakefile +0 -48
  18. data/vendor/terminal-notifier/Ruby/bin/terminal-notifier +0 -13
  19. data/vendor/terminal-notifier/Ruby/lib/terminal-notifier.rb +0 -124
  20. data/vendor/terminal-notifier/Ruby/spec/terminal-notifier_spec.rb +0 -79
  21. data/vendor/terminal-notifier/Ruby/terminal-notifier.gemspec +0 -26
  22. data/vendor/terminal-notifier/Terminal Notifier/AppDelegate.h +0 -4
  23. data/vendor/terminal-notifier/Terminal Notifier/AppDelegate.m +0 -382
  24. data/vendor/terminal-notifier/Terminal Notifier/Terminal Notifier-Info.plist +0 -43
  25. data/vendor/terminal-notifier/Terminal Notifier/Terminal Notifier-Prefix.pch +0 -7
  26. data/vendor/terminal-notifier/Terminal Notifier/en.lproj/Credits.rtf +0 -29
  27. data/vendor/terminal-notifier/Terminal Notifier/en.lproj/InfoPlist.strings +0 -2
  28. data/vendor/terminal-notifier/Terminal Notifier/en.lproj/MainMenu.xib +0 -3387
  29. data/vendor/terminal-notifier/Terminal Notifier/main.m +0 -6
  30. data/vendor/terminal-notifier/Terminal Notifier.xcodeproj/project.pbxproj +0 -315
  31. data/vendor/terminal-notifier/Terminal Notifier.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  32. data/vendor/terminal-notifier/Terminal Notifier.xcodeproj/project.xcworkspace/xcshareddata/Terminal Notifier.xccheckout +0 -41
  33. data/vendor/terminal-notifier/Terminal Notifier.xcodeproj/xcshareddata/xcschemes/Terminal Notifier.xcscheme +0 -140
  34. data/vendor/terminal-notifier/Terminal.icns +0 -0
  35. data/vendor/terminal-notifier/assets/Example_1.png +0 -0
  36. data/vendor/terminal-notifier/assets/Example_2.png +0 -0
  37. data/vendor/terminal-notifier/assets/Example_3.png +0 -0
  38. data/vendor/terminal-notifier/assets/Example_4.png +0 -0
  39. data/vendor/terminal-notifier/assets/Example_5.png +0 -0
  40. data/vendor/terminal-notifier/assets/System_prefs.png +0 -0
  41. data/vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/Credits.rtf +0 -29
  42. data/vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib +0 -0
  43. /data/{vendor/terminal-notifier/Ruby/LICENSE → LICENSE} +0 -0
metadata CHANGED
@@ -1,59 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  - Julien Blanchard
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2017-11-01 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bacon
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: mocha
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: mocha-on-bacon
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- description:
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |
14
+ terminal-notifier is a command-line tool to send macOS User Notifications.
15
+ This gem wraps the tool and ships the application bundle it needs, so that
16
+ notifications can be posted from Ruby without any extra installation.
57
17
  email:
58
18
  - eloy.de.enige@gmail.com
59
19
  - julien@sideburns.eu
@@ -63,53 +23,25 @@ extensions: []
63
23
  extra_rdoc_files:
64
24
  - README.markdown
65
25
  files:
26
+ - LICENSE
66
27
  - README.markdown
67
28
  - bin/terminal-notifier
68
29
  - lib/terminal-notifier.rb
69
- - vendor/terminal-notifier/LICENSE.md
70
- - vendor/terminal-notifier/README.markdown
71
- - vendor/terminal-notifier/Ruby/Gemfile
72
- - vendor/terminal-notifier/Ruby/Gemfile.lock
73
- - vendor/terminal-notifier/Ruby/LICENSE
74
- - vendor/terminal-notifier/Ruby/README.markdown
75
- - vendor/terminal-notifier/Ruby/Rakefile
76
- - vendor/terminal-notifier/Ruby/bin/terminal-notifier
77
- - vendor/terminal-notifier/Ruby/lib/terminal-notifier.rb
78
- - vendor/terminal-notifier/Ruby/spec/terminal-notifier_spec.rb
79
- - vendor/terminal-notifier/Ruby/terminal-notifier.gemspec
80
- - vendor/terminal-notifier/Terminal Notifier.xcodeproj/project.pbxproj
81
- - vendor/terminal-notifier/Terminal Notifier.xcodeproj/project.xcworkspace/contents.xcworkspacedata
82
- - vendor/terminal-notifier/Terminal Notifier.xcodeproj/project.xcworkspace/xcshareddata/Terminal
83
- Notifier.xccheckout
84
- - vendor/terminal-notifier/Terminal Notifier.xcodeproj/xcshareddata/xcschemes/Terminal
85
- Notifier.xcscheme
86
- - vendor/terminal-notifier/Terminal Notifier/AppDelegate.h
87
- - vendor/terminal-notifier/Terminal Notifier/AppDelegate.m
88
- - vendor/terminal-notifier/Terminal Notifier/Terminal Notifier-Info.plist
89
- - vendor/terminal-notifier/Terminal Notifier/Terminal Notifier-Prefix.pch
90
- - vendor/terminal-notifier/Terminal Notifier/en.lproj/Credits.rtf
91
- - vendor/terminal-notifier/Terminal Notifier/en.lproj/InfoPlist.strings
92
- - vendor/terminal-notifier/Terminal Notifier/en.lproj/MainMenu.xib
93
- - vendor/terminal-notifier/Terminal Notifier/main.m
94
- - vendor/terminal-notifier/Terminal.icns
95
- - vendor/terminal-notifier/assets/Example_1.png
96
- - vendor/terminal-notifier/assets/Example_2.png
97
- - vendor/terminal-notifier/assets/Example_3.png
98
- - vendor/terminal-notifier/assets/Example_4.png
99
- - vendor/terminal-notifier/assets/Example_5.png
100
- - vendor/terminal-notifier/assets/System_prefs.png
30
+ - lib/terminal-notifier/cli.rb
31
+ - lib/terminal-notifier/version.rb
101
32
  - vendor/terminal-notifier/terminal-notifier.app/Contents/Info.plist
102
33
  - vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier
103
34
  - vendor/terminal-notifier/terminal-notifier.app/Contents/PkgInfo
104
35
  - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/Terminal.icns
105
- - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/Credits.rtf
106
36
  - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/InfoPlist.strings
107
- - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib
37
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/_CodeSignature/CodeResources
108
38
  homepage: https://github.com/julienXX/terminal-notifier
109
39
  licenses:
110
40
  - MIT
111
- metadata: {}
112
- post_install_message:
41
+ metadata:
42
+ source_code_uri: https://github.com/julienXX/terminal-notifier
43
+ bug_tracker_uri: https://github.com/julienXX/terminal-notifier/issues
44
+ changelog_uri: https://github.com/julienXX/terminal-notifier/releases
113
45
  rdoc_options: []
114
46
  require_paths:
115
47
  - lib
@@ -117,16 +49,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
49
  requirements:
118
50
  - - ">="
119
51
  - !ruby/object:Gem::Version
120
- version: '0'
52
+ version: '3.2'
121
53
  required_rubygems_version: !ruby/object:Gem::Requirement
122
54
  requirements:
123
55
  - - ">="
124
56
  - !ruby/object:Gem::Version
125
57
  version: '0'
126
58
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.5.1
129
- signing_key:
59
+ rubygems_version: 3.6.9
130
60
  specification_version: 4
131
- summary: Send User Notifications on macOS 10.10 or higher.
61
+ summary: Send User Notifications on macOS 10.14 or higher.
132
62
  test_files: []
@@ -1,9 +0,0 @@
1
- All the works are available under the MIT license. Except for ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is copyright of Apple.
2
-
3
- Copyright (C) 2012-2016 Eloy Durán eloy.de.enige@gmail.com, Julien Blanchard julien@sideburns.eu
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,256 +0,0 @@
1
- # terminal-notifier
2
-
3
- terminal-notifier is a command-line tool to send macOS User Notifications,
4
- which are available on macOS 10.10 and higher.
5
-
6
-
7
- ## News
8
-
9
- [alerter](https://github.com/vjeantet/alerter) features were merged in terminal-notifier 1.7. This led to some issues and even more issues in the 1.8 release. We decided with [Valère Jeantet](https://github.com/vjeantet) to rollback this merge.
10
-
11
- From now on terminal-notifier won't have the sticky notification feature nor the actions buttons. If you need them please use [alerter](https://github.com/vjeantet/alerter). I also want to follow [semver](http://semver.org) hence this latest version starts at 2.0.0.
12
-
13
- Sticking to two smaller specialized tools will hopefully make them easier to maintain and less error prone.
14
-
15
-
16
- ## Caveats
17
-
18
- * It is currently packaged as an application bundle, because `NSUserNotification`
19
- does not work from a ‘Foundation tool’. [radar://11956694](radar://11956694)
20
-
21
- * If you intend to package terminal-notifier with your app to distribute it on the Mac App Store, please use 1.5.2; version 1.6.0+ uses a private method override, which is not allowed in the App Store Guidelines.
22
-
23
- * If you're using macOS < 10.10 you should use terminal-notifier 1.6.3.
24
-
25
- * If you're looking for sticky notifications or more actions on a notification please use [alerter](https://github.com/vjeantet/alerter)
26
-
27
- ## Download
28
-
29
- Prebuilt binaries are available from the
30
- [releases section](https://github.com/julienXX/terminal-notifier/releases).
31
-
32
- Or if you want to use this from
33
- [Ruby](https://github.com/julienXX/terminal-notifier/tree/master/Ruby), you can
34
- install it through RubyGems:
35
-
36
- ```
37
- $ [sudo] gem install terminal-notifier
38
- ```
39
-
40
- You can also install it via [Homebrew](https://github.com/mxcl/homebrew):
41
- ```
42
- $ brew install terminal-notifier
43
- ```
44
-
45
- ## Usage
46
-
47
- ```
48
- $ ./terminal-notifier.app/Contents/MacOS/terminal-notifier -[message|group|list] [VALUE|ID|ID] [options]
49
- ```
50
-
51
- In order to use terminal-notifier, you have to call the binary _inside_ the
52
- application bundle.
53
-
54
- The Ruby gem, which wraps this tool, _does_ have a bin wrapper. If installed
55
- you can simply do:
56
-
57
- ```
58
- $ terminal-notifier -[message|group|list] [VALUE|ID|ID] [options]
59
- ```
60
-
61
- This will obviously be a bit slower than using the tool without the wrapper.
62
-
63
-
64
- ### Example Uses
65
-
66
- Display piped data with a sound:
67
- ```
68
- $ echo 'Piped Message Data!' | terminal-notifier -sound default
69
- ```
70
-
71
- ![Example 1](assets/Example_1.png)
72
-
73
- Use a custom icon:
74
- ```
75
- $ terminal-notifier -title ProjectX -subtitle "new tag detected" -message "Finished" -appIcon http://vjeantet.fr/images/logo.png
76
- ```
77
-
78
- ![Example 3](assets/Example_3.png)
79
-
80
- Open an URL when the notification is clicked:
81
- ```
82
- $ terminal-notifier -title '💰' -message 'Check your Apple stock!' -open 'http://finance.yahoo.com/q?s=AAPL'
83
- ```
84
-
85
- ![Example 4](assets/Example_4.png)
86
-
87
- Open an app when the notification is clicked:
88
- ```
89
- $ terminal-notifier -group 'address-book-sync' -title 'Address Book Sync' -subtitle 'Finished' -message 'Imported 42 contacts.' -activate 'com.apple.AddressBook'
90
- ```
91
-
92
- ![Example 5](assets/Example_5.png)
93
-
94
-
95
- ### Options
96
-
97
- At a minimum, you must specify either the `-message` , the `-remove`, or the
98
- `-list` option.
99
-
100
- -------------------------------------------------------------------------------
101
-
102
- `-message VALUE` **[required]**
103
-
104
- The message body of the notification.
105
-
106
- If you pipe data into terminal-notifier, you can omit this option,
107
- and the piped data will become the message body instead.
108
-
109
- -------------------------------------------------------------------------------
110
-
111
- `-title VALUE`
112
-
113
- The title of the notification. This defaults to ‘Terminal’.
114
-
115
- -------------------------------------------------------------------------------
116
-
117
- `-subtitle VALUE`
118
-
119
- The subtitle of the notification.
120
-
121
- -------------------------------------------------------------------------------
122
-
123
- `-sound NAME`
124
-
125
- Play the `NAME` sound when the notification appears.
126
- Sound names are listed in Sound Preferences.
127
-
128
- Use the special `NAME` “default” for the default notification sound.
129
-
130
- -------------------------------------------------------------------------------
131
-
132
- `-group ID`
133
-
134
- Specifies the notification’s ‘group’. For any ‘group’, only _one_
135
- notification will ever be shown, replacing previously posted notifications.
136
-
137
- A notification can be explicitly removed with the `-remove` option (see
138
- below).
139
-
140
- Example group IDs:
141
-
142
- * The sender’s name (to scope the notifications by tool).
143
- * The sender’s process ID (to scope the notifications by a unique process).
144
- * The current working directory (to scope notifications by project).
145
-
146
- -------------------------------------------------------------------------------
147
-
148
- `-remove ID` **[required]**
149
-
150
- Remove a previous notification from the `ID` ‘group’, if one exists.
151
-
152
- Use the special `ID` “ALL” to remove all messages.
153
-
154
- -------------------------------------------------------------------------------
155
-
156
- `-list ID` **[required]**
157
-
158
- Lists details about the specified ‘group’ `ID`.
159
-
160
- Use the special `ID` “ALL” to list details about all currently active messages.
161
-
162
- The output of this command is tab-separated, which makes it easy to parse.
163
-
164
- -------------------------------------------------------------------------------
165
-
166
- `-activate ID`
167
-
168
- Activate the application specified by `ID` when the user clicks the
169
- notification.
170
-
171
- You can find the bundle identifier (`CFBundleIdentifier`) of an application in its `Info.plist` file
172
- _inside_ the application bundle.
173
-
174
- Examples application IDs are:
175
-
176
- * `com.apple.Terminal` to activate Terminal.app
177
- * `com.apple.Safari` to activate Safari.app
178
-
179
- -------------------------------------------------------------------------------
180
-
181
- `-sender ID`
182
-
183
- Fakes the sender application of the notification. This uses the specified
184
- application’s icon, and will launch it when the notification is clicked.
185
-
186
- Using this option fakes the sender application, so that the notification system
187
- will launch that application when the notification is clicked. Because of this
188
- it is important to note that you cannot combine this with options like
189
- `-execute` and `-activate` which depend on the sender of the notification to be
190
- ‘terminal-notifier’ to perform its work.
191
-
192
- For information on the `ID`, see the `-activate` option.
193
-
194
- -------------------------------------------------------------------------------
195
-
196
- `-appIcon PATH`
197
-
198
- Specify an image `PATH` to display instead of the application icon.
199
-
200
- **WARNING: This option is subject to change, since it relies on a private method.**
201
-
202
- -------------------------------------------------------------------------------
203
-
204
- `-contentImage PATH`
205
-
206
- Specify an image `PATH` to attach inside of the notification.
207
-
208
- **WARNING: This option is subject to change since it relies on a private method.**
209
-
210
- -------------------------------------------------------------------------------
211
-
212
- `-open URL`
213
-
214
- Open `URL` when the user clicks the notification. This can be a web or file URL,
215
- or any custom URL scheme.
216
-
217
- -------------------------------------------------------------------------------
218
-
219
- `-execute COMMAND`
220
-
221
- Run the shell command `COMMAND` when the user clicks the notification.
222
-
223
- -------------------------------------------------------------------------------
224
-
225
- `-ignoreDnD`
226
-
227
- Ignore Do Not Disturb settings and unconditionally show the notification.
228
-
229
- **WARNING: This option is subject to change since it relies on a private method.**
230
-
231
- ## License
232
-
233
- All the works are available under the MIT license. **Except** for
234
- ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
235
- copyright of Apple.
236
-
237
- Copyright (C) 2012-2017 Eloy Durán <eloy.de.enige@gmail.com>, Julien Blanchard
238
- <julien@sideburns.eu>
239
-
240
- Permission is hereby granted, free of charge, to any person obtaining a copy of
241
- this software and associated documentation files (the "Software"), to deal in
242
- the Software without restriction, including without limitation the rights to
243
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
244
- of the Software, and to permit persons to whom the Software is furnished to do
245
- so, subject to the following conditions:
246
-
247
- The above copyright notice and this permission notice shall be included in all
248
- copies or substantial portions of the Software.
249
-
250
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
251
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
252
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
253
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
254
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
255
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
256
- SOFTWARE.
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
@@ -1,23 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- terminal-notifier (1.5.1)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- bacon (1.1.0)
10
- metaclass (0.0.1)
11
- mocha (0.11.4)
12
- metaclass (~> 0.0.1)
13
- mocha-on-bacon (0.2.0)
14
- mocha (>= 0.9.8)
15
-
16
- PLATFORMS
17
- ruby
18
-
19
- DEPENDENCIES
20
- bacon
21
- mocha
22
- mocha-on-bacon
23
- terminal-notifier!
@@ -1,48 +0,0 @@
1
- # TerminalNotifier
2
-
3
- A simple Ruby wrapper around the [`terminal-notifier`][HOMEPAGE] command-line
4
- tool, which allows you to send User Notifications to the Notification Center on
5
- macOS 10.10, or higher.
6
-
7
-
8
- ## Installation
9
-
10
- ```
11
- $ gem install terminal-notifier
12
- ```
13
-
14
-
15
- ## Usage
16
-
17
- For full information on all the options, see the tool’s [README][README].
18
-
19
- Examples are:
20
-
21
- ```ruby
22
- TerminalNotifier.notify('Hello World')
23
- TerminalNotifier.notify('Hello World', :title => 'Ruby', :subtitle => 'Programming Language')
24
- TerminalNotifier.notify('Hello World', :activate => 'com.apple.Safari')
25
- TerminalNotifier.notify('Hello World', :open => 'http://twitter.com/julienXX')
26
- TerminalNotifier.notify('Hello World', :execute => 'say "OMG"')
27
- TerminalNotifier.notify('Hello World', :group => Process.pid)
28
- TerminalNotifier.notify('Hello World', :sender => 'com.apple.Safari')
29
- TerminalNotifier.notify('Hello World', :sound => 'default')
30
-
31
- TerminalNotifier.remove(Process.pid)
32
-
33
- TerminalNotifier.list(Process.pid)
34
- TerminalNotifier.list
35
- ```
36
-
37
-
38
- ## License
39
-
40
- All the works are available under the MIT license. **Except** for
41
- ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
42
- copyright of Apple.
43
-
44
- See [LICENSE][LICENSE] for details.
45
-
46
- [HOMEPAGE]: https://github.com/julienXX/terminal-notifier
47
- [README]: https://github.com/julienXX/terminal-notifier/blob/master/README.markdown
48
- [LICENSE]: https://github.com/julienXX/terminal-notifier/blob/master/Ruby/LICENSE
@@ -1,48 +0,0 @@
1
- def version
2
- @version ||= begin
3
- plist = File.expand_path('../../Terminal Notifier/Terminal Notifier-Info.plist', __FILE__)
4
- `/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' '#{plist}'`.strip
5
- end
6
- end
7
-
8
- def filename
9
- "terminal-notifier-#{version}"
10
- end
11
-
12
- def zipfile
13
- "#{version}.zip"
14
- end
15
-
16
- task :clean do
17
- rm zipfile
18
- rm_rf 'vendor'
19
- end
20
-
21
- desc 'Fetch latest build from the GitHub releases'
22
- task :update_build do
23
- unless File.exist?(zipfile)
24
- sh "curl -L -O 'https://github.com/julienXX/terminal-notifier/archive/#{zipfile}'"
25
- end
26
-
27
- rm_rf 'vendor'
28
- mkdir 'vendor'
29
-
30
- sh "unzip -o -d vendor #{zipfile}"
31
- mv "vendor/#{filename}", 'vendor/terminal-notifier'
32
-
33
- sh 'cd .. && xcodebuild -target terminal-notifier SYMROOT=build -verbose && cd -'
34
- mv '../build/Release/terminal-notifier.app', 'vendor/terminal-notifier/'
35
- chmod 0755, 'vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier'
36
- end
37
-
38
- desc 'Build gem'
39
- task :gem => :update_build do
40
- sh 'gem build terminal-notifier.gemspec'
41
- end
42
-
43
- desc 'Run specs'
44
- task :spec do
45
- sh 'bundle exec ruby spec/terminal-notifier_spec.rb'
46
- end
47
-
48
- task :default => :spec
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- if $0 == __FILE__
4
- $:.unshift File.expand_path('../../lib', __FILE__)
5
- end
6
-
7
- require 'terminal-notifier'
8
-
9
- if !ARGV.include?("-message") && !STDIN.tty?
10
- ARGV.push(*["-message", STDIN.read.chomp])
11
- end
12
-
13
- exec TerminalNotifier::BIN_PATH, *ARGV
@@ -1,124 +0,0 @@
1
- # coding: utf-8
2
- require 'shellwords'
3
- require 'rbconfig'
4
-
5
- module TerminalNotifier
6
- BIN_PATH = File.expand_path('../../vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier', __FILE__)
7
-
8
- class UnsupportedPlatformError < StandardError; end
9
- # Returns wether or not the current platform is macOS 10.10, or higher.
10
- def self.available?
11
- @available ||= (/darwin|mac os/ =~ RbConfig::CONFIG['host_os']) && Gem::Version.new(version) > Gem::Version.new('10.10')
12
- end
13
-
14
- def self.version
15
- @version ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip
16
- end
17
-
18
- def self.execute(verbose, options)
19
- if available?
20
- command = [BIN_PATH, *options.map { |k,v| v = v.to_s; ["-#{k}", "#{v[0] == "-" ? " " : ""}#{Shellwords.escape(v[0,1])}#{v[1..-1]}"] }.flatten]
21
- command = Shellwords.join(command) if RUBY_VERSION < '1.9'
22
- result = ''
23
- IO.popen(command) do |stdout|
24
- output = stdout.read
25
- STDOUT.print output if verbose
26
- result << output
27
- end
28
- result
29
- else
30
- STDERR.print "terminal-notifier is only supported on macOS 10.10, or higher."
31
- end
32
- end
33
-
34
- # Cleans up the result of a notification, making it easier to work it
35
- #
36
- # The result of a notification is downcased, then groups of 1 or more
37
- # non-word characters are replaced with an underscore, before being
38
- # symbolised.
39
- #
40
- # If the reply option was given, then instead of going through the
41
- # above process, the result is returned with no changes as a string.
42
- #
43
- # If the always_string param is set to true, a the result is returned
44
- # with no changes as a string, like above.
45
- #
46
- # Examples are:
47
- #
48
- # notify_result('Test', {}) #=> :test
49
- # notify_result('No, sir', {}) #=> :no_sir
50
- # notify_result('@timeout', {}) #=> :_timeout
51
- # notify_result('@closeaction', {}) #=> :_closeaction
52
- # notify_result('I like pie', {reply: true}) #=> 'I like pie'
53
- # notify_result('I do not like pie', {'reply' => true}) #=> 'I do not like pie'
54
- # notify_result('@timeout', {'reply' => true}) #=> '@timeout'
55
- # notify_result('I may like pie', {}) #=> :i_may_like_pie
56
- def notify_result(result, options, always_string = false)
57
- if options[:reply] || options['reply'] || always_string
58
- result
59
- else
60
- result.length == 0 || result.downcase.gsub(/\W+/,'_').to_sym
61
- end
62
- end
63
- module_function :notify_result
64
-
65
- # Sends a User Notification and returns whether or not it was a success.
66
- #
67
- # The available options are `:title`, `:group`, `:activate`, `:open`,
68
- # `:execute`, `:sender`, and `:sound`. For a description of each option see:
69
- #
70
- # https://github.com/julienXX/terminal-notifier/blob/master/README.markdown
71
- #
72
- # Examples are:
73
- #
74
- # TerminalNotifier.notify('Hello World')
75
- # TerminalNotifier.notify('Hello World', :title => 'Ruby')
76
- # TerminalNotifier.notify('Hello World', :group => Process.pid)
77
- # TerminalNotifier.notify('Hello World', :activate => 'com.apple.Safari')
78
- # TerminalNotifier.notify('Hello World', :open => 'http://twitter.com/julienXX')
79
- # TerminalNotifier.notify('Hello World', :execute => 'say "OMG"')
80
- # TerminalNotifier.notify('Hello World', :sender => 'com.apple.Safari')
81
- # TerminalNotifier.notify('Hello World', :sound => 'default')
82
- #
83
- # Raises if not supported on the current platform.
84
- def notify(message, options = {}, verbose = false, always_string = false)
85
- result = TerminalNotifier.execute(verbose, options.merge(:message => message))
86
- $? && $?.success? && notify_result(result, options, always_string)
87
- end
88
- module_function :notify
89
-
90
- # Removes a notification that was previously sent with the specified
91
- # ‘group’ ID, if one exists.
92
- #
93
- # If no ‘group’ ID is given, all notifications are removed.
94
- def remove(group = 'ALL', verbose = false)
95
- TerminalNotifier.execute(verbose, :remove => group)
96
- $? && $?.success?
97
- end
98
- module_function :remove
99
-
100
- LIST_FIELDS = [:group, :title, :subtitle, :message, :delivered_at].freeze
101
-
102
- # If a ‘group’ ID is given, and a notification for that group exists,
103
- # returns a hash with details about the notification.
104
- #
105
- # If no ‘group’ ID is given, an array of hashes describing all
106
- # notifications.
107
- #
108
- # If no information is available this will return `nil`.
109
- def list(group = 'ALL', verbose = false)
110
- output = TerminalNotifier.execute(verbose, :list => group)
111
- return if output.strip.empty?
112
-
113
- require 'time'
114
- notifications = output.split("\n")[1..-1].map do |line|
115
- LIST_FIELDS.zip(line.split("\t")).inject({}) do |hash, (key, value)|
116
- hash[key] = key == :delivered_at ? Time.parse(value) : (value unless value == '(null)')
117
- hash
118
- end
119
- end
120
-
121
- group == 'ALL' ? notifications : notifications.first
122
- end
123
- module_function :list
124
- end