geos-extensions 0.5.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: 0f523079fe37b7c9355ecc5e8ddfbdda5c22c86e
4
- data.tar.gz: 1313e3b2e598201492583b42e150eb4d645597e3
3
+ metadata.gz: 6f5adfee693cca7bcf4ddf2aa10487d225c0c542
4
+ data.tar.gz: ec1a90597c0676234ea1493331aff022f89699fd
5
5
  SHA512:
6
- metadata.gz: e4bc344481311348a4d202e259eafca169b4c9c41a9553b0fd7935e1ce2392e6ce7f34c574dd9ea9cd78798bfa6bff17064e4fdf63e2bed9730e9a096c4c9e26
7
- data.tar.gz: 11fa83121c08ddda59ff6035bdd1d8057709b228af564d742d3128c6248b1558553654079d256c89cf8f47d03b998026fd63b206d683c69924985e1d84dbfe2d
6
+ metadata.gz: 60eb6880603184b2545c6642ca97e870dfd8f87fccc1fc517fa959c532bcb50b4919a41025a5b085128d098d0324240c20d8b8747e4bfec130480f20052b8e5d
7
+ data.tar.gz: cfd7ee85ece68614b1c271751de00c9664273420c56cd28d73066d4db8e95dca29541ba542679a3ae4d2a274400ba0930786ec8662ed2b23620c789e05e20e0e
data/Gemfile CHANGED
@@ -6,12 +6,16 @@ gem "rdoc", "~> 3.12"
6
6
  gem "rake", "~> 10.0"
7
7
  gem "minitest"
8
8
  gem "minitest-reporters"
9
- gem "guard-minitest"
10
- gem "simplecov"
11
9
 
12
- if RbConfig::CONFIG['host_os'] =~ /^darwin/
13
- gem "rb-fsevent"
14
- gem "growl"
10
+ platforms :rbx do
11
+ gem 'rubysl', '~> 2.0'
12
+ gem 'rubinius-developer_tools'
13
+ end
14
+
15
+ if RUBY_VERSION >= '1.9'
16
+ gem "simplecov"
17
+ gem "guard"
18
+ gem 'guard-minitest'
15
19
  end
16
20
 
17
21
  if File.exists?('Gemfile.local')
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 2167961 Ontario Inc., Zoocasa <code@zoocasa.com>
1
+ Copyright (c) 2008-2016 J Smith <dark.panda@gmail.com>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
- = Zoocasa GEOS Extensions
2
+ = GEOS Extensions
3
3
 
4
- The Zoocasa GEOS Extensions library (ZGEL) is a set of utilities and tools that
4
+ The GEOS Extensions library (GEL) is a set of utilities and tools that
5
5
  extend the GEOS Ruby bindings module. From http://geos.refractions.net/ ...
6
6
 
7
7
  GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology
@@ -21,7 +21,7 @@ in the geos-extensions gemspec.
21
21
 
22
22
  The ffi-geos gem is available at https://github.com/dark-panda/ffi-geos .
23
23
 
24
- ZGEL contains a number of enhancements to the GEOS Ruby library:
24
+ GEL contains a number of enhancements to the GEOS Ruby library:
25
25
 
26
26
  * a host of helper methods to make reading and writing to and from WKT
27
27
  and WKB easier. For instance, rather than
@@ -48,7 +48,7 @@ ZGEL contains a number of enhancements to the GEOS Ruby library:
48
48
 
49
49
  == Google Maps API Output
50
50
 
51
- Starting with version 0.1.0, ZGEL supports both Google Maps API
51
+ Starting with version 0.1.0, GEL supports both Google Maps API
52
52
  version 2 and version 3 style outputs. By default and for the sake of
53
53
  backwards compatibility, API version 2 output will remain the default
54
54
  but as Google has deprecated API version 2, so shall we at some point
@@ -75,7 +75,18 @@ version 2 since switching between the two is pretty painless.
75
75
  This extension used to contain a bunch of extensions to ActiveRecord, but as of
76
76
  version 0.3.0 we have decided to strip those extensions out and move them into
77
77
  their own gem called activerecord-spatial available at
