notify 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 jugyo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ notify
2
+ ======
3
+
4
+ The "notify" provides a function to notify on cross platform.
5
+
6
+ Feature
7
+ ---------
8
+
9
+ It supports followings:
10
+
11
+ - growl
12
+ - notify-send
13
+
14
+ Installation
15
+ ---------
16
+
17
+ gem install notify
18
+
19
+ Usage
20
+ ---------
21
+
22
+ require 'notify'
23
+ Notify.notify "title", "message"
24
+
25
+ Copyright
26
+ ---------
27
+
28
+ Copyright (c) 2010 jugyo. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "notify"
8
+ gem.summary = %Q{A function to notify on cross platform.}
9
+ gem.description = %Q{The "notify" provides a function to notify on cross platform.}
10
+ gem.email = "jugyo.org@gmail.com"
11
+ gem.homepage = "http://github.com/jugyo/notify"
12
+ gem.authors = ["jugyo"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/test_*.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+ task :test => :check_dependencies
40
+
41
+ task :default => :test
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "notify #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,11 @@
1
+ begin
2
+ require 'ruby-growl'
3
+
4
+ module Notify
5
+ @@growl = Growl.new 'localhost', 'ruby', ['notify']
6
+ def self.notify(title, message)
7
+ @@growl.notify 'notify', title, message
8
+ end
9
+ end
10
+ rescue LoadError
11
+ end
@@ -0,0 +1,7 @@
1
+ if RUBY_PLATFORM.downcase =~ /linux/ && system('which notify-send 2>&1 > /dev/null')
2
+ module Notify
3
+ def self.notify(title, message)
4
+ system 'notify-send', title, message
5
+ end
6
+ end
7
+ end
data/lib/notify.rb ADDED
@@ -0,0 +1,24 @@
1
+ unless defined? __DIR__
2
+ __DIR__ = File.dirname(__FILE__)
3
+ end
4
+
5
+ if ENV['NOTIFY']
6
+ begin
7
+ require File.join(__DIR__, "notify/#{ENV['NOTIFY']}")
8
+ rescue LoadError
9
+ end
10
+ else
11
+ unless defined? Notify
12
+ Dir[File.join(__DIR__, "notify/*.rb")].each do |filename|
13
+ require filename
14
+ end
15
+ end
16
+ end
17
+
18
+ unless defined? Notify
19
+ module Notify
20
+ def self.notify(title, message)
21
+ $stderr.puts "#{title}: #{message}"
22
+ end
23
+ end
24
+ end
data/sample.rb ADDED
@@ -0,0 +1,5 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
2
+ require 'rubygems'
3
+ require 'notify'
4
+
5
+ Notify.notify 'title', 'message'
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: notify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - jugyo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-30 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: The "notify" provides a function to notify on cross platform.
17
+ email: jugyo.org@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.md
25
+ files:
26
+ - LICENSE
27
+ - README.md
28
+ - Rakefile
29
+ - VERSION
30
+ - lib/notify.rb
31
+ - lib/notify/growl.rb
32
+ - lib/notify/notify-send.rb
33
+ - sample.rb
34
+ has_rdoc: true
35
+ homepage: http://github.com/jugyo/notify
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options:
40
+ - --charset=UTF-8
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.3.5
59
+ signing_key:
60
+ specification_version: 3
61
+ summary: A function to notify on cross platform.
62
+ test_files: []
63
+