rjb 1.7.0 → 1.7.1
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.
- checksums.yaml +4 -4
- data/ChangeLog +7 -0
- data/ext/rjb.c +1 -1
- data/lib/rjb/extension.rb +5 -1
- data/test/exttest.rb +12 -2
- data/test/listtest.rb +1 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f7c998ac143e7b5e4bbdc1aa2e74801684f2b3b9921a45bf121c5e5c59b9692
|
4
|
+
data.tar.gz: 137e9ee1214fcfadd9c797aff35877a19f3e2c8aa6be9d22ea1a2cdaac9ddfc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54efe3ce4191e7d64cadd2945dd6aec9445fbdb728f00ca6ae3c8f2ef82a5c256f7f452917b08528d06821ef6df906eea29bf152e886863b5ddf271291d903ce
|
7
|
+
data.tar.gz: ca5e74ae621c4531e188c10e3b502b07eb4f0ce3d1c9fb5abcff52390040bc999ad0429ca950e29694ee83c3a10bb0cc86a9bcecf2bb2420780ba73d7d4b36ea
|
data/ChangeLog
CHANGED
data/ext/rjb.c
CHANGED
data/lib/rjb/extension.rb
CHANGED
@@ -51,7 +51,11 @@ module Kernel
|
|
51
51
|
|
52
52
|
# This will maybe use the wrong jar file from a previous version of the GEM
|
53
53
|
# puts "LOAD PATH #{$LOAD_PATH}"
|
54
|
-
|
54
|
+
if File.respond_to?(:absolute_path?) && File.absolute_path?(path)
|
55
|
+
found_path = File.exist?(path) ? '' : nil
|
56
|
+
else
|
57
|
+
found_path = $LOAD_PATH.reverse.find {|p| File.exist?(File.join(p, path))}
|
58
|
+
end
|
55
59
|
raise unless found_path
|
56
60
|
|
57
61
|
abs_path = File.join(found_path, path)
|
data/test/exttest.rb
CHANGED
@@ -26,9 +26,18 @@ class ExtTestRjb < Test::Unit::TestCase
|
|
26
26
|
def jp
|
27
27
|
JavaPackage.new('jp')
|
28
28
|
end
|
29
|
-
|
30
|
-
def
|
29
|
+
|
30
|
+
def test_absolute_path_require
|
31
31
|
assert !Rjb::loaded?
|
32
|
+
require File.absolute_path('./rjbtest.jar')
|
33
|
+
Rjb::load
|
34
|
+
assert Rjb::loaded?
|
35
|
+
base = jp.co.infoseek.hp.arton.rjb.Base.new
|
36
|
+
assert_equal('hello', base.instance_var)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_require_extension
|
40
|
+
org_load_path = $LOAD_PATH
|
32
41
|
$LOAD_PATH << '.'
|
33
42
|
require 'rjbtest.jar'
|
34
43
|
Rjb::load
|
@@ -36,4 +45,5 @@ class ExtTestRjb < Test::Unit::TestCase
|
|
36
45
|
base = jp.co.infoseek.hp.arton.rjb.Base.new
|
37
46
|
assert_equal('hello', base.instance_var)
|
38
47
|
end
|
48
|
+
|
39
49
|
end
|
data/test/listtest.rb
CHANGED
@@ -4,22 +4,20 @@
|
|
4
4
|
Copyright(c) 2012 arton
|
5
5
|
=end
|
6
6
|
|
7
|
-
require 'test/unit'
|
8
7
|
begin
|
9
8
|
require 'rjb/list'
|
10
9
|
rescue LoadError
|
11
10
|
require 'rubygems'
|
12
11
|
require 'rjb/list'
|
13
12
|
end
|
13
|
+
require 'test/unit'
|
14
14
|
require 'fileutils'
|
15
15
|
|
16
16
|
class ListTest < Test::Unit::TestCase
|
17
17
|
include Rjb
|
18
18
|
def test_create
|
19
19
|
ja = import('java.util.ArrayList')
|
20
|
-
p 'imported'
|
21
20
|
a = ja.new
|
22
|
-
p 'new'
|
23
21
|
a.add(1)
|
24
22
|
a.add(2)
|
25
23
|
a.add(3)
|
@@ -30,7 +28,6 @@ p 'new'
|
|
30
28
|
end
|
31
29
|
assert_equal 4, n
|
32
30
|
end
|
33
|
-
=begin
|
34
31
|
def test_returned_proxy
|
35
32
|
ja = import('java.util.Arrays')
|
36
33
|
a = ja.as_list([1, 2, 3])
|
@@ -55,6 +52,5 @@ p 'new'
|
|
55
52
|
ja = import('java.util.Arrays')
|
56
53
|
assert_equal 55, ja.as_list((1..10).to_a).inject(0) {|r, e| r + e.intValue}
|
57
54
|
end
|
58
|
-
=end
|
59
55
|
end
|
60
56
|
|