mongoid-geospatial 5.1.0 → 7.1.0

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +81 -65
  3. data/lib/mongoid/geospatial/config/point.rb +5 -2
  4. data/lib/mongoid/geospatial/config.rb +2 -0
  5. data/lib/mongoid/geospatial/ext/rgeo_spherical_point_impl.rb +2 -0
  6. data/lib/mongoid/geospatial/fields/box.rb +2 -0
  7. data/lib/mongoid/geospatial/fields/circle.rb +2 -2
  8. data/lib/mongoid/geospatial/fields/line_string.rb +2 -0
  9. data/lib/mongoid/geospatial/fields/point.rb +28 -13
  10. data/lib/mongoid/geospatial/fields/polygon.rb +2 -0
  11. data/lib/mongoid/geospatial/geometry_field.rb +4 -2
  12. data/lib/mongoid/geospatial/helpers/delegate.rb +2 -0
  13. data/lib/mongoid/geospatial/helpers/spatial.rb +2 -0
  14. data/lib/mongoid/geospatial/helpers/sphere.rb +3 -1
  15. data/lib/mongoid/geospatial/version.rb +3 -1
  16. data/lib/mongoid/geospatial/wrappers/georuby.rb +2 -0
  17. data/lib/mongoid/geospatial/wrappers/rgeo.rb +2 -0
  18. data/lib/mongoid/geospatial.rb +234 -27
  19. metadata +7 -80
  20. data/.coveralls.yml +0 -1
  21. data/.gitignore +0 -49
  22. data/.hound.yml +0 -2
  23. data/.rspec +0 -3
  24. data/.rubocop.yml +0 -6
  25. data/.rubocop_todo.yml +0 -93
  26. data/.travis.yml +0 -33
  27. data/CHANGELOG.md +0 -19
  28. data/CONTRIBUTING.md +0 -118
  29. data/Dangerfile +0 -1
  30. data/Gemfile +0 -37
  31. data/Guardfile +0 -16
  32. data/RELEASING.md +0 -62
  33. data/Rakefile +0 -20
  34. data/bench/bench +0 -64
  35. data/mongoid-geospatial.gemspec +0 -18
  36. data/spec/models/address.rb +0 -69
  37. data/spec/models/alarm.rb +0 -12
  38. data/spec/models/bar.rb +0 -13
  39. data/spec/models/bus.rb +0 -12
  40. data/spec/models/event.rb +0 -18
  41. data/spec/models/farm.rb +0 -13
  42. data/spec/models/person.rb +0 -96
  43. data/spec/models/phone.rb +0 -8
  44. data/spec/models/place.rb +0 -13
  45. data/spec/models/river.rb +0 -22
  46. data/spec/mongoid/geospatial/config_spec.rb +0 -22
  47. data/spec/mongoid/geospatial/fields/box_spec.rb +0 -8
  48. data/spec/mongoid/geospatial/fields/circle_spec.rb +0 -8
  49. data/spec/mongoid/geospatial/fields/line_string_spec.rb +0 -79
  50. data/spec/mongoid/geospatial/fields/point_spec.rb +0 -269
  51. data/spec/mongoid/geospatial/fields/polygon_spec.rb +0 -87
  52. data/spec/mongoid/geospatial/geospatial_spec.rb +0 -150
  53. data/spec/mongoid/geospatial/helpers/core_spec.rb +0 -35
  54. data/spec/mongoid/geospatial/helpers/delegate_spec.rb +0 -67
  55. data/spec/mongoid/geospatial/helpers/spatial_spec.rb +0 -39
  56. data/spec/mongoid/geospatial/helpers/sphere_spec.rb +0 -29
  57. data/spec/mongoid/geospatial/wrappers/georuby_spec.rb +0 -63
  58. data/spec/mongoid/geospatial/wrappers/rgeo_spec.rb +0 -115
  59. data/spec/spec_helper.rb +0 -47
  60. data/spec/support/authentication.rb +0 -28
  61. data/spec/support/mongod.conf +0 -3
  62. data/spec/support/mongoid.yml +0 -19
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mongoid'
2
- # require 'active_support/core_ext/string/inflections'
3
- # require 'active_support/concern'
4
+ require 'active_support/concern' # Explicitly require for `extend ActiveSupport::Concern`
4
5
  require 'mongoid/geospatial/helpers/spatial'
