Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add README and LICENSE

  • Loading branch information...
commit 8f6acee848157988ec35e5a088406e993d8659a5 1 parent b11b0d4
@flyerhzm authored
Showing with 91 additions and 0 deletions.
  1. +20 −0 LICENSE
  2. +71 −0 README.md
View
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Richard Huang (flyerhzm@gmail.com)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
71 README.md
@@ -0,0 +1,71 @@
+UniformNotifier
+===============
+
+uniform_notifier is extracted from [bullet][0], it gives you the ability to send notification through rails logger, customized logger, javascript alert, javascript console, growl, and xmpp.
+
+Install
+-------
+
+1. install directly
+
+ gem install uniform_notifier
+
+if you want to notify by growl or xmpp, you should install them first
+
+ gem install ruby-growl
+ gem install xmpp4r
+
+2. add it into Gemfile (Bundler)
+
+ gem "uniform_notifier"
+
+you should add ruby-growl and xmpp4r gem if you want.
+
+Usage
+-----
+
+There are two types of notifications, one is <code>inline_notify</code>, for javascript alert and javascript console notifiers, which returns a string and will be combined, the other is <code>out_of_channel_notify</code>, for rails logger, customized logger, growl and xmpp, which doesn't return anything, just send the message to the notifiers.
+
+By default, all notifiers are disabled, you should enable them first.
+
+ # javascript alert
+ UniformNotifier.alert = true
+
+ # javascript console
+ UniformNotifier.console = true
+
+ # rails logger
+ UniformNotifier.rails_logger = true
+
+ # customized logger
+ logger = File.open('notify.log', 'a+')
+ logger.sync = true
+ UniformNotifier.customized_logger = logger
+
+ # growl without password
+ UniformNotifier.growl = true
+ # growl with passowrd
+ UniformNotifier.growl = { :password => 'growl password' }
+
+ # xmpp
+ UniformNotifier.xmpp = { :account => 'bullets_account@jabber.org',
+ :password => 'bullets_password_for_jabber',
+ :receiver => 'your_account@jabber.org',
+ :show_online_status => true }
+
+After that, you can enjoy the notifiers, that's cool!
+
+ # the notify message will be notified to rails logger, customized logger, growl or xmpp.
+ UniformNotifier.active_notfiiers.out_of_channel_notify(notify_message)
+
+ # the notify message will be wrapped by <script type="text/javascript">...</script>,
+ # you should append the javascript_str at the bottom of http response body.
+ # for more information, please check https://github.com/flyerhzm/bullet/blob/master/lib/bullet/rack.rb
+ responses = []
+ UniformNotifier.active_notifiers.each do |notifier|
+ responses << notifier.inline_notify(notify_message)
+ end
+ javascript_str = responses.join("\n")
+
+
+[0]: https://github.com/flyerhzm/bullet
Please sign in to comment.
Something went wrong with that request. Please try again.