78
- https://github.com/zoocasa/activerecord-spatial .
78
+ https://github.com/dark-panda/activerecord-spatial .
79
+
80
+ == Error Handling in 1.0+
81
+
82
+ Starting with GEL 1.0.0, parser exceptions raised from methods like
83
+ `Geos.from_g_lat_lng` and `Geos.from_box2d` are now instances of
84
+ `Geos::Extensions::InvalidGLatLngFormatError` and `Geos::Extensions::InvalidBox2DError`
85
+ respectively, which themselves are inherited from `Geos::ParseError`,
86
+ `Geos::Error` and `RuntimeError`. This reflects similar changes in ffi-geos
87
+ 1.0.0. For compatibility purposes with older versions of ffi-geos and the
88
+ native geos library, the exception classes in `Geos` will be created for
89
+ you if they aren't already defined.
79
90
 
80
91
  == Thanks
81
92
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.authors = ["J Smith"]
11
11
  s.description = "Extensions for the GEOS library."
12
12
  s.summary = s.description
13
- s.email = "code@zoocasa.com"
13
+ s.email = "dark.panda@gmail.com"
14
14
  s.license = "MIT"
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.files = `git ls-files`.split($\)
19
19
  s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
20
20
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
21
- s.homepage = "http://github.com/zoocasa/geos-extensions"
21
+ s.homepage = "http://github.com/dark-panda/geos-extensions"
22
22
  s.require_paths = ["lib"]
23
23
 
24
24
  s.add_dependency("ffi-geos", [">= 0.1"])
@@ -74,7 +74,7 @@ module Geos
74
74
  }
75
75
  end
76
76
  end
77
- alias :to_jsonable :as_json
77
+ alias_method :to_jsonable, :as_json
78
78
 
79
79
  def as_geojson(options = {})
80
80
  {
@@ -82,7 +82,7 @@ module Geos
82
82
  :coordinates => self.to_a
83
83
  }
84
84
  end
85
- alias :to_geojsonable :as_geojson
85
+ alias_method :to_geojsonable, :as_geojson
86
86
 
87
87
  def to_geojson(options = {})
88
88
  self.to_geojsonable(options).to_json
@@ -0,0 +1,27 @@
1
+
2
+ module Geos
3
+ unless defined?(Geos::Error)
4
+ class Error < ::RuntimeError
5
+ end
6
+ end
7
+
8
+ unless defined?(Geos::ParseError)
9
+ class ParseError < Error
10
+ end
11
+ end
12
+
13
+ module Extensions
14
+ class InvalidGLatLngFormatError < Geos::ParseError
15
+ def initialize
16
+ super("Invalid GLatLng format")
17
+ end
18
+ end
19
+
20
+ class InvalidBox2DError < Geos::ParseError
21
+ def initialize
22
+ super("Invalid BOX2D")
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Geos
3
3
  module Extensions
4
- VERSION = "0.5.0"
4
+ VERSION = '1.0.0'.freeze
5
5
  end
6
6
  end
7
7
 
data/lib/geos/geometry.rb CHANGED
@@ -93,8 +93,8 @@ module Geos
93
93
  @upper_left = Geos::wkt_reader_singleton.read("POINT(#{cs.get_x(3)} #{cs.get_y(3)})")
94
94
  end
95
95
  end
96
- alias :nw :upper_left
97
- alias :northwest :upper_left
96
+ alias_method :nw, :upper_left
97
+ alias_method :northwest, :upper_left
98
98
 
99
99
  # Returns a Point for the envelope's upper right coordinate.
100
100
  def upper_right
@@ -105,8 +105,8 @@ module Geos
105
105
  @upper_right = Geos::wkt_reader_singleton.read("POINT(#{cs.get_x(2)} #{cs.get_y(2)})")
106
106
  end
107
107
  end
108
- alias :ne :upper_right
109
- alias :northeast :upper_right
108
+ alias_method :ne, :upper_right
109
+ alias_method :northeast, :upper_right
110
110
 
111
111
  # Returns a Point for the envelope's lower right coordinate.
112
112
  def lower_right
@@ -117,8 +117,8 @@ module Geos
117
117
  @lower_right = Geos::wkt_reader_singleton.read("POINT(#{cs.get_x(1)} #{cs.get_y(1)})")
