notify-0.5.2/0000755000004100000410000000000012160310244013047 5ustar www-datawww-datanotify-0.5.2/LICENSE0000644000004100000410000000203112160310244014050 0ustar www-datawww-dataCopyright (c) 2009 jugyo 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. notify-0.5.2/README.md0000644000004100000410000000140012160310244014321 0ustar www-datawww-datanotify ====== "Notify" provides notification functionalities on cross platforms. Feature --------- Notify supports the following features: - growl - notify-send - Growl for Windows (`ruby_gntp`) - libnotify - Mountain Lion Notification Center (`terminal-notifier`) Installation --------- gem install notify Usage --------- require 'notify' Notify.notify "title", "message" or ENV['NOTIFY'] = 'growlnotify' require 'notify' Notify.notify "title", "message" Notify also allows passing in an app name to replace the default "ruby": require 'notify' Notify.notify "title", "message", { app_name: "My App" } Command --------- % notify title messages Copyright --------- Copyright (c) 2010 jugyo. See LICENSE for details. notify-0.5.2/Rakefile0000644000004100000410000000003312160310244014510 0ustar www-datawww-datarequire "bundler/gem_tasks"notify-0.5.2/VERSION0000644000004100000410000000000512160310244014112 0ustar www-datawww-data0.5.2notify-0.5.2/sample.rb0000644000004100000410000000017212160310244014655 0ustar www-datawww-data$:.unshift File.join(File.dirname(__FILE__), 'lib') require 'rubygems' require 'notify' Notify.notify 'title', 'message' notify-0.5.2/bin/0000755000004100000410000000000012160310244013617 5ustar www-datawww-datanotify-0.5.2/bin/notify0000755000004100000410000000032012160310244015050 0ustar www-datawww-data#!/usr/bin/env ruby $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'notify' title = ARGV.shift || 'Notify' message = ARGV.empty? ? 'notify' : ARGV.join("\n") Notify.notify title, message notify-0.5.2/checksums.yaml.gz0000444000004100000410000000041412160310244016334 0ustar www-datawww-dataUPQe1V@D"Xtv)n+/g= - !ruby/object:Gem::Version version: '1.3' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ~> - !ruby/object:Gem::Version version: '1.3' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' description: Desctop notify for many platform email: - jugyo.org@gmail.com executables: - notify extensions: [] extra_rdoc_files: [] files: - .gitignore - LICENSE - README.md - Rakefile - VERSION - bin/notify - lib/notify.rb - lib/notify/growlnotify.rb - lib/notify/kdialog.rb - lib/notify/libnotify.rb - lib/notify/notify-send.rb - lib/notify/ruby-growl.rb - lib/notify/ruby_gntp.rb - lib/notify/terminal-notifier.rb - lib/notify/version.rb - notify.gemspec - sample.rb homepage: http://github.com/jugyo/notify licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.0.3 signing_key: specification_version: 4 summary: Desctop notify for many platform test_files: [] has_rdoc: notify-0.5.2/.gitignore0000644000004100000410000000000412160310244015031 0ustar www-datawww-datapkg notify-0.5.2/lib/0000755000004100000410000000000012160310244013615 5ustar www-datawww-datanotify-0.5.2/lib/notify/0000755000004100000410000000000012160310244015125 5ustar www-datawww-datanotify-0.5.2/lib/notify/ruby_gntp.rb0000644000004100000410000000044612160310244017467 0ustar www-datawww-datamodule Notify begin require 'ruby_gntp' def self.notify(title, message, option = {}) GNTP.notify :app_name => option[:app_name] || "ruby", :title => title, :text => message, :icon => option[:icon] || "", :sticky => option[:sticky] || false end rescue LoadError end end notify-0.5.2/lib/notify/version.rb0000644000004100000410000000004512160310244017136 0ustar www-datawww-datamodule Notify VERSION = '0.5.2' endnotify-0.5.2/lib/notify/growlnotify.rb0000644000004100000410000000024212160310244020033 0ustar www-datawww-datamodule Notify if which('growlnotify') def self.notify(title, message, option = {}) system 'growlnotify', '-t', title, '-m', message end end end notify-0.5.2/lib/notify/kdialog.rb0000644000004100000410000000041612160310244017065 0ustar www-datawww-datamodule Notify if which('kdialog') def self.notify(title, message, option = {}) iconargs = option.key?(:icon) ? ["--icon", option[:icon]] : ["",""] system 'kdialog', '--passivepopup', message, '--title',title, iconargs[0], iconargs[1] end end end notify-0.5.2/lib/notify/terminal-notifier.rb0000644000004100000410000000032712160310244021104 0ustar www-datawww-datamodule Notify begin require 'terminal-notifier' def self.notify(title, message, options = {}) TerminalNotifier.notify(message, {:title => title}.merge(options)) end rescue LoadError end end notify-0.5.2/lib/notify/notify-send.rb0000644000004100000410000000035712160310244017716 0ustar www-datawww-datamodule Notify if which('notify-send') def self.notify(title, message, option = {}) iconargs = option.key?(:icon) ? ["-i", option[:icon]] : [] system 'notify-send', title, html_escape(message), *iconargs end end end notify-0.5.2/lib/notify/libnotify.rb0000644000004100000410000000034612160310244017454 0ustar www-datawww-datamodule Notify begin require 'libnotify' def self.notify(title, message, option={}) Libnotify.show(:summary => title, :body => html_escape(message), :icon_path => option[:icon]) end rescue LoadError end end notify-0.5.2/lib/notify/ruby-growl.rb0000644000004100000410000000052112160310244017561 0ustar www-datawww-datamodule Notify begin require 'ruby-growl' def self.notify(title, message, option = {}) @@growl = Growl.new 'localhost', option[:app_name] || "ruby" @@growl.add_notification 'notify' @@growl.notify 'notify', title, message, option[:priority] || 0, option[:sticky] || false end rescue LoadError end end notify-0.5.2/lib/notify.rb0000644000004100000410000000203612160310244015453 0ustar www-datawww-datarequire 'fileutils' require 'erb' require 'notify/version' module Notify def self.which(prog, path=ENV['PATH']) if RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin|cygwin/ path.split(File::PATH_SEPARATOR).each {|dir| f = File.join(dir,prog+".exe") return f if File.executable?(File.join(f)) && !File.directory?(f) } nil else return system("which #{prog} > /dev/null 2>&1") end end def self.html_escape(text) ERB::Util.html_escape(text) end end dir = File.dirname(__FILE__) begin if ENV['NOTIFY'] require File.join(dir, "notify/#{ENV['NOTIFY']}") else Dir[File.join(dir, "notify/*.rb")].each do |filename| break if Notify.methods.include?(:notify) require filename end end rescue LoadError # A safeguard against bad libraries or edge-case errors. puts "Notify can't find the library specified." end module Notify unless methods.include?(:notify) def self.notify(title, message, options = {}) puts "#{title}: #{message}" end end end notify-0.5.2/notify.gemspec0000644000004100000410000000152412160310244015726 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'notify/version' Gem::Specification.new do |spec| spec.name = "notify" spec.version = Notify::VERSION spec.authors = ["jugyo"] spec.email = ["jugyo.org@gmail.com"] spec.description = %q{Desctop notify for many platform} spec.summary = %q{Desctop notify for many platform} spec.homepage = "http://github.com/jugyo/notify" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end