5
6
  require 'mongoid/geospatial/helpers/sphere'
6
7
  require 'mongoid/geospatial/helpers/delegate'
@@ -55,7 +56,6 @@ module Mongoid
55
56
  @@earth_radius = EARTH_RADIUS.dup
56
57
 
57
58
  included do
58
- # attr_accessor :geo
59
59
  cattr_accessor :spatial_fields, :spatial_fields_indexed
60
60
  self.spatial_fields = []
61
61
  self.spatial_fields_indexed = []
@@ -72,14 +72,10 @@ module Mongoid
72
72
  # Methods applied to Document's class
73
73
  module ClassMethods
74
74
  #
75
- # Create Spatial index for given field
76
- #
75
+ # Creates a 2d spatial index for the given field.
77
76
  #
78
- # @param [String,Symbol] name
79
- # @param [Hash] options options for spatial_index
80
- #
81
- # http://www.mongodb.org/display/DOCS/Geospatial+Indexing
82
- # #GeospatialIndexing-geoNearCommand
77
+ # @param name [String, Symbol] The name of the field to index.
78
+ # @param options [Hash] Additional options for the index.
83
79
  #
84
80
  def spatial_index(name, options = {})
85
81
  spatial_fields_indexed << name
@@ -87,38 +83,249 @@ module Mongoid
87
83
  end
88
84
 
89
85
  #
90
- # Creates Sphere index for given field
91
- #
86
+ # Creates a 2dsphere index for the given field, suitable for spherical geometry calculations.
92
87
  #
93
- # @param [String,Symbol] name
94
- # @param [Hash] options options for spatial_index
88
+ # @param name [String, Symbol] The name of the field to index.
89
+ # @param options [Hash] Additional options for the index.
95
90
  #
96
- # http://www.mongodb.org/display/DOCS/Geospatial+Indexing
97
- # #GeospatialIndexing-geoNearCommand
98
- def sphere_index(name, options = {})
91
+ def spherical_index(name, options = {})
99
92
  spatial_fields_indexed << name
100
93
  index({ name => '2dsphere' }, options)
101
94
  end
102
95
 
103
96
  #
104
- # Creates Sphere index for given field
97
+ # # Queries
98
+ #
99
+ # MongoDB provides the following geospatial query operators.
100
+ #
101
+ # $geoIntersects
102
+ # Selects geometries that intersect with a GeoJSON geometry.
103
+ # The 2dsphere index supports $geoIntersects.
104
+ #
105
+ # $geoWithin
106
+ # Selects geometries within a bounding GeoJSON geometry.
107
+ # The 2dsphere and 2d indexes support $geoWithin.
108
+ #
109
+ # $near
110
+ # Returns geospatial objects in proximity to a point.
111
+ # Requires a geospatial index. The 2dsphere and 2d indexes support $near.
112
+ #
113
+ # $nearSphere
114
+ # Returns geospatial objects in proximity to a point on a sphere.
115
+ # Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere.
116
+ #
117
+ # # Aggregation
118
+ #
119
+ # MongoDB provides the following geospatial aggregation pipeline stage:
120
+ #
121
+ # $geoNear
122
+ # Returns an ordered stream of documents based on the proximity to a geospatial point.
123
+ # Incorporates the functionality of $match, $sort, and $limit for geospatial data.
124
+ # The output documents include an additional distance field and can include a location identifier field.
125
+ # $geoNear requires a geospatial index.
126
+ #
127
+
128
+ #
129
+ # Defines a class method to find the closest document to a given point
130
+ # using the specified spatial field via the `geoNear` command.
131
+ #
132
+ # @param field_name [String, Symbol] The name of the spatial field to query.
133
+ # @param default_geo_near_options [Hash] Default options for the geoNear command
134
+ # (e.g., `{ spherical: true, max_distance: 1000 }`).
135
+ # The `key` option will be automatically set to `field_name`.
105
136
  #
