Skip to content

Commit f85f9ca

Browse files
committed
add java platform checks
1 parent 0697f26 commit f85f9ca

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

geoscript.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ $:.push File.expand_path('../lib', __FILE__)
33
require 'geoscript/version'
44

55
Gem::Specification.new do |gem|
6-
gem.name = 'geoscript'
6+
gem.name = 'geoscript-ruby'
77
gem.version = GeoScript::VERSION
88
gem.summary = 'GeoScript is a library for making use of GeoTools from JRuby easier and more fun.'
99
gem.description = 'GeoScript for JRuby - makes using GeoTools from JRuby easier and more fun.'
10+
gem.platform = 'java'
1011
gem.licenses = ['MIT']
1112

1213
gem.authors = ['Scooter Wadsworth']

lib/geoscript.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
$:.push File.expand_path(File.join(File.dirname(__FILE__), 'geoscript'))
22

3-
require 'java'
3+
if defined?(JRUBY_VERSION)
4+
require 'java'
45

5-
Dir.entries(File.join(File.expand_path(File.dirname(__FILE__)), 'geotools')).sort.each do |entry|
6-
if entry =~ /.jar$/
7-
$CLASSPATH << File.join(File.expand_path(File.dirname(__FILE__)), "/geotools/#{entry}")
6+
Dir.entries(File.join(File.expand_path(File.dirname(__FILE__)), 'geotools')).sort.each do |entry|
7+
if entry =~ /.jar$/
8+
$CLASSPATH << File.join(File.expand_path(File.dirname(__FILE__)), "/geotools/#{entry}")
9+
end
810
end
9-
end
1011

11-
java_import org.geotools.factory.Hints
12-
13-
unless java.lang.System.get_property("org.geotools.referencing.forceXY") == "true"
14-
java.lang.System.set_property "org.geotools.referencing.forceXY", "true"
15-
end
16-
Hints.put_system_default Hints::FORCE_LONGITUDE_FIRST_AXIS_ORDER, java.lang.Boolean.new(true)
17-
18-
require 'geoscript/version'
19-
require 'geoscript/util'
20-
require 'geoscript/projection'
21-
require 'geoscript/geom'
12+
require 'geoscript/version'
13+
require 'geoscript/util'
14+
require 'geoscript/projection'
15+
require 'geoscript/geom'
16+
#require 'geoscript/feature'
17+
else
18+
warn "GeoScript is for JRuby only"
19+
end

0 commit comments

Comments
 (0)