118
118
  end
119
119
  end
120
- alias :se :lower_right
121
- alias :southeast :lower_right
120
+ alias_method :se, :lower_right
121
+ alias_method :southeast, :lower_right
122
122
 
123
123
  # Returns a Point for the envelope's lower left coordinate.
124
124
  def lower_left
@@ -129,8 +129,8 @@ module Geos
129
129
  @lower_left = Geos::wkt_reader_singleton.read("POINT(#{cs.get_x(0)} #{cs.get_y(0)})")
130
130
  end
131
131
  end
132
- alias :sw :lower_left
133
- alias :southwest :lower_left
132
+ alias_method :sw, :lower_left
133
+ alias_method :southwest, :lower_left
134
134
 
135
135
  # Northern-most Y coordinate.
136
136
  def top
@@ -140,8 +140,8 @@ module Geos
140
140
  @top = self.upper_right.y
141
141
  end
142
142
  end
143
- alias :n :top
144
- alias :north :top
143
+ alias_method :n, :top
144
+ alias_method :north, :top
145
145
 
146
146
  # Eastern-most X coordinate.
147
147
  def right
@@ -151,8 +151,8 @@ module Geos
151
151
  @right = self.upper_right.x
152
152
  end
153
153
  end
154
- alias :e :right
155
- alias :east :right
154
+ alias_method :e, :right
155
+ alias_method :east, :right
156
156
 
157
157
  # Southern-most Y coordinate.
158
158
  def bottom
@@ -162,8 +162,8 @@ module Geos
162
162
  @bottom = self.lower_left.y
163
163
  end
164
164
  end
165
- alias :s :bottom
166
- alias :south :bottom
165
+ alias_method :s, :bottom
166
+ alias_method :south, :bottom
167
167
 
168
168
  # Western-most X coordinate.
169
169
  def left
@@ -173,8 +173,8 @@ module Geos
173
173
  @left = self.lower_left.x
174
174
  end
175
175
  end
176
- alias :w :left
177
- alias :west :left
176
+ alias_method :w, :left
177
+ alias_method :west, :left
178
178
 
179
179
  # Spits out a bounding box the way Flickr likes it. You can set the
180
180
  # precision of the rounding using the :precision option. In order to
@@ -203,21 +203,21 @@ module Geos
203
203
  def lat_lng
204
204
  self.centroid.to_a[0, 2].reverse
205
205
  end
206
- alias :lat_long :lat_lng
207
- alias :latlng :lat_lng
208
- alias :latlong :lat_lng
209
- alias :lat_lon :lat_lng
210
- alias :latlon :lat_lng
206
+ alias_method :lat_long, :lat_lng
207
+ alias_method :latlng, :lat_lng
208
+ alias_method :latlong, :lat_lng
209
+ alias_method :lat_lon, :lat_lng
210
+ alias_method :latlon, :lat_lng
211
211
 
212
212
  # Returns the X and Y coordinates of the Geometry's centroid in an Array.
213
213
  def lng_lat
214
214
  self.centroid.to_a[0, 2]
215
215
  end
216
- alias :long_lat :lng_lat
217
- alias :lnglat :lng_lat
218
- alias :longlat :lng_lat
219
- alias :lon_lat :lng_lat
220
- alias :lonlat :lng_lat
216
+ alias_method :long_lat, :lng_lat
217
+ alias_method :lnglat, :lng_lat
218
+ alias_method :longlat, :lng_lat
219
+ alias_method :lon_lat, :lng_lat
220
+ alias_method :lonlat, :lng_lat
221
221
 
222
222
  # Spits out a Hash containing the cardinal points that describe the
223
223
  # Geometry's bbox.
@@ -16,7 +16,7 @@ module Geos
16
16
  def [](*args)
17
17
  self.to_a[*args]
18
18
  end
19
- alias :slice :[]
19
+ alias_method :slice, :[]
20
20
  end
21
21
 
22
22
  # Returns the last geometry from the collection.
@@ -30,7 +30,7 @@ module Geos
30
30
  p.to_jsonable options
31
31
  end