137
+ # Example:
138
+ # class Place
139
+ # include Mongoid::Document
140
+ # include Mongoid::Geospatial
141
+ # field :location, type: Array
142
+ # spherical_index :location # Assumes a 2dsphere index for spherical queries
143
+ # spatial_scope :location, spherical: true # Default to spherical for this scope
144
+ # end
106
145
  #
107
- # @param [String,Symbol] name
108
- # @param [Hash] options options for spatial_index
146
+ # Place.closest_to_location([lon, lat]) # Finds the single closest place
147
+ # Place.closest_to_location([lon, lat], max_distance: 500) # Override/add options
109
148
  #
110
- # http://www.mongodb.org/display/DOCS/Geospatial+Indexing
111
- # #GeospatialIndexing-geoNearCommand
112
- def spatial_scope(field, _opts = {})
149
+ def spatial_scope(field_name, default_geo_near_options = {})
150
+ method_name = :"closest_to_#{field_name}"
151
+ field_name_sym = field_name.to_sym
152
+ # key_name = field_name.to_s # Original geoNear used 'key' for field name
153
+
113
154
  singleton_class.class_eval do
114
- # define_method(:close) do |args|
115
- define_method(:nearby) do |args|
116
- queryable.where(field.near_sphere => args)
155
+ define_method(method_name) do |coordinates, additional_options = {}|
156
+ # `coordinates` should be [lon, lat] or a GeoJSON Point hash
157
+ # `self` here is the class (e.g., Bar)
158
+
159
+ merged_options = default_geo_near_options.merge(additional_options)
160
+
161
+ # Determine if spherical based on options or field definition
162
+ is_spherical = if merged_options.key?(:spherical)
163
+ merged_options[:spherical]
164
+ else
165
+ # self.fields uses string keys for field names
166
+ field_def = fields[field_name.to_s]
167
+ field_def && field_def.options[:sphere]
168
+ end
169
+ query_operator = is_spherical ? :near_sphere : :near
170
+
171
+ # Prepare the value for the geospatial operator
172
+ # Mongoid::Geospatial::Point.mongoize ensures coordinates are in [lng, lat] array format
173
+ # from various input types (Point object, array, string, hash).
174
+ mongoized_coords = Mongoid::Geospatial::Point.mongoize(coordinates)
175
+
176
+ geo_query_value = if merged_options[:max_distance]
177
+ {
178
+ # Using $geometry for clarity when $maxDistance is used,
179
+ # which is standard for $near/$nearSphere operators.
180
+ '$geometry' => { type: 'Point', coordinates: mongoized_coords },
181
+ '$maxDistance' => merged_options[:max_distance].to_f
182
+ }
183
+ else
184
+ mongoized_coords # Simple array [lng, lat] for the operator
185
+ end
186
+
187
+ # Start with a base criteria, applying an optional filter query
188
+ current_criteria = merged_options[:query] ? where(merged_options[:query]) : all
189
+
190
+ # Apply the geospatial query. $near and $nearSphere queries return sorted results.
191
+ current_criteria.where(field_name_sym.send(query_operator) => geo_query_value)
117
192
  end
118
193
  end
119
194
  end
