Skip to content

Commit c6f7e91

Browse files
committed
First cut at eliminating non jruby-9k code and updating specs
1 parent 6fe5121 commit c6f7e91

File tree

32 files changed

+71
-10472
lines changed

32 files changed

+71
-10472
lines changed

.travis.yml

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
rvm:
2-
- jruby-1.7.8
2+
- jruby-9.0.0.0.pre1
33
branches:
44
only:
55
- master
6-
env:
7-
- JRUBY_OPTS="--1.8 --server -Xcext.enabled=false -Xcompile.invokedynamic=false"
8-
- JRUBY_OPTS="--1.9 --server -Xcext.enabled=false -Xcompile.invokedynamic=false"
6+
- 2.x-dev
97
matrix:
108
include:
119
- rvm: jruby-head
1210
env: JRUBY_OPTS="--server -Xcext.enabled=false -Xcompile.invokedynamic=false"
13-
- rvm: jruby-1.7.19
11+
- rvm: jruby-9.0.0.0.pre1
1412
env: JRUBY_OPTS="--server -Xcext.enabled=false -Xcompile.invokedynamic=false"
15-
- rvm: 1.8.7
16-
env: ''
17-
- rvm: 1.9.2
18-
env: ''
19-
- rvm: 1.9.3
20-
env: ''
21-
- rvm: jruby
22-
env: MAVEN_OPTS="-XX:MaxPermSize=128m"
23-
script: mvn clean verify
2413
allow_failures:
2514
- rvm: jruby-head
2615
notifications:

Gemfile

-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,3 @@ group :development do
88
gem "childprocess", :platform => :mri
99
gem "maven-tools", "~> 0.34.5"
1010
end
11-
12-
if RUBY_VERSION < "1.9"
13-
gem 'rubyzip', '~> 0.9'
14-
end

History.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
== Master
1+
== 2x-dev
2+
3+
- #319: Adds capacity to use the jruby-jars gem version for JRuby 9k.
24

35
== 1.4.6
46
- #318: polish *scripts/rails* - require_relative should no longer be used
@@ -7,7 +9,6 @@
79
- #313: Update Jetty to 9.2.10
810
- #311: Don't clear the environment if a java executable is found
911
- #268: Compile's clearing of ENV vars makes it impossible to use custom compile vars
10-
- Adds capacity to use the jruby-jars gem version for JRuby 9k.
1112

1213
== 1.4.5
1314
- #282: Wrong default GEM_HOME in generated META-INF/init.rb
@@ -252,7 +253,7 @@
252253
- RailsConf 2009 edition.
253254
- Only bundled JRuby and JRuby-Rack upgrades. Bug fixes will have to come in 0.9.14.
254255
- This should also be the last release with bundled JRuby and JRuby-Rack.
255-
- Upgrade to JRuby 1.3.0RC1 and JRuby-Rack 0.9.4. The latter allows
256+
- Upgrade to JRuby 1.3.0RC1 and JRuby-Rack 0.9.4. The latter allows
256257
Rails 2.3 to work with Warbler.
257258

258259
== 0.9.12

lib/warbler/zip_support.rb

+3-21
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
module Warbler
2-
class ZipSupportRubyZip0_9
3-
def self.create(filename, &blk)
4-
Zip::ZipFile.open(filename, Zip::ZipFile::CREATE, &blk)
5-
end
1+
require 'zip'
62

7-
def self.open(filename, &blk)
8-
Zip::ZipFile.open(filename, &blk)
9-
end
10-
end
11-
12-
class ZipSupportRubyZip1_0
3+
module Warbler
4+
class ZipSupport
135
def self.create(filename, &blk)
146
Zip::File.open(filename, Zip::File::CREATE, &blk)
157
end
@@ -19,13 +11,3 @@ def self.open(filename, &blk)
1911
end
2012
end
2113
end
22-
23-
begin
24-
require 'zip/zip'
25-
Warbler::ZipSupport = Warbler::ZipSupportRubyZip0_9
26-
rescue LoadError => e
27-
raise e unless e.message =~ /zip/
28-
29-
require 'zip'
30-
Warbler::ZipSupport = Warbler::ZipSupportRubyZip1_0
31-
end