32
32
  end
33
- alias :to_jsonable :as_json
33
+ alias_method :to_jsonable, :as_json
34
34
 
35
35
  # Build some XmlMarkup for KML.
36
36
  def to_kml(*args)
@@ -54,7 +54,7 @@ module Geos
54
54
  :geometries => self.to_a.collect { |g| g.to_geojsonable(options) }
55
55
  }
56
56
  end
57
- alias :to_geojsonable :as_geojson
57
+ alias_method :to_geojsonable, :as_geojson
58
58
  end
59
59
  end
60
60
 
@@ -181,7 +181,7 @@ module Geos::GoogleMaps
181
181
  p.to_g_polyline_api3(polyline_options, options)
182
182
  end
183
183
  end
184
- alias :to_g_polylines_api3 :to_g_polyline_api3
184
+ alias_method :to_g_polylines_api3, :to_g_polyline_api3
185
185
 
186
186
  # Returns a Ruby Array of Polygons for each geometry in the
187
187
  # collection. If the :single option is set, a single Polygon object will
@@ -4,12 +4,12 @@ module Geos
4
4
  def as_json(options = {})
5
5
  self.coord_seq.as_json(options)
6
6
  end
7
- alias :to_jsonable :as_json
7
+ alias_method :to_jsonable, :as_json
8
8
 
9
9
  def as_geojson(options = {})
10
10
  self.coord_seq.to_geojsonable(options)
11
11
  end
12
- alias :to_geojsonable :as_geojson
12
+ alias_method :to_geojsonable, :as_geojson
13
13
  end
14
14
  end
15
15
 
@@ -9,7 +9,7 @@ module Geos
9
9
  }
10
10
  }
11
11
  end
12
- alias :as_geojson :to_geojsonable
12
+ alias_method :as_geojson, :to_geojsonable
13
13
  end
14
14
  end
15
15
 
@@ -9,7 +9,7 @@ module Geos
9
9
  }
10
10
  }
11
11
  end
12
- alias :as_geojson :to_geojsonable
12
+ alias_method :as_geojson, :to_geojsonable
13
13
  end
14
14
  end
15
15
 
@@ -21,7 +21,7 @@ module Geos
21
21
  }
22
22
  }
23
23
  end
24
- alias :as_geojson :to_geojsonable
24
+ alias_method :as_geojson, :to_geojsonable
25
25
  end
26
26
  end
27
27
 
data/lib/geos/point.rb CHANGED
@@ -12,7 +12,7 @@ module Geos
12
12
  latitude lat north south n s
13
13
  }.each do |name|
14
14
  self.class_eval(<<-EOF, __FILE__, __LINE__ + 1)
15
- alias #{name} :y
15
+ alias_method :#{name}, :y
16
16
  EOF
17
17
  end
18
18
 
@@ -27,7 +27,7 @@ module Geos
27
27
  longitude lng east west e w
28
28
  }.each do |name|
29
29
  self.class_eval(<<-EOF, __FILE__, __LINE__ + 1)
30
- alias #{name} :x
30
+ alias_method :#{name}, :x
31
31
  EOF
32
32
  end
33
33
 
@@ -106,7 +106,7 @@ module Geos
106
106
  { :type => 'point', :lat => cs.get_y(0), :lng => cs.get_x(0) }
107
107
  end
108
108
  end
109
- alias :to_jsonable :as_json
109
+ alias_method :to_jsonable, :as_json
110
110
 
111
111
  def as_geojson(options = {})
112
112
  {
@@ -114,7 +114,7 @@ module Geos
114
114
  :coordinates => self.to_a
115
115
  }
116
116
  end
117
- alias :to_geojsonable :as_geojson
117
+ alias_method :to_geojsonable, :as_geojson
118
118
  end
119
119
  end
120
120
 
data/lib/geos/polygon.rb CHANGED
@@ -128,7 +128,7 @@ module Geos
128
128
  ret
129
129
  end
130
130
  end
131
- alias :to_jsonable :as_json
131
+ alias_method :to_jsonable, :as_json
132
132
 
133
133
  # Options:
134
134
  #
@@ -152,7 +152,7 @@ module Geos
152
152
 