195
+
196
+ #
197
+ # Provides a convenient way to find documents near a given set of coordinates.
198
+ # It automatically uses the first spatial field defined in the model and
199
+ # determines whether to use a planar (.near) or spherical (.near_sphere)
200
+ # query based on the field's definition options (`spatial: true` vs `sphere: true`).
201
+ #
202
+ # @param coordinates [Array, Mongoid::Geospatial::Point] The coordinates (e.g., [lon, lat])
203
+ # or a Point object to find documents near to.
204
+ # @param _options [Hash] Optional hash for future extensions (currently unused).
205
+ #
206
+ # @return [Mongoid::Criteria] A criteria object for the query.
207
+ #
208
+ # Example:
209
+ # Bar.nearby([10, 20])
210
+ # Alarm.nearby(my_point_object)
211
+ #
212
+ def nearby(coordinates, _options = {})
213
+ if spatial_fields.empty?
214
+ raise "No spatial fields defined for #{name} to use with .nearby. " \
215
+ "Mark a field with 'spatial: true' or 'sphere: true'."
216
+ end
217
+
218
+ field_name_sym = spatial_fields.first.to_sym
219
+ field_definition = fields[field_name_sym.to_s]
220
+
221
+ raise "Could not find field definition for spatial field: #{field_name_sym}" unless field_definition
222
+
223
+ query_operator = field_definition.options[:sphere] ? :near_sphere : :near
224
+
225
+ criteria.where(field_name_sym.send(query_operator) => coordinates)
226
+ end
227
+
228
+ # Performs a $geoNear aggregation pipeline stage to find documents near a point,
229
+ # returning them sorted by distance and including the distance.
230
+ #
231
+ # This method is a wrapper around the MongoDB `$geoNear` aggregation stage,
232
+ # which allows for more complex queries and options than the simple `near` or `near_sphere` methods.
233
+ #
234
+ # * But it's not chainable like a standard Mongoid query *
235
+ #
236
+ # @param field_name [String, Symbol] The name of the geospatial field to query.
237
+ # This field must be indexed with a geospatial index (2d or 2dsphere).
238
+ # @param coordinates [Array, Hash, Mongoid::Geospatial::Point] The point to search near.
239
+ # Examples: `[lng, lat]`, `{ type: 'Point', coordinates: [lng, lat] }`, a `Mongoid::Geospatial::Point` object.
240
+ # @param options [Hash] Options for the $geoNear stage.
241
+ # Key options include:
242
+ # - `:spherical` [Boolean] If true, calculates distances using spherical geometry. Defaults to `false`.
243
+ # - `:distanceField` [String] Name of the output field that will contain the distance. Defaults to `'distance'`.
244
+ # - `:maxDistance` [Numeric] The maximum distance from the center point that documents can be.
245
+ # For spherical queries, specify distance in meters. For 2d queries, in the same units as coordinates.
246
+ # - `:minDistance` [Numeric] The minimum distance. (MongoDB 2.6+)
247
+ # - `:query` [Hash] Limits the results to the documents that match the query.
248
+ # - `:limit` [Integer] The maximum number of documents to return (applied as a separate `$limit` pipeline stage).
249
+ # - `:distanceMultiplier` [Numeric] A factor to multiply all distances returned by the query.
250
+ # - `:includeLocs` [String] Specifies the name of the output field that identifies the location used to calculate the distance.
251
+ # This is useful when the queried field contains multiple locations (e.g., an array of points) or complex GeoJSON
252
+ # geometries (e.g., a Polygon), as it shows which specific point was used for the distance calculation.
253
+ # Example: `includeLocs: 'matchedPoint'` would add a `matchedPoint` field to each output document.
254
+ #
255
+ # @return [Array<Mongoid::Document>] An array of instantiated Mongoid documents.
256
+ # Each document will include its original fields plus any fields added by the `$geoNear` stage,
257
+ # such as the field specified by `:distanceField` (e.g., `document.distance`) and `:includeLocs`.
258
+ # These additional fields are accessible as dynamic attributes on the model instances.
259
+ #
260
+ # @raise [ArgumentError] If coordinates cannot be mongoized.
261
+ #
262
+ # Example:
263
+ # # Find places near [10, 20], using spherical calculations, up to 5km away
264
+ # Place.geo_near(:location, [10, 20],
265
+ # spherical: true,
266
+ # maxDistance: 5000, # 5 kilometers in meters
267
+ # distanceField: 'dist.calculated',
268
+ # query: { category: 'restaurant' },
269
+ # limit: 10)
270
+ #
271
+ # # Iterate over results
272
+ # Place.geo_near(:location, [10, 20], spherical: true).each do |place|
273
+ # puts "#{place.name} is #{place.distance} meters away." # Assumes distanceField is 'distance'
274
+ # end
275
+ #
276
+ def geo_near(field_name, coordinates, options = {})
277
+ mongoized_coords = Mongoid::Geospatial::Point.mongoize(coordinates)
278
+
279
+ raise ArgumentError, "Invalid coordinates provided: #{coordinates.inspect}" unless mongoized_coords
280
+
281
+ # User-provided options. Work with a copy.
282
+ user_options = options.dup
283
+ limit_value = user_options.delete(:limit) # Handled by a separate pipeline stage
284
+
285
+ # Core $geoNear parameters derived from method arguments, these are not overrideable by user_options.
286
+ geo_near_core_params = {
287
+ key: field_name.to_s,
288
+ near: mongoized_coords
289
+ }
290
+
291
+ # Defaultable $geoNear parameters. User options will override these.
292
+ geo_near_defaultable_params = {
293
+ distanceField: 'distance',
294
+ spherical: false # Default to planar (2d) calculations
295
+ }
296
+
297
+ # Merge user options over defaults, then ensure core parameters are set.
298
+ geo_near_stage_options = geo_near_defaultable_params.merge(user_options).merge(geo_near_core_params)
299
+
300
+ # Ensure :spherical is a strict boolean (true/false).
301
+ # If user_options provided :spherical, it's already set. If not, the default is used.
302
+ # This line ensures the final value is strictly true or false, not just truthy/falsy.
303
+ geo_near_stage_options[:spherical] = !geo_near_stage_options[:spherical].nil?
304
+
305
+ # Note on performance:
306
+ # $geoNear is an aggregation pipeline stage. For simple proximity queries,
307
+ # it might exhibit slightly higher "real" time (wall-clock time) in benchmarks
308
+ # compared to direct query operators like $near or $nearSphere. This is often
309
+ # due to the inherent overhead of the aggregation framework versus a direct query.
310
+ # However, $geoNear offers more capabilities, such as returning the distance
311
+ # (distanceField), distanceMultiplier, includeLocs, and integrating with other
312
+ # aggregation stages, which are not available with $near/$nearSphere.
313
+ pipeline = [{ '$geoNear' => geo_near_stage_options }]
314
+
315
+ # Add $limit stage if limit_value was provided
316
+ pipeline << { '$limit' => limit_value.to_i } if limit_value
317
+
318
+ # Execute the aggregation pipeline
319
+ collection.aggregate(pipeline)
320
+
321
+ # Don't instantiate results here.
322
+ # aggregated_results = collection.aggregate(pipeline)
323
+ # Map the raw Hash results from aggregation to Mongoid model instances.
324
+ # Mongoid's #instantiate method correctly handles creating model objects
325
+ # and assigning attributes, including dynamic ones like the distanceField.
326
+ # aggregated_results.map { |attrs| instantiate(attrs) }
327
+ end
120
328
  end
