rjb 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb30d6521841ff5187f03891746f241d1484f6acec69219124321a77d0f9e183
4
- data.tar.gz: fcbcc52de14fd2103fdb2e3ffad9644cbf74587c621c5362c02a4fa46c6a40b2
3
+ metadata.gz: 2f7c998ac143e7b5e4bbdc1aa2e74801684f2b3b9921a45bf121c5e5c59b9692
4
+ data.tar.gz: 137e9ee1214fcfadd9c797aff35877a19f3e2c8aa6be9d22ea1a2cdaac9ddfc5
5
5
  SHA512:
6
- metadata.gz: 77f20a728bad840480a3851c78a60970cd6e773d3b4261c8d738099177af9f69d04010d7ba3c4ee914dcbed0c5608976689ba4a7cd7d94797d523709ab1b81ad
7
- data.tar.gz: 499ca077eb5cedae7eef353d2964a7e6be942bcbddcf14939d141913856ede4a2d5f09cbf76a0edebb4cb00c021ba64859dc1517dc9769a85ea609b46ec9b249
6
+ metadata.gz: 54efe3ce4191e7d64cadd2945dd6aec9445fbdb728f00ca6ae3c8f2ef82a5c256f7f452917b08528d06821ef6df906eea29bf152e886863b5ddf271291d903ce
7
+ data.tar.gz: ca5e74ae621c4531e188c10e3b502b07eb4f0ce3d1c9fb5abcff52390040bc999ad0429ca950e29694ee83c3a10bb0cc86a9bcecf2bb2420780ba73d7d4b36ea
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ Sun Apr 14 2024 arton
2
+ * ext/rjb.c
3
+ RJB_VERSION -> 1.7.1
4
+ * lib/rjb/extension.rb
5
+ skip $LOAD_PATH check if absolute path was given
6
+ * test/exttest.rb
7
+ add absolute path test
1
8
  Sun Apr 14 2024 arton
2
9
  * ext/rjb.c
3
10
  RJB_VERSION -> 1.7.0
data/ext/rjb.c CHANGED
@@ -14,7 +14,7 @@
14
14
  *
15
15
  */
16
16
 
17
- #define RJB_VERSION "1.7.0"
17
+ #define RJB_VERSION "1.7.1"
18
18
 
19
19
  #include "ruby.h"
20
20
  #include "extconf.h"
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
- found_path = $LOAD_PATH.reverse.find{|p| File.exist?(File.join(p,path))}
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 test_require_extension
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - arton