153
153
  ret
154
154
  end
155
- alias :to_geojsonable :as_geojson
155
+ alias_method :to_geojsonable, :as_geojson
156
156
  end
157
157
  end
158
158
 
@@ -8,27 +8,32 @@ end
8
8
 
9
9
  require 'geos' unless defined?(Geos)
10
10
 
11
- require File.join(File.dirname(__FILE__), *%w{ geos extensions version })
12
- require File.join(File.dirname(__FILE__), *%w{ geos yaml })
13
-
14
11
  # Some custom extensions to the SWIG-based Geos Ruby extension.
15
12
  module Geos
16
13
  GEOS_EXTENSIONS_BASE = File.join(File.dirname(__FILE__))
17
- GEOS_EXTENSIONS_VERSION = Geos::Extensions::VERSION
18
14
 
19
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos geometry })
20
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos coordinate_sequence })
21
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos point })
22
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos line_string })
23
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos polygon })
24
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos geometry_collection })
25
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos multi_polygon })
26
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos multi_line_string })
27
- require File.join(GEOS_EXTENSIONS_BASE, *%w{ geos multi_point })
15
+ %w{
16
+ extensions/version
17
+ extensions/exceptions
18
+ yaml
19
+ geometry
20
+ coordinate_sequence
21
+ point
22
+ line_string
23
+ polygon
24
+ geometry_collection
25
+ multi_polygon
26
+ multi_line_string
27
+ multi_point
28
+ }.each do |file|
29
+ require File.join(GEOS_EXTENSIONS_BASE, "geos", file)
30
+ end
28
31
 
29
32
  autoload :Helper, File.join(GEOS_EXTENSIONS_BASE, *%w{ geos geos_helper })
30
33
  autoload :GoogleMaps, File.join(GEOS_EXTENSIONS_BASE, *%w{ geos google_maps })
31
34
 
35
+ GEOS_EXTENSIONS_VERSION = Geos::Extensions::VERSION
36
+
32
37
  REGEXP_FLOAT = /(-?\d*(?:\.\d+)?|-?\d*(?:\.\d+?)[eE][-+]?\d+)/
33
38
  REGEXP_LAT_LNG = /#{REGEXP_FLOAT}\s*,\s*#{REGEXP_FLOAT}/
34
39
 
@@ -183,7 +188,7 @@ module Geos
183
188
  when REGEXP_G_LAT_LNG_BOUNDS, REGEXP_G_LAT_LNG
184
189
  $~.captures
185
190
  else
186
- raise "Invalid GLatLng format"
191
+ raise Geos::Extensions::InvalidGLatLngFormatError.new
187
192
  end
188
193
 
189
194
  geom = if match_data.length > 3
@@ -231,7 +236,7 @@ module Geos
231
236
  when REGEXP_BOX2D
232
237
  $~.captures
233
238
  else
234
- raise "Invalid BOX2D"
239
+ raise Geos::Extensions::InvalidBox2DError.new
235
240
  end
236
241
 
237
242
  coords = []
@@ -8,7 +8,7 @@ rescue LoadError
8
8
  # do nothing
9
9
  end
10
10
 
11
- class GoogleMapsApi2Tests < MiniTest::Unit::TestCase
11
+ class GoogleMapsApi2Tests < Minitest::Test
12
12
  include TestHelper
13
13
 
14
14
  def initialize(*args)
@@ -8,7 +8,7 @@ rescue LoadError
8
8
  # do nothing
9
9
  end
10
10
 
11
- class GoogleMapsApi3Tests < MiniTest::Unit::TestCase
11
+ class GoogleMapsApi3Tests < Minitest::Test
12
12
  include TestHelper
13
13
 
14
14
  def initialize(*args)
@@ -130,7 +130,7 @@ class GoogleMapsApiCommonTests
130
130
  end
131
131
  end
132
132
 
133
- class Api2Tests < MiniTest::Unit::TestCase
133
+ class Api2Tests < Minitest::Test
134
134
  include Tests
135
135
 
136
136
  def setup
@@ -138,7 +138,7 @@ class GoogleMapsApiCommonTests
138
138
  end
139
139
  end
