jruby-notify 0.0.1 → 0.0.2

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/lib/jruby-notify.rb CHANGED
@@ -3,7 +3,7 @@ require 'jnotify/jnotify-0.93.jar'
3
3
 
4
4
  module JRubyNotify
5
5
 
6
- VERSION = '0.0.1'
6
+ VERSION = '0.0.2'
7
7
 
8
8
  FILE_CREATED = 1
9
9
  FILE_DELETED = 2
@@ -15,12 +15,27 @@ module JRubyNotify
15
15
  autoload :Notify, 'jruby-notify/notify'
16
16
  autoload :Listener, 'jruby-notify/listener'
17
17
 
18
+ #
19
+ # Tests if the native library can be loaded
20
+ #
21
+ def self.supported?
22
+ define_library_path
23
+ begin
24
+ Java::NetContentobjectsJNotify::JNotify
25
+ true
26
+ rescue NameError
27
+ false
28
+ end
29
+ end
30
+
18
31
  #
19
32
  # Defines the environment to be able to load the native
20
33
  # JNotify libraries
21
34
  #
22
35
  def self.define_library_path
23
36
  library_path = java.lang.System.get_property('java.library.path')
37
+ return if library_path =~ /jnotify/i
38
+
24
39
  jnotify_library_path = File.expand_path(File.join(File.dirname(__FILE__), 'jnotify', 'shared'))
25
40
  new_library_path = [jnotify_library_path, library_path].join(java.io.File.pathSeparator)
26
41
  java.lang.System.set_property('java.library.path', new_library_path)
@@ -1,5 +1,3 @@
1
- require 'java'
2
-
3
1
  module JRubyNotify
4
2
  class Listener
5
3
  include Java::NetContentobjectsJnotify::JNotifyListener
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Kessler
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- hash: -4333716301106278902
97
+ hash: -3585833415011794431
98
98
  segments:
99
99
  - 0
100
100
  version: "0"
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - ">="
105
105
  - !ruby/object:Gem::Version
106
- hash: -4333716301106278902
106
+ hash: -3585833415011794431
107
107
  segments:
108
108
  - 0
109
109
  version: "0"