Skip to content
Browse files

Update GNTP notifier. (Fixes #231)

With Growl 2.0 being released, the images are shown properly
again, but they most be binary encoded and not a url as
described in the GNTP spec. This can be achieved by using
`127.0.0.1` instead of `localhost`, and ruby_gntp will send
the image as binary.

In addition, on GNTP registration Guard send its application
icon, so we have the nice Guard logo in the Growl preferences.
  • Loading branch information...
1 parent 94623f2 commit 479d9b997ebc8f711df9d3fd60160f395ca76939 @netzpirat netzpirat committed Sep 20, 2012
Showing with 35 additions and 33 deletions.
  1. +2 −1 CHANGELOG.md
  2. +22 −24 README.md
  3. BIN images/guard.png
  4. +10 −7 lib/guard/notifiers/gntp.rb
  5. +1 −1 spec/guard/notifiers/gntp_spec.rb
View
3 CHANGELOG.md
@@ -1,5 +1,6 @@
# Master
+- Add Guard application icon to GNTP notifier. ([@netzpirat][])
- [#324][] Allow Terminal Notifier title to be customizable. ([@mattgreen][])
## 1.3.2 - 15 August, 2012
@@ -667,4 +668,4 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
[@waldo]: https://github.com/waldo
[@wereHamster]: https://github.com/wereHamster
[@yannlugrin]: https://github.com/yannlugrin
-[@zonque]: https://github.com/zonque
+[@zonque]: https://github.com/zonque
View
46 README.md
@@ -69,39 +69,17 @@ the time, try the [Rubygems Bundler](https://github.com/mpapis/rubygems-bundler)
You can configure Guard to make use of the following system notification libraries, but it's strongly recommended
to use either Ruby GNTP, Libnotify or Notifu:
-#### Growl
-
-* Runs on Mac OS X
-* Supports all [Growl](http://growl.info/) versions
-
-The [growl](https://rubygems.org/gems/growl) gem is compatible with all versions of Growl and uses a command line tool
-[growlnotify](http://growl.info/extras.php#growlnotify) that must be separately downloaded and installed. The version of
-the command line tool must match your Growl version. The `growl` gem does **not** support multiple notification
-channels.
-
-You have to download the installer for `growlnotify` from the [Growl download section](http://growl.info/downloads).
-
-To use `growl` you have to add it to your `Gemfile` and run bundler:
-
-```ruby
-group :development do
- gem 'growl'
-end
-```
-
#### Ruby GNTP
-**There's currently a bug in Growl that prevents displaying the icons through GNTP, see
-[issue #231](https://github.com/guard/guard/issues/231). Use the growl gem until fixed.**
-
* Runs on Mac OS X, Linux and Windows
* Supports [Growl](http://growl.info/) version >= 1.3, [Growl for Linux](http://mattn.github.com/growl-for-linux/),
[Growl for Windows](http://www.growlforwindows.com/gfw/default.aspx) and
[Snarl](https://sites.google.com/site/snarlapp/home)
The [ruby_gntp](https://rubygems.org/gems/ruby_gntp) gem sends system notifications over the network with the
[Growl Notification Transport Protocol](http://www.growlforwindows.com/gfw/help/gntp.aspx) and supports local and
-remote notifications.
+remote notifications. To have the images be displayed, you have to use `127.0.0.1` instead of `localhost` in your GTNP
+configuration.
Guard supports multiple notification channels for customizing each notification type. For Growl on Mac OS X you need
to have at least version 1.3 installed.
@@ -114,6 +92,26 @@ group :development do
end
```
+#### Growl
+
+* Runs on Mac OS X
+* Supports all [Growl](http://growl.info/) versions
+
+The [growl](https://rubygems.org/gems/growl) gem is compatible with all versions of Growl and uses a command line tool
+[growlnotify](http://growl.info/extras.php#growlnotify) that must be separately downloaded and installed. The version of
+the command line tool must match your Growl version. The `growl` gem does **not** support multiple notification
+channels.
+
+You have to download the installer for `growlnotify` from the [Growl download section](http://growl.info/downloads).
+
+To use `growl` you have to add it to your `Gemfile` and run bundler:
+
+```ruby
+group :development do
+ gem 'growl'
+end
+```
+
#### Libnotify
* Runs on Linux, FreeBSD, OpenBSD and Solaris
View
BIN images/guard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
17 lib/guard/notifiers/gntp.rb
@@ -32,7 +32,7 @@ module GNTP
# Default options for the ruby gtnp gem
DEFAULTS = {
:sticky => false,
- :host => 'localhost',
+ :host => '127.0.0.1',
:password => '',
:port => 23053
}
@@ -91,12 +91,15 @@ def notify(type, title, message, image, options = { })
gntp = ::GNTP.new('Guard', options.delete(:host), options.delete(:password), options.delete(:port))
unless registered?
- gntp.register(:notifications => [
- { :name => 'notify', :enabled => true },
- { :name => 'failed', :enabled => true },
- { :name => 'pending', :enabled => true },
- { :name => 'success', :enabled => true }
- ])
+ gntp.register({
+ :app_icon => File.expand_path(File.join(__FILE__, '..', '..', '..', '..', 'images', 'guard.png')),
+ :notifications => [
+ { :name => 'notify', :enabled => true },
+ { :name => 'failed', :enabled => true },
+ { :name => 'pending', :enabled => true },
+ { :name => 'success', :enabled => true }
+ ]
+ })
registered!
end
View
2 spec/guard/notifiers/gntp_spec.rb
@@ -58,7 +58,7 @@ def self.notify(options) end
end
it 'opens GNTP as Guard application' do
- ::GNTP.should_receive(:new).with('Guard', 'localhost', '', 23053)
+ ::GNTP.should_receive(:new).with('Guard', '127.0.0.1', '', 23053)
subject.notify('success', 'Welcome', 'Welcome to Guard', '/tmp/welcome.png', { })
end

0 comments on commit 479d9b9

Please sign in to comment.
Something went wrong with that request. Please try again.