140
140
 
141
- class Api3Tests < MiniTest::Unit::TestCase
141
+ class Api3Tests < Minitest::Test
142
142
  include Tests
143
143
 
144
144
  def setup
@@ -2,7 +2,7 @@
2
2
  $: << File.dirname(__FILE__)
3
3
  require 'test_helper'
4
4
 
5
- class GoogleMapsPolylineEncoderTests < MiniTest::Unit::TestCase
5
+ class GoogleMapsPolylineEncoderTests < Minitest::Test
6
6
  include TestHelper
7
7
 
8
8
  ENCODED = '_p~iF~ps|U_ulLnnqC_mqNvxq`@'
data/test/helper_tests.rb CHANGED
@@ -3,7 +3,7 @@ $: << File.dirname(__FILE__)
3
3
  require 'test_helper'
4
4
 
5
5
  class HelperTests
6
- class ArrayWrapTests < MiniTest::Unit::TestCase
6
+ class ArrayWrapTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def test_array
data/test/misc_tests.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  $: << File.dirname(__FILE__)
3
3
  require 'test_helper'
4
4
 
5
- class GeosMiscTests < MiniTest::Unit::TestCase
5
+ class GeosMiscTests < Minitest::Test
6
6
  include TestHelper
7
7
 
8
8
  def initialize(*args)
data/test/reader_tests.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  $: << File.dirname(__FILE__)
3
3
  require 'test_helper'
4
4
 
5
- class GeosReaderTests < MiniTest::Unit::TestCase
5
+ class GeosReaderTests < Minitest::Test
6
6
  include TestHelper
7
7
 
8
8
  def test_from_wkb_bin
@@ -105,6 +105,19 @@ class GeosReaderTests < MiniTest::Unit::TestCase
105
105
  assert_equal(10.01, point.lng)
106
106
  end
107
107
 
108
+ def test_from_g_lat_lng_exceptions
109
+ assert_raises(Geos::Extensions::InvalidGLatLngFormatError) do
110
+ Geos.from_g_lat_lng('foo')
111
+ end
112
+
113
+ begin
114
+ Geos.from_g_lat_lng('foo')
115
+ rescue => e
116
+ assert_kind_of(RuntimeError, e)
117
+ assert_kind_of(Geos::ParseError, e)
118
+ end
119
+ end
120
+
108
121
  def test_from_g_lat_lng_bounds
109
122
  bounds = Geos.from_g_lat_lng(BOUNDS_G_LAT_LNG)
110
123
 
@@ -182,6 +195,19 @@ class GeosReaderTests < MiniTest::Unit::TestCase
182
195
  assert_equal('POINT (0 0)', Geos.read('BOX(0 0, 0 0)').to_wkt(:trim => true))
183
196
  end
184
197
 
198
+ def test_from_box2d_exceptions
199
+ assert_raises(Geos::Extensions::InvalidBox2DError) do
200
+ Geos.from_box2d('foo')
201
+ end
202
+
203
+ begin
204
+ Geos.from_box2d('foo')
205
+ rescue => e
206
+ assert_kind_of(RuntimeError, e)
207
+ assert_kind_of(Geos::ParseError, e)
208
+ end
209
+ end
210
+
185
211
  def test_allowed
186
212
  assert_raises(ArgumentError) do
187
213
  Geos.read(Geos.read(POINT_WKT), :allowed => [])
data/test/writer_tests.rb CHANGED
@@ -15,7 +15,7 @@ rescue LoadError
15
15
  # do nothing
16
16
  end
17
17
 
18
- class GeosWriterTests < MiniTest::Unit::TestCase
18
+ class GeosWriterTests < Minitest::Test
19
19
  include TestHelper
20
20
 
21
21
  def initialize(*args)
data/test/yaml_tests.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class YamlTests < MiniTest::Unit::TestCase
6
+ class YamlTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  # This is for 1.8 support, makes tests easier
@@ -11,20 +11,11 @@ class YamlTests < MiniTest::Unit::TestCase
11
11
  YAML::ENGINE = 'syck'
12
12
  end
13
13
 
