terminal-notifier 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,41 @@
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
+ Mac OS X 10.8, 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')
24
+ TerminalNotifier.notify('Hello World', :group => Process.pid)
25
+ TerminalNotifier.notify('Hello World', :activate => 'com.apple.Safari')
26
+ TerminalNotifier.notify('Hello World', :open => 'http://twitter.com/alloy')
27
+ TerminalNotifier.notify('Hello World', :execute => 'say "OMG"')
28
+ ```
29
+
30
+
31
+ ## License
32
+
33
+ All the works are available under the MIT license. **Except** for
34
+ ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
35
+ copyright of Apple.
36
+
37
+ See [LICENSE][LICENSE] for details.
38
+
39
+ [HOMEPAGE]: https://github.com/alloy/terminal-notifier
40
+ [README]: https://github.com/alloy/terminal-notifier/blob/master/README.markdown
41
+ [LICENSE]: https://github.com/alloy/terminal-notifier/blob/master/Ruby/LICENSE
@@ -0,0 +1,47 @@
1
+ module TerminalNotifier
2
+ BIN_PATH = File.expand_path('../../vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier', __FILE__)
3
+
4
+ # Returns wether or not the current platform is Mac OS X 10.8, or higher.
5
+ def self.available?
6
+ if @available.nil?
7
+ @available = `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
8
+ end
9
+ @available
10
+ end
11
+
12
+ # Executes the `terminal-notifier` tool through Kernel::system while
13
+ # redirecting output to `/dev/null`.
14
+ def self.silent_execute(options)
15
+ stdout = STDOUT.clone
16
+ STDOUT.reopen(File.new('/dev/null', 'w'))
17
+ system(BIN_PATH, *options)
18
+ ensure
19
+ STDOUT.reopen(stdout)
20
+ end
21
+
22
+ # Sends a User Notification and returns wether or not it was a success.
23
+ #
24
+ # The available options are `:title`, `:group`, `:activate`, `:open`, and
25
+ # `:execute`. For a description of each option see:
26
+ #
27
+ # https://github.com/alloy/terminal-notifier/blob/master/README.markdown
28
+ #
29
+ # Examples are:
30
+ #
31
+ # TerminalNotifier.notify('Hello World')
32
+ # TerminalNotifier.notify('Hello World', :title => 'Ruby')
33
+ # TerminalNotifier.notify('Hello World', :group => Process.pid)
34
+ # TerminalNotifier.notify('Hello World', :activate => 'com.apple.Safari')
35
+ # TerminalNotifier.notify('Hello World', :open => 'http://twitter.com/alloy')
36
+ # TerminalNotifier.notify('Hello World', :execute => 'say "OMG"')
37
+ #
38
+ # Raises if not supported on the current platform.
39
+ def notify(message, options = {})
40
+ if TerminalNotifier.available?
41
+ TerminalNotifier.silent_execute(options.merge(:message => message).map { |k,v| ["-#{k}", v.to_s] }.flatten)
42
+ else
43
+ raise "terminal-notifier is only supported on Mac OS X 10.8, or higher."
44
+ end
45
+ end
46
+ module_function :notify
47
+ end
@@ -0,0 +1,115 @@
1
+ # terminal-notifier
2
+
3
+ terminal-notifier is a command-line tool to send Mac OS X User Notifications,
4
+ which are available in Mac OS X 10.8.
5
+
6
+ It is currently packaged as an application bundle, because `NSUserNotification`
7
+ does not work from a ‘Foundation tool’. [radar://11956694](radar://11956694)
8
+
9
+ The Notification Center _always_ uses the application’s own icon, there’s
10
+ currently no way to specify a custom icon for a notification. The only way to
11
+ use this tool with your own icon is to include a build of terminal-notifier
12
+ with your icon instead.
13
+
14
+ This tool will be used by [Kicker](https://github.com/alloy/kicker) to show the
15
+ status of commands which are executed due to filesystem changes. (v3.0.0)
16
+
17
+
18
+ ## Download
19
+
20
+ Prebuilt binaries, which are code-signed and ready to use, are available from
21
+ the [downloads section](https://github.com/alloy/terminal-notifier/downloads).
22
+
23
+
24
+ ## Usage
25
+
26
+ ```
27
+ $ ./terminal-notifier.app/Contents/MacOS/terminal-notifier -message VALUE [options]
28
+ ```
29
+
30
+ In order to use terminal-notifier, you have to call the binary _inside_ the
31
+ application mbundle.
32
+
33
+ #### Options
34
+
35
+ The `-message` option is the only one that is required.
36
+
37
+ -------------------------------------------------------------------------------
38
+
39
+ `-message VALUE` **[required]**
40
+
41
+ The message body of the notification.
42
+
43
+ -------------------------------------------------------------------------------
44
+
45
+ `-title VALUE`
46
+
47
+ The title of the notification. This defaults to ‘Terminal’.
48
+
49
+ -------------------------------------------------------------------------------
50
+
51
+ `-group ID`
52
+
53
+ Specifies the ‘group’ a notification belongs to. For any ‘group’ only _one_
54
+ notification will ever be shown, replacing previously posted notifications.
55
+
56
+ Examples are:
57
+
58
+ * The sender’s name to scope the notifications by tool.
59
+ * The sender’s process ID to scope the notifications by a unique process.
60
+ * The current working directory to scope notifications by project.
61
+
62
+ -------------------------------------------------------------------------------
63
+
64
+ `-activate ID`
65
+
66
+ Specifies which application should be activated when the user clicks the
67
+ notification.
68
+
69
+ You can find the bundle identifier of an application in its `Info.plist` file
70
+ _inside_ the application bundle.
71
+
72
+ Examples are:
73
+
74
+ * `com.apple.Terminal` to activate Terminal.app
75
+ * `com.apple.Safari` to activate Safari.app
76
+
77
+ -------------------------------------------------------------------------------
78
+
79
+ `-open URL`
80
+
81
+ Specifies a resource to be opened when the user clicks the notification. This
82
+ can be a web or file URL, or any custom URL scheme.
83
+
84
+ -------------------------------------------------------------------------------
85
+
86
+ `-execute COMMAND`
87
+
88
+ Specifies a shell command to run when the user clicks the notification.
89
+
90
+
91
+ ## License
92
+
93
+ All the works are available under the MIT license. **Except** for
94
+ ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
95
+ copyright of Apple.
96
+
97
+ Copyright (C) 2012 Eloy Durán <eloy.de.enige@gmail.com>
98
+
99
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
100
+ this software and associated documentation files (the "Software"), to deal in
101
+ the Software without restriction, including without limitation the rights to
102
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
103
+ of the Software, and to permit persons to whom the Software is furnished to do
104
+ so, subject to the following conditions:
105
+
106
+ The above copyright notice and this permission notice shall be included in all
107
+ copies or substantial portions of the Software.
108
+
109
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
110
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
111
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
112
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
113
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
114
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
115
+ SOFTWARE.
@@ -0,0 +1,52 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>BuildMachineOSBuild</key>
6
+ <string>12A269</string>
7
+ <key>CFBundleDevelopmentRegion</key>
8
+ <string>en</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>terminal-notifier</string>
11
+ <key>CFBundleIconFile</key>
12
+ <string>Terminal</string>
13
+ <key>CFBundleIdentifier</key>
14
+ <string>nl.superalloy.oss.terminal-notifier</string>
15
+ <key>CFBundleInfoDictionaryVersion</key>
16
+ <string>6.0</string>
17
+ <key>CFBundleName</key>
18
+ <string>terminal-notifier</string>
19
+ <key>CFBundlePackageType</key>
20
+ <string>APPL</string>
21
+ <key>CFBundleShortVersionString</key>
22
+ <string>1.2.0</string>
23
+ <key>CFBundleSignature</key>
24
+ <string>????</string>
25
+ <key>CFBundleVersion</key>
26
+ <string>3</string>
27
+ <key>DTCompiler</key>
28
+ <string></string>
29
+ <key>DTPlatformBuild</key>
30
+ <string>4F243</string>
31
+ <key>DTPlatformVersion</key>
32
+ <string>GM</string>
33
+ <key>DTSDKBuild</key>
34
+ <string>12A264</string>
35
+ <key>DTSDKName</key>
36
+ <string>macosx10.8</string>
37
+ <key>DTXcode</key>
38
+ <string>0440</string>
39
+ <key>DTXcodeBuild</key>
40
+ <string>4F243</string>
41
+ <key>LSMinimumSystemVersion</key>
42
+ <string>10.8</string>
43
+ <key>LSUIElement</key>
44
+ <true/>
45
+ <key>NSHumanReadableCopyright</key>
46
+ <string>Copyright © 2012 Eloy Durán. All rights reserved.</string>
47
+ <key>NSMainNibFile</key>
48
+ <string>MainMenu</string>
49
+ <key>NSPrincipalClass</key>
50
+ <string>NSApplication</string>
51
+ </dict>
52
+ </plist>
@@ -0,0 +1,29 @@
1
+ {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
2
+ {\colortbl;\red255\green255\blue255;}
3
+ \paperw9840\paperh8400
4
+ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
5
+
6
+ \f0\b\fs24 \cf0 Engineering:
7
+ \b0 \
8
+ Some people\
9
+ \
10
+
11
+ \b Human Interface Design:
12
+ \b0 \
13
+ Some other people\
14
+ \
15
+
16
+ \b Testing:
17
+ \b0 \
18
+ Hopefully not nobody\
19
+ \
20
+
21
+ \b Documentation:
22
+ \b0 \
23
+ Whoever\
24
+ \
25
+
26
+ \b With special thanks to:
27
+ \b0 \
28
+ Mom\
29
+ }
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>files</key>
6
+ <dict>
7
+ <key>Resources/Terminal.icns</key>
8
+ <data>
9
+ Oq9GtJM1DqcGF1JCHiEgb0hoN6I=
10
+ </data>
11
+ <key>Resources/en.lproj/Credits.rtf</key>
12
+ <dict>
13
+ <key>hash</key>
14
+ <data>
15
+ YKJIFIsxneJuNkJNJQIcJIjiPOg=
16
+ </data>
17
+ <key>optional</key>
18
+ <true/>
19
+ </dict>
20
+ <key>Resources/en.lproj/InfoPlist.strings</key>
21
+ <dict>
22
+ <key>hash</key>
23
+ <data>
24
+ MiLKDDnrUKr4EmuvhS5VQwxHGK8=
25
+ </data>
26
+ <key>optional</key>
27
+ <true/>
28
+ </dict>
29
+ <key>Resources/en.lproj/MainMenu.nib</key>
30
+ <dict>
31
+ <key>hash</key>
32
+ <data>
33
+ N1QqAM17vgDk7XNtv27koaE4IhE=
34
+ </data>
35
+ <key>optional</key>
36
+ <true/>
37
+ </dict>
38
+ </dict>
39
+ <key>rules</key>
40
+ <dict>
41
+ <key>^Resources/</key>
42
+ <true/>
43
+ <key>^Resources/.*\.lproj/</key>
44
+ <dict>
45
+ <key>optional</key>
46
+ <true/>
47
+ <key>weight</key>
48
+ <real>1000</real>
49
+ </dict>
50
+ <key>^Resources/.*\.lproj/locversion.plist$</key>
51
+ <dict>
52
+ <key>omit</key>
53
+ <true/>
54
+ <key>weight</key>
55
+ <real>1100</real>
56
+ </dict>
57
+ <key>^version.plist$</key>
58
+ <true/>
59
+ </dict>
60
+ </dict>
61
+ </plist>
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: terminal-notifier
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
11
+ platform: ruby
12
+ authors:
13
+ - Eloy Duran
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-07-28 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description:
22
+ email:
23
+ - eloy.de.enige@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.markdown
30
+ files:
31
+ - lib/terminal-notifier.rb
32
+ - vendor/terminal-notifier/README.markdown
33
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/_CodeSignature/CodeResources
34
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/Info.plist
35
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier
36
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/PkgInfo
37
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/Credits.rtf
38
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/InfoPlist.strings
39
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib
40
+ - vendor/terminal-notifier/terminal-notifier.app/Contents/Resources/Terminal.icns
41
+ - README.markdown
42
+ homepage: https://github.com/alloy/terminal-notifier
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Send User Notifications on Mac OS X 10.8.
75
+ test_files: []
76
+
77
+ has_rdoc: