This gem is deprecated. Please use terminal-notifier-guard
.
Install it manually
$ gem install terminal-notifier-guard
Or put it in your Gemfile
group :development do
gem 'guard'
gem 'terminal-notifier-guard'
end
Uses the built-in OS X Mountain Lion Notification Center to display messages. It uses a nice app by Eloy Durán that gives you command line access to the service.
Add this line to your application's Gemfile:
gem 'nsnotify'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nsnotify
require 'nsnotify'
# Use the notify method
Nsnotify.notify "Testing!", "Can you see me?!"
# Or one of the other convenience methods
# (success, error, warning, pending, info, broken)
Nsnotify.success "Yeah if this works!"
Nsnotify.error "Did something go wrong?!?"
# You can set the title to your app's name
# instead of that lame Nsnotify.
Nsnotify.app_name = "MyApp"
Nsnotify.success "Yeah, see me?!"
I added a pull request for Guard integration, so you will have all your Guard notifications through the Notification Center by having the following in your Gemfile:
group :development, :test do
gem 'guard'
gem 'nsnotify'
end
The default onclick behavior for a notification is open/focus Terminal.app
. If you want to
change that to another terminal emulator you can change the app bundle identifier
:
# Focus iTerm2 when clicking a message.
Nsnotify.app_bundle_identifier = 'com.googlecode.iterm2'
I put it in spec_helper.rb
, and it works fine with Guard and Spork.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request