nsnotify 0.0.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.
Files changed (31) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +52 -0
  5. data/Rakefile +2 -0
  6. data/lib/nsnotify.rb +2 -0
  7. data/lib/nsnotify/.DS_Store +0 -0
  8. data/lib/nsnotify/icons/.DS_Store +0 -0
  9. data/lib/nsnotify/icons/broken.icns +0 -0
  10. data/lib/nsnotify/icons/error.icns +0 -0
  11. data/lib/nsnotify/icons/info.icns +0 -0
  12. data/lib/nsnotify/icons/pending.icns +0 -0
  13. data/lib/nsnotify/icons/success.icns +0 -0
  14. data/lib/nsnotify/icons/warning.icns +0 -0
  15. data/lib/nsnotify/icons/working.icns +0 -0
  16. data/lib/nsnotify/nsnotify.rb +37 -0
  17. data/lib/nsnotify/version.rb +3 -0
  18. data/nsnotify.gemspec +19 -0
  19. data/spec/nsnotify_spec.rb +19 -0
  20. data/spec/spec_helper.rb +1 -0
  21. data/vendor/terminal-notifier_v1.0/.DS_Store +0 -0
  22. data/vendor/terminal-notifier_v1.0/README.markdown +70 -0
  23. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Info.plist +52 -0
  24. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/MacOS/terminal-notifier +0 -0
  25. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/PkgInfo +1 -0
  26. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/Terminal.icns +0 -0
  27. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/en.lproj/Credits.rtf +29 -0
  28. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/en.lproj/InfoPlist.strings +0 -0
  29. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib +0 -0
  30. data/vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/_CodeSignature/CodeResources +61 -0
  31. metadata +94 -0
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .rvmrc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nsnotify.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Wouter de Vos
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # nsnotify
2
+
3
+ Uses the built-in OS X Mountain Lion Notification Center to display messages.
4
+ It uses a nice app by [Eloy Durán](https://github.com/alloy/terminal-notifier)
5
+ that gives you command line access to the service.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'nsnotify'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install nsnotify
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ require 'nsnotify'
27
+
28
+ # Use the notify method
29
+ Nsnotify.notify "Testing!", "Can you see me?!"
30
+
31
+ # Or one of the other convenience methods
32
+ # (success, error, warning, pending, info, broken)
33
+ Nsnotify.success "Yeah if this works!"
34
+ Nsnotify.error "Did something go wrong?!?"
35
+
36
+ # You can set the title to your app's name
37
+ # instead of that lame Nsnotify.
38
+ Nsnotify.app_name = "MyApp"
39
+ Nsnotify.success "Yeah, see me?!"
40
+ ```
41
+
42
+ ## Todo
43
+
44
+ 1. Integration in Guard/Watchr and stuff.
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ require "nsnotify/version"
2
+ require "nsnotify/nsnotify"
Binary file
@@ -0,0 +1,37 @@
1
+ module Nsnotify
2
+ vendor = File.expand_path('../../../vendor', __FILE__)
3
+ ICONS = File.expand_path('../icons', __FILE__)
4
+ TERMINAL_NOTIFICATION_BIN = File.join(vendor, 'terminal-notifier_v1.0/terminal-notifier.app/Contents/MacOS/terminal-notifier')
5
+
6
+ class << self
7
+ attr_accessor :use, :app_bundle_identifier, :app_name
8
+ alias_method :use?, :use
9
+
10
+ def usable?
11
+ @usable ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
12
+ end
13
+
14
+ def result(status)
15
+ status.success? ? succeeded(status) : failed(status)
16
+ end
17
+
18
+ [:success, :error, :warning, :pending, :info, :broken].each do |type|
19
+ define_method type do |message|
20
+ title = "#{app_name}: #{type.capitalize}"
21
+ notify title, message
22
+ end
23
+ end
24
+
25
+ def notify(title, message)
26
+ throw "This gem needs OSX 10.8 Mountain Lion to work!" if not usable?
27
+ `'#{TERMINAL_NOTIFICATION_BIN}' #{Dir.pwd} '#{title}' '#{message}' '#{app_bundle_identifier}'`
28
+ end
29
+
30
+ def app_name
31
+ @app_name || "Nsnotify"
32
+ end
33
+ end
34
+ end
35
+
36
+ Nsnotify.use = true
37
+ Nsnotify.app_bundle_identifier = 'com.googlecode.iterm2'
@@ -0,0 +1,3 @@
1
+ module Nsnotify
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/nsnotify/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Wouter de Vos"]
6
+ gem.email = ["Nsnotify@foxycoder.com"]
7
+ gem.description = %q{Notifications through the OS X Notification Center.}
8
+ gem.summary = %q{Notifications through the OS X Notification Center available since OS X 10.8 Mountain Lion.}
9
+ gem.homepage = "http://foxycoder.com"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "nsnotify"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Nsnotify::VERSION
17
+
18
+ gem.add_development_dependency 'rspec', '~> 2.11'
19
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Nsnotify do
4
+ describe "#usable?" do
5
+ it "should be usable" do
6
+ Nsnotify.usable?.should eq true
7
+ end
8
+ end
9
+
10
+ describe "#notify" do
11
+ it "should notify.." do
12
+ Nsnotify.notify "Nsnotify!", "Can you see my tongue?!"
13
+ sleep 2
14
+ Nsnotify.success "Yeah if this works!"
15
+ sleep 2
16
+ Nsnotify.error "Did something go wrong?!?"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ require 'nsnotify'
@@ -0,0 +1,70 @@
1
+ # terminal-notifier
2
+
3
+ terminal-notifier is a command-line tool to send OS X User Notifications, which
4
+ are available starting 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’. If you figure out a way to make this
8
+ work, please send a pull-request.
9
+
10
+ This tool is used by [Kicker](https://github.com/alloy/kicker) to show the
11
+ status of commands being executed due to filesystem changes.
12
+
13
+
14
+ ## Download
15
+
16
+ Prebuilt binaries, which are code-signed and ready to use, are available from
17
+ the [downloads section](https://github.com/alloy/terminal-notifier/downloads).
18
+
19
+
20
+ ## Usage
21
+
22
+ In order to use terminal-notifier, you have to call the binary _inside_ the app
23
+ bundle. E.g.:
24
+
25
+ ```
26
+ $ ./terminal-notifier.app/Contents/MacOS/terminal-notifier
27
+ ```
28
+
29
+ The arguments required are shown by the tool. Here is a copy of the output:
30
+
31
+ ```
32
+ Usage: terminal-notifier sender-ID sender-name message [bundle-ID]
33
+
34
+ sender-ID A string which identifies the group the notifications belong to.
35
+ Old notifications with the same ID will be removed.
36
+ sender-name The name of the application which is used as the notification’s title.
37
+ message The message that is shown in the notification.
38
+ bundle-ID The bundle identifier of the application to activate when the user
39
+ activates (clicks) a notification. Defaults to `com.apple.Terminal'.
40
+
41
+ When the user activates a notification, the results are logged to the system logs.
42
+ Use Console.app to view these logs.
43
+ ```
44
+
45
+
46
+ ## License
47
+
48
+ All the works are available under the MIT license.
49
+
50
+ **Except** for `Terminal.icns`, which is a copy of Apple’s Terminal.app icon.
51
+
52
+ Copyright (C) 2012 Eloy Durán <eloy.de.enige@gmail.com>
53
+
54
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
55
+ this software and associated documentation files (the "Software"), to deal in
56
+ the Software without restriction, including without limitation the rights to
57
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
58
+ of the Software, and to permit persons to whom the Software is furnished to do
59
+ so, subject to the following conditions:
60
+
61
+ The above copyright notice and this permission notice shall be included in all
62
+ copies or substantial portions of the Software.
63
+
64
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
65
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
66
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
67
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
68
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
69
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
70
+ 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.0</string>
23
+ <key>CFBundleSignature</key>
24
+ <string>????</string>
25
+ <key>CFBundleVersion</key>
26
+ <string>1</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,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nsnotify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Wouter de Vos
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.11'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.11'
30
+ description: Notifications through the OS X Notification Center.
31
+ email:
32
+ - Nsnotify@foxycoder.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - lib/nsnotify.rb
43
+ - lib/nsnotify/.DS_Store
44
+ - lib/nsnotify/icons/.DS_Store
45
+ - lib/nsnotify/icons/broken.icns
46
+ - lib/nsnotify/icons/error.icns
47
+ - lib/nsnotify/icons/info.icns
48
+ - lib/nsnotify/icons/pending.icns
49
+ - lib/nsnotify/icons/success.icns
50
+ - lib/nsnotify/icons/warning.icns
51
+ - lib/nsnotify/icons/working.icns
52
+ - lib/nsnotify/nsnotify.rb
53
+ - lib/nsnotify/version.rb
54
+ - nsnotify.gemspec
55
+ - spec/nsnotify_spec.rb
56
+ - spec/spec_helper.rb
57
+ - vendor/terminal-notifier_v1.0/.DS_Store
58
+ - vendor/terminal-notifier_v1.0/README.markdown
59
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Info.plist
60
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/MacOS/terminal-notifier
61
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/PkgInfo
62
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/Terminal.icns
63
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/en.lproj/Credits.rtf
64
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/en.lproj/InfoPlist.strings
65
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib
66
+ - vendor/terminal-notifier_v1.0/terminal-notifier.app/Contents/_CodeSignature/CodeResources
67
+ homepage: http://foxycoder.com
68
+ licenses: []
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.24
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Notifications through the OS X Notification Center available since OS X 10.8
91
+ Mountain Lion.
92
+ test_files:
93
+ - spec/nsnotify_spec.rb
94
+ - spec/spec_helper.rb