Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 133 lines (93 sloc) 3.911 kb
9e54694 @tj Added gem skeleton
authored
1 = Growl
2
3 Ruby growlnotify 'bindings'.
4
f9645ae @tj Docs
authored
5 == Examples
6
7 notification = Growl.new
8 notification.message = 'Hello World'
9 notification.sticky!
10 notification.icon = :jpeg
4876578 @tj Added examples and updated docs
authored
11 notification.run if Growl.installed?
f9645ae @tj Docs
authored
12
13 # OR
14
4876578 @tj Added examples and updated docs
authored
15 Growl.notify {
f9645ae @tj Docs
authored
16 self.message = 'Hello World'
17 self.icon = :jpeg
18 sticky!
19 }
20
21 # OR
22
4876578 @tj Added examples and updated docs
authored
23 Growl.notify do |n|
f9645ae @tj Docs
authored
24 n.message = 'Hello World'
25 n.icon = :jpeg
26 n.stick!
27 end
28
ce03429 @tj Added #Growl hash support
authored
29 # OR
30
4876578 @tj Added examples and updated docs
authored
31 Growl.notify 'Foo', :icon => :jpeg, :title => 'Growl'
32
33 # OR
34
35 include Growl
36 notify 'Email received', :sticky => true
37
e05a0bd @tj Added #sleep calls to example so they all fire
authored
38 # Convenience methods
4876578 @tj Added examples and updated docs
authored
39
40 notify_ok 'Deployment successful'
41 notify_info 'Email received'
42 notify_warning 'Merge required'
43 notify_error 'Failed to send email', :sticky => true
ce03429 @tj Added #Growl hash support
authored
44
3e2d6a7 @geopet Add documentation on url switch & typo fix
geopet authored
45 == Turn a Growl notification into an active url
46
47 notification = Growl.new
48 notification.message = 'I am an active url.'
49 notification.url = 'http://www.example.com'
50 notification.sticky!
51 notification.run if Growl.installed?
52
53 Now when you launch your notification the Growl message will be an active url
54 to take you to http://www.example.com as if you had run from the command line:
55
56 growlnotify -m 'I am an active url' --url 'http://www.example.com'
57
62ac052 @lukaszkorecki updates readme
lukaszkorecki authored
58 == Custom path to growlnotify
59
60 If needed you can set a path to the binary with:
61
62 Growl.bin_path = '~/my/path/to/growlnotify'
63
64 right after you require the growl library.
65
3e2d6a7 @geopet Add documentation on url switch & typo fix
geopet authored
66 == Normalized Icons
7048d19 @tj Growl#notify now normalizes the :icon option key [#2]
authored
67
68 The :icon option key is automatically normalized when you use any of the Growl#notify
69 methods, this removes the need to explicitly use :appIcon, :image, etc.
70
71 notify 'App icon', :icon => :Safari
62ac052 @lukaszkorecki updates readme
lukaszkorecki authored
72 notify 'Jpeg icon', :icon => :jpeg
73 notify 'Image icon', :icon => 'path/to/image.png'
7048d19 @tj Growl#notify now normalizes the :icon option key [#2]
authored
74 notify 'Icns icon', :icon => 'path/to/icon.icns'
62ac052 @lukaszkorecki updates readme
lukaszkorecki authored
75 notify 'Path extname icon', :icon => 'foo.rb'
7048d19 @tj Growl#notify now normalizes the :icon option key [#2]
authored
76
f9645ae @tj Docs
authored
77 == Features
78
4876578 @tj Added examples and updated docs
authored
79 * Check availability with Growl.installed?
80 * Check dependencies with Growl.version
f9645ae @tj Docs
authored
81 * Use images, icon paths, application icons, or file format icons
62ac052 @lukaszkorecki updates readme
lukaszkorecki authored
82 * Sticky a notification making it appear until explicitly closed
83 * Set notification priority
4876578 @tj Added examples and updated docs
authored
84 * Convenience methods such as notify_ok, notify_warning, notify_error, and notify_info
c6ef692 @tj Added growlnotify install docs [#3]
authored
85 * Etc (consult growlnotify --help)
86
87 == Installing growlnotify
88
62ac052 @lukaszkorecki updates readme
lukaszkorecki authored
89 Visit http://growl.info/documentation.php for installation help.
3e2d6a7 @geopet Add documentation on url switch & typo fix
geopet authored
90 Visit http://growl.info/downloads for download.
f9645ae @tj Docs
authored
91
fdb1e24 @tj Excessive notifications docs
authored
92 == Known Issues
93
94 It seems that growlnotify will essentially ignore or block excessive usage
cbdfc6b @tj Docs
authored
95 of the notifications at random. To prevent this you may need to do something like
96 below if you are calling many in sequence:
fdb1e24 @tj Excessive notifications docs
authored
97
98 notify 'Something'; sleep 0.2
99 notify_ok 'Updated'; sleep 0.2
100 notify_info 'You have new mail'; sleep 0.2
101 notify_warning 'Merged required'; sleep 0.2
102 notify_error 'Oh Noes!'; sleep 0.2
103
03fc668 @tj Added lighthouse link
authored
104 == Contribute
105
106 Fork / send a pull request or submit a ticket at:
bbba30a @tj Changed url for ticketing system
authored
107 http://github.com/visionmedia/growl/issues
03fc668 @tj Added lighthouse link
authored
108
9e54694 @tj Added gem skeleton
authored
109 == License:
110
111 (The MIT License)
112
113 Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
114
115 Permission is hereby granted, free of charge, to any person obtaining
116 a copy of this software and associated documentation files (the
117 'Software'), to deal in the Software without restriction, including
118 without limitation the rights to use, copy, modify, merge, publish,
119 distribute, sublicense, an d/or sell copies of the Software, and to
120 permit persons to whom the Software is furnished to do so, subject to
121 the following conditions:
122
123 The above copyright notice and this permission notice shall be
124 included in all copies or substantial portions of the Software.
125
126 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
127 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
128 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
129 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
130 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
131 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
132 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.