121
329
  end
122
330
  end
123
-
124
331
  require 'mongoid/geospatial/config'
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-geospatial
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ong
8
8
  - Marcos Piccinini
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2018-11-09 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: mongoid
@@ -33,23 +32,8 @@ executables: []
33
32
  extensions: []
34
33
  extra_rdoc_files: []
35
34
  files:
36
- - ".coveralls.yml"
37
- - ".gitignore"
38
- - ".hound.yml"
39
- - ".rspec"
40
- - ".rubocop.yml"
41
- - ".rubocop_todo.yml"
42
- - ".travis.yml"
43
- - CHANGELOG.md
44
- - CONTRIBUTING.md
45
- - Dangerfile
46
- - Gemfile
47
- - Guardfile
48
35
  - MIT-LICENSE
49
36
  - README.md
50
- - RELEASING.md
51
- - Rakefile
52
- - bench/bench
53
37
  - lib/mongoid/geospatial.rb
54
38
  - lib/mongoid/geospatial/config.rb
55
39
  - lib/mongoid/geospatial/config/point.rb
@@ -66,39 +50,11 @@ files:
66
50
  - lib/mongoid/geospatial/version.rb
67
51
  - lib/mongoid/geospatial/wrappers/georuby.rb
68
52
  - lib/mongoid/geospatial/wrappers/rgeo.rb