14
- def munge_expected(expected)
15
- # Sych expects a space after the tag, psych does not
16
- if YAML::ENGINE == 'syck'
17
- expected.sub!(/\n/, " \n")
18
- else
19
- expected
20
- end
21
- end
22
-
23
14
  def test_point_wkt
24
15
  geom = Geos.read('POINT(5 7)')
25
16
  yaml = YAML.dump(geom)
26
17
 
27
- expected = munge_expected <<-EOS
18
+ expected = <<-EOS
28
19
  --- !ruby/object:Geos::Point
29
20
  geom: POINT (5.0000000000000000 7.0000000000000000)
30
21
  EOS
@@ -41,7 +32,7 @@ EOS
41
32
  geom = Geos.read('LINESTRING (0 0, 10 10)')
42
33
  yaml = YAML.dump(geom)
43
34
 
44
- expected = munge_expected <<-EOS
35
+ expected = <<-EOS
45
36
  --- !ruby/object:Geos::LineString
46
37
  geom: LINESTRING (0.0000000000000000 0.0000000000000000, 10.0000000000000000 10.0000000000000000)
47
38
  EOS
@@ -65,13 +56,13 @@ EOS
65
56
  geom = Geos.read('POLYGON ((0 0, 5 0, 5 5, 0 5, 0 0))')
66
57
  yaml = YAML.dump(geom)
67
58
 
68
- expected = if YAML::ENGINE == 'syck' || RUBY_ENGINE == 'jruby'
69
- munge_expected(<<-EOS)
59
+ expected = if RUBY_VERSION < '2.2' && (YAML::ENGINE == 'syck' || RUBY_ENGINE == 'jruby')
60
+ <<-EOS
70
61
  --- !ruby/object:Geos::Polygon
71
62
  geom: POLYGON ((0.0000000000000000 0.0000000000000000, 5.0000000000000000 0.0000000000000000, 5.0000000000000000 5.0000000000000000, 0.0000000000000000 5.0000000000000000, 0.0000000000000000 0.0000000000000000))
72
63
  EOS
73
64
  else
74
- <<-EOS
65
+ <<-EOS
75
66
  --- !ruby/object:Geos::Polygon
76
67
  geom: POLYGON ((0.0000000000000000 0.0000000000000000, 5.0000000000000000 0.0000000000000000,
77
68
  5.0000000000000000 5.0000000000000000, 0.0000000000000000 5.0000000000000000, 0.0000000000000000
@@ -92,7 +83,7 @@ EOS
92
83
  geom = Geos.read('GEOMETRYCOLLECTION (POINT(5 7))')
93
84
  yaml = YAML.dump(geom)
94
85
 
95
- expected = munge_expected <<-EOS
86
+ expected = <<-EOS
96
87
  --- !ruby/object:Geos::GeometryCollection
97
88
  geom: GEOMETRYCOLLECTION (POINT (5.0000000000000000 7.0000000000000000))
98
89
  EOS
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geos-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - J Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-geos
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.1'
27
27
  description: Extensions for the GEOS library.
28
- email: code@zoocasa.com
28
+ email: dark.panda@gmail.com
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files:
@@ -40,6 +40,7 @@ files:
40
40
  - geos-extensions.gemspec
41
41
  - lib/geos-extensions.rb
42
42
  - lib/geos/coordinate_sequence.rb
43
+ - lib/geos/extensions/exceptions.rb
43
44
  - lib/geos/extensions/version.rb
44
45
  - lib/geos/geometry.rb
45
46
  - lib/geos/geometry_collection.rb
@@ -69,7 +70,7 @@ files:
69
70
  - test/test_helper.rb
70
71
  - test/writer_tests.rb
71
72
  - test/yaml_tests.rb
72
- homepage: http://github.com/zoocasa/geos-extensions
73
+ homepage: http://github.com/dark-panda/geos-extensions
73
74
  licenses:
74
75
  - MIT
75
76
  metadata: {}
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  version: '0'
90
91
  requirements: []
91
92
  rubyforge_project:
92
- rubygems_version: 2.2.2
93
+ rubygems_version: 2.5.1
93
94
  signing_key:
94
95
  specification_version: 4
95
96
  summary: Extensions for the GEOS library.