spec/drb_default_id_conv.rb

+48-50
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,60 @@
22

33
if defined?(JRUBY_VERSION)
44
require 'jruby'
5-
if JRuby.runtime.is1_9 # only changing for jruby --1.9 !
6-
7-
require 'weakref'
8-
class DRb::WeakRefDRbIdConv
9-
10-
def initialize
11-
@id2ref = {}
12-
end
135

14-
# Convert an object reference id to an object.
15-
#
16-
# This implementation looks up the reference id in the local object
17-
# space and returns the object it refers to.
18-
def to_obj(ref)
19-
_get(ref) || super
20-
end
6+
require 'weakref'
7+
class DRb::WeakRefDRbIdConv
218

22-
# Convert an object into a reference id.
23-
#
24-
# This implementation returns the object's __id__ in the local
25-
# object space.
26-
def to_id(obj)
27-
(obj.nil? ? nil : _put(obj)) || super
28-
end
9+
def initialize
10+
@id2ref = {}
11+
end
2912

30-
def _clean
31-
dead = []
32-
@id2ref.each {|id,weakref| dead << id unless weakref.weakref_alive?}
33-
dead.each {|id| @id2ref.delete(id)}
34-
end
13+
# Convert an object reference id to an object.
14+
#
15+
# This implementation looks up the reference id in the local object
16+
# space and returns the object it refers to.
17+
def to_obj(ref)
18+
_get(ref) || super
19+
end
3520

36-
def _put(obj)
37-
_clean
38-
@id2ref[obj.__id__] = WeakRef.new(obj)
39-
obj.__id__
40-
end
21+
# Convert an object into a reference id.
22+
#
23+
# This implementation returns the object's __id__ in the local
24+
# object space.
25+
def to_id(obj)
26+
(obj.nil? ? nil : _put(obj)) || super
27+
end
4128

42-
def _get(id)
43-
weakref = @id2ref[id]
44-
if weakref
45-
result = weakref.__getobj__ rescue nil
46-
if result
47-
return result
48-
else
49-
@id2ref.delete id
50-
end
29+
def _clean
30+
dead = []
31+
@id2ref.each {|id,weakref| dead << id unless weakref.weakref_alive?}
32+
dead.each {|id| @id2ref.delete(id)}
33+
end
34+
35+
def _put(obj)
36+
_clean
37+
@id2ref[obj.__id__] = WeakRef.new(obj)
38+
obj.__id__
39+
end
40+
41+
def _get(id)
42+
weakref = @id2ref[id]
43+
if weakref
44+
result = weakref.__getobj__ rescue nil
45+
if result
46+
return result
47+
else
48+
@id2ref.delete id
5149
end
52-
nil
5350
end
54-
private :_clean, :_put, :_get
55-
51+
nil
5652
end
57-
58-
# NOTE: the same default object id converter #DRb::DRbIdConv as in 1.8 mode
59-
# (not relying on ObjectSpace which is what #DRb::DRbIdConv does in 1.9) :
60-
DRb::DRbServer.default_id_conv(DRb::WeakRefDRbIdConv.new)
61-
53+
private :_clean, :_put, :_get
54+
6255
end
63-
end
56+
57+
# NOTE: the same default object id converter #DRb::DRbIdConv as in 1.8 mode
58+
# (not relying on ObjectSpace which is what #DRb::DRbIdConv does in 1.9) :
59+
DRb::DRbServer.default_id_conv(DRb::WeakRefDRbIdConv.new)
60+
61+
end

spec/sample_bundler/Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
source :rubygems
1+
source "https://rubygems.org"
22

33
gem 'rake'

spec/sample_bundler/Gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
2-
remote: http://rubygems.org/
2+
remote: https://rubygems.org/
33
specs:
4-
rake (0.8.7)
4+
rake (10.4.2)
55

66
PLATFORMS
77
java

spec/sample_bundler/vendor/bundle/jruby/1.8/bin/rake

-19
This file was deleted.
Binary file not shown.

spec/sample_bundler/vendor/bundle/jruby/1.8/gems/rake-0.8.7/bin/rake

-31
This file was deleted.

0 commit comments

Comments
 (0)