69
- - mongoid-geospatial.gemspec
70
- - spec/models/address.rb
71
- - spec/models/alarm.rb
72
- - spec/models/bar.rb
73
- - spec/models/bus.rb
74
- - spec/models/event.rb
75
- - spec/models/farm.rb
76
- - spec/models/person.rb
77
- - spec/models/phone.rb
78
- - spec/models/place.rb
79
- - spec/models/river.rb
80
- - spec/mongoid/geospatial/config_spec.rb
81
- - spec/mongoid/geospatial/fields/box_spec.rb
82
- - spec/mongoid/geospatial/fields/circle_spec.rb
83
- - spec/mongoid/geospatial/fields/line_string_spec.rb
84
- - spec/mongoid/geospatial/fields/point_spec.rb
85
- - spec/mongoid/geospatial/fields/polygon_spec.rb
86
- - spec/mongoid/geospatial/geospatial_spec.rb
87
- - spec/mongoid/geospatial/helpers/core_spec.rb
88
- - spec/mongoid/geospatial/helpers/delegate_spec.rb
89
- - spec/mongoid/geospatial/helpers/spatial_spec.rb
90
- - spec/mongoid/geospatial/helpers/sphere_spec.rb
91
- - spec/mongoid/geospatial/wrappers/georuby_spec.rb
92
- - spec/mongoid/geospatial/wrappers/rgeo_spec.rb
93
- - spec/spec_helper.rb
94
- - spec/support/authentication.rb
95
- - spec/support/mongod.conf
96
- - spec/support/mongoid.yml
97
53
  homepage: https://github.com/mongoid/mongoid-geospatial
98
54
  licenses:
99
55
  - MIT
100
- metadata: {}
101
- post_install_message:
56
+ metadata:
57
+ rubygems_mfa_required: 'true'
102
58
  rdoc_options: []
103
59
  require_paths:
104
60
  - lib
@@ -106,43 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
62
  requirements:
107
63
  - - ">="
108
64
  - !ruby/object:Gem::Version
109
- version: '0'
65
+ version: 3.1.0
110
66
  required_rubygems_version: !ruby/object:Gem::Requirement
111
67
  requirements:
112
68
  - - ">="
113
69
  - !ruby/object:Gem::Version
114
70
  version: '0'
115
71
  requirements: []
116
- rubyforge_project:
117
- rubygems_version: 2.7.6
118
- signing_key:
72
+ rubygems_version: 3.6.7
119
73
  specification_version: 4
120
74
  summary: Mongoid Extension that simplifies MongoDB Geospatial Operations.
121
- test_files:
122
- - spec/models/address.rb
123
- - spec/models/alarm.rb
124
- - spec/models/bar.rb
125
- - spec/models/bus.rb
126
- - spec/models/event.rb
127
- - spec/models/farm.rb
128
- - spec/models/person.rb
129
- - spec/models/phone.rb
130
- - spec/models/place.rb
131
- - spec/models/river.rb
132
- - spec/mongoid/geospatial/config_spec.rb
133
- - spec/mongoid/geospatial/fields/box_spec.rb
134
- - spec/mongoid/geospatial/fields/circle_spec.rb
135
- - spec/mongoid/geospatial/fields/line_string_spec.rb
136
- - spec/mongoid/geospatial/fields/point_spec.rb
137
- - spec/mongoid/geospatial/fields/polygon_spec.rb
138
- - spec/mongoid/geospatial/geospatial_spec.rb
139
- - spec/mongoid/geospatial/helpers/core_spec.rb
140
- - spec/mongoid/geospatial/helpers/delegate_spec.rb
141
- - spec/mongoid/geospatial/helpers/spatial_spec.rb
142
- - spec/mongoid/geospatial/helpers/sphere_spec.rb
143
- - spec/mongoid/geospatial/wrappers/georuby_spec.rb
144
- - spec/mongoid/geospatial/wrappers/rgeo_spec.rb
145
- - spec/spec_helper.rb
146
- - spec/support/authentication.rb
147
- - spec/support/mongod.conf
148
- - spec/support/mongoid.yml
75
+ test_files: []
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/.gitignore DELETED
@@ -1,49 +0,0 @@
1
- Gemfile.lock
2
- # rcov generated
3
- coverage
4
-
5
- # rdoc generated
6
- rdoc
7
-
8
- # yard generated
9
- doc
10
- .yardoc
11
-
12
- # bundler
13
- .bundle
14
-
15
- # jeweler generated
16
- pkg
17
-
18
- # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
19
- #
20
- # * Create a file at ~/.gitignore
21
- # * Include files you want ignored
22
- # * Run: git config --global core.excludesfile ~/.gitignore
23
- #
24
- # After doing this, these files will be ignored in all your git projects,
25
- # saving you from having to 'pollute' every project you touch with them
26
- #
27
- # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
28
- #
29
- # For MacOS:
30
- #
31
- .DS_Store
32
-
33
- # For TextMate
34
- #*.tmproj
35
- #tmtags
36
-
37
- # For emacs:
38
- #*~
39
- #\#*
40
- #.\#*
41
-
42
- # For vim:
43
- *.swp
44
-
45
- # For redcar:
46
- #.redcar
47
-
48
- # For rubinius:
49
- #*.rbc
data/.hound.yml DELETED
@@ -1,2 +0,0 @@
1
- ruby:
2
- enabled: true
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --tty
2
- --color
3
- --format documentation
data/.rubocop.yml DELETED
@@ -1,6 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - vendor/**/*
4
- - bin/**/*
5
-
6
- inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml DELETED
@@ -1,93 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2018-11-09 16:09:41 -0500 using RuboCop version 0.60.0.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 4
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
12
- Bundler/DuplicatedGem:
13
- Exclude:
14
- - 'Gemfile'
15
-
16
- # Offense count: 2
17
- Lint/DuplicateMethods:
18
- Exclude:
19
- - 'lib/mongoid/geospatial/fields/circle.rb'
20
-
21
- # Offense count: 3
22
- Metrics/AbcSize:
23
- Max: 22
24
-
25
- # Offense count: 21
26
- # Configuration parameters: CountComments, ExcludedMethods.
27
- # ExcludedMethods: refine
28
- Metrics/BlockLength:
29
- Max: 216
30
-
31
- # Offense count: 1
32
- Metrics/CyclomaticComplexity:
33
- Max: 7
34
-
35
- # Offense count: 1
36
- # Configuration parameters: CountComments, ExcludedMethods.
37
- Metrics/MethodLength:
38
- Max: 11
39
-
40
- # Offense count: 1
41
- Naming/AccessorMethodName:
42
- Exclude:
43
- - 'spec/models/address.rb'
44
-
45
- # Offense count: 9
46
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
47
- # AllowedNames: io, id, to, by, on, in, at, ip, db
48
- Naming/UncommunicativeMethodParamName:
49
- Exclude:
50
- - 'lib/mongoid/geospatial/fields/point.rb'
51
- - 'lib/mongoid/geospatial/geometry_field.rb'
52
-
53
- # Offense count: 3
54
- Style/ClassVars:
55
- Exclude:
56
- - 'lib/mongoid/geospatial.rb'
57
-
58
- # Offense count: 4
59
- Style/CommentedKeyword:
60
- Exclude:
61
- - 'lib/mongoid/geospatial/fields/point.rb'
62
-
63
- # Offense count: 6
64
- Style/Documentation:
65
- Exclude:
66
- - 'spec/**/*'
67
- - 'test/**/*'
68
- - 'bench/bench'
69
- - 'lib/mongoid/geospatial/config.rb'
70
- - 'lib/mongoid/geospatial/config/point.rb'
71
-
72
- # Offense count: 2
73
- # Cop supports --auto-correct.
74
- # Configuration parameters: EnforcedStyle.
75
- # SupportedStyles: module_function, extend_self
76
- Style/ModuleFunction:
77
- Exclude:
78
- - 'lib/mongoid/geospatial/config.rb'
79
- - 'lib/mongoid/geospatial/config/point.rb'
80
-
81
- # Offense count: 4
82
- # Cop supports --auto-correct.
83
- # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
84
- # SupportedStyles: slashes, percent_r, mixed
85
- Style/RegexpLiteral:
86
- Exclude:
87
- - 'Guardfile'
88
-
89
- # Offense count: 15
90
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
91
- # URISchemes: http, https
92
- Metrics/LineLength:
93
- Max: 113
data/.travis.yml DELETED
@@ -1,33 +0,0 @@
1
- sudo: false
2
-
3
- language: ruby
4
-
5
- cache: bundler
6
-
7
- services: mongodb
8
-
9
- rvm:
10
- - 2.5.3
11
-
12
- before_install:
13
- - gem update bundler
14
-
15
- before_script:
16
- - bundle exec danger
17
-
18
- addons:
19
- apt:
20
- sources:
21
- - mongodb-3.2-precise
22
- packages:
23
- - mongodb-org-server
24
-
25
- env:
26
- - MONGOID_VERSION=5
27
- - MONGOID_VERSION=6
28
- - MONGOID_VERSION=7
29
- - MONGOID_VERSION=HEAD
30
-
31
- matrix:
32
- allow_failures:
33
- - env: MONGOID_VERSION=HEAD
data/CHANGELOG.md DELETED
@@ -1,19 +0,0 @@
1
- ## 5.1.0 (2018/11/09)
2
-
3
- * [#61](https://github.com/mongoid/mongoid-geospatial/pull/64): Add global configuration for switching between LngLat and LatLng - [@dblock](https://github.com/dblock).
4
- * [#59](https://github.com/mongoid/mongoid-geospatial/pull/59), [#65](https://github.com/mongoid/mongoid-geospatial/pull/65): Test against Mongoid 5, 6 and 7 - [@dblock](https://github.com/dblock).
5
- * [#52](https://github.com/mongoid/mongoid-geospatial/pull/52), [#70](https://github.com/mongoid/mongoid-geospatial/pull/70): Added Danger and Rubocop, PR and code linters - [@dblock](https://github.com/dblock).
6
-
7
- ## 5.0.0 (2015/07/23)
8
-
9
- * Mongoid 5 support - [@nofxx](https://github.com/nofxx).
10
-
11
- ## 4.0.1 (2015/03/04)
12
-
13
- ## 4.0.0 (2015/01/11)
14
-
15
- * Mongoid 4 support - [@nofxx](https://github.com/nofxx).
16
-
17
- ## 3.9.0 (2014/12/22)
18
-
19
- * Initial public release - [@nofxx](https://github.com/nofxx).