mongoid-geospatial 7.0.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +61 -30
  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 +18 -15
  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 +2 -0
  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 +144 -12
  19. metadata +5 -75
  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 -8
  25. data/.travis.yml +0 -33
  26. data/CHANGELOG.md +0 -23
  27. data/CONTRIBUTING.md +0 -118
  28. data/Gemfile +0 -17
  29. data/Guardfile +0 -16
  30. data/RELEASING.md +0 -62
  31. data/Rakefile +0 -20
  32. data/mongoid-geospatial.gemspec +0 -18
  33. data/spec/bench +0 -64
  34. data/spec/models/address.rb +0 -69
  35. data/spec/models/alarm.rb +0 -12
  36. data/spec/models/bar.rb +0 -14
  37. data/spec/models/bus.rb +0 -12
  38. data/spec/models/event.rb +0 -18
  39. data/spec/models/farm.rb +0 -13
  40. data/spec/models/person.rb +0 -91
  41. data/spec/models/phone.rb +0 -8
  42. data/spec/models/place.rb +0 -13
  43. data/spec/models/river.rb +0 -22
  44. data/spec/mongoid/geospatial/config_spec.rb +0 -22
  45. data/spec/mongoid/geospatial/fields/box_spec.rb +0 -8
  46. data/spec/mongoid/geospatial/fields/circle_spec.rb +0 -8
  47. data/spec/mongoid/geospatial/fields/line_string_spec.rb +0 -78
  48. data/spec/mongoid/geospatial/fields/point_spec.rb +0 -296
  49. data/spec/mongoid/geospatial/fields/polygon_spec.rb +0 -87
  50. data/spec/mongoid/geospatial/geospatial_spec.rb +0 -222
  51. data/spec/mongoid/geospatial/helpers/core_spec.rb +0 -35
  52. data/spec/mongoid/geospatial/helpers/delegate_spec.rb +0 -67
  53. data/spec/mongoid/geospatial/helpers/spatial_spec.rb +0 -40
  54. data/spec/mongoid/geospatial/helpers/sphere_spec.rb +0 -31
  55. data/spec/mongoid/geospatial/wrappers/georuby_spec.rb +0 -63
  56. data/spec/mongoid/geospatial/wrappers/rgeo_spec.rb +0 -115
  57. data/spec/mongoid.yml +0 -298
  58. data/spec/spec_helper.rb +0 -42
  59. data/spec/support/authentication.rb +0 -28
  60. data/spec/support/mongod.conf +0 -3
  61. data/spec/support/mongoid.yml +0 -19
data/spec/mongoid.yml DELETED
@@ -1,298 +0,0 @@
1
- development:
2
- # Configure available database clients. (required)
3
- clients:
4
- # Defines the default client. (required)
5
- default:
6
- # Mongoid can connect to a URI accepted by the driver:
7
- # uri: mongodb://user:password@mongodb.domain.com:27017/queroir_development
8
-
9
- # Otherwise define the parameters separately.
10
- # This defines the name of the default database that Mongoid can connect to.
11
- # (required).
12
- database: mongoid_geospatial_dev
13
- # Provides the hosts the default client can connect to. Must be an array
14
- # of host:port pairs. (required)
15
- hosts:
16
- - localhost:28017
17
- options:
18
- # Note that all options listed below are Ruby driver client options (the mongo gem).
19
- # Please refer to the driver documentation of the version of the mongo gem you are using
20
- # for the most up-to-date list of options.
21
-
22
- # Change the default write concern. (default = { w: 1 })
23
- # write:
24
- # w: 1
25
-
26
- # Change the default read preference. Valid options for mode are: :secondary,
27
- # :secondary_preferred, :primary, :primary_preferred, :nearest
28
- # (default: primary)
29
- # read:
30
- # mode: :secondary_preferred
31
- # tag_sets:
32
- # - use: web
33
-
34
- # The name of the user for authentication.
35
- # user: 'user'
36
-
37
- # The password of the user for authentication.
38
- # password: 'password'
39
-
40
- # The user's database roles.
41
- # roles:
42
- # - 'dbOwner'
43
-
44
- # Change the default authentication mechanism. Valid options include:
45
- # :scram, :scram256, :mongodb_cr, :mongodb_x509, :gssapi, :aws, :plain.
46
- # MongoDB Server defaults to :scram, which will use "SCRAM-SHA-256" if available,
47
- # otherwise fallback to "SCRAM-SHA-1" (:scram256 will always use "SCRAM-SHA-256".)
48
- # This setting is handled by the MongoDB Ruby Driver. Please refer to:
49
- # https://mongodb.com/docs/ruby-driver/current/reference/authentication/
50
- # auth_mech: :scram
51
-
52
- # The database or source to authenticate the user against.
53
- # (default: the database specified above or admin)
54
- # auth_source: admin
55
-
56
- # Force the driver cluster to behave in a certain manner instead of auto-discovering.
57
- # Can be one of: :direct, :replica_set, :sharded. Set to :direct
58
- # when connecting to hidden members of a replica set.
59
- # connect: :direct
60
-
61
- # Changes the default time in seconds the server monitors refresh their status
62
- # via hello commands. (default: 10)
63
- # heartbeat_frequency: 10
64
-
65
- # The time in seconds for selecting servers for a near read preference. (default: 0.015)
66
- # local_threshold: 0.015
67
-
68
- # The timeout in seconds for selecting a server for an operation. (default: 30)
69
- # server_selection_timeout: 30
70
-
71
- # The maximum number of connections in the connection pool. (default: 5)
72
- # max_pool_size: 5
73
-
74
- # The minimum number of connections in the connection pool. (default: 1)
75
- # min_pool_size: 1
76
-
77
- # The time to wait, in seconds, in the connection pool for a connection
78
- # to be checked in before timing out. (default: 5)
79
- # wait_queue_timeout: 5
80
-
81
- # The time to wait to establish a connection before timing out, in seconds.
82
- # (default: 10)
83
- # connect_timeout: 10
84
-
85
- # How long to wait for a response for each operation sent to the
86
- # server. This timeout should be set to a value larger than the
87
- # processing time for the longest operation that will be executed
88
- # by the application. Note that this is a client-side timeout;
89
- # the server may continue executing an operation after the client
90
- # aborts it with the SocketTimeout exception.
91
- # (default: nil, meaning no timeout)
92
- # socket_timeout: 5
93
-
94
- # The name of the replica set to connect to. Servers provided as seeds that do
95
- # not belong to this replica set will be ignored.
96
- # replica_set: name
97
-
98
- # Compressors to use for wire protocol compression. (default is to not use compression)
99
- # "zstd" requires zstd-ruby gem. "snappy" requires snappy gem.
100
- # Refer to: https://www.mongodb.com/docs/ruby-driver/current/reference/create-client/#compression
101
- # compressors: ["zstd", "snappy", "zlib"]
102
-
103
- # Whether to connect to the servers via ssl. (default: false)
104
- # ssl: true
105
-
106
- # The certificate file used to identify the connection against MongoDB.
107
- # ssl_cert: /path/to/my.cert
108
-
109
- # The private keyfile used to identify the connection against MongoDB.
110
- # Note that even if the key is stored in the same file as the certificate,
111
- # both need to be explicitly specified.
112
- # ssl_key: /path/to/my.key
113
-
114
- # A passphrase for the private key.
115
- # ssl_key_pass_phrase: password
116
-
117
- # Whether to do peer certification validation. (default: true)
118
- # ssl_verify: true
119
-
120
- # The file containing concatenated certificate authority certificates
121
- # used to validate certs passed from the other end of the connection.
122
- # ssl_ca_cert: /path/to/ca.cert
123
-
124
- # Whether to truncate long log lines. (default: true)
125
- # truncate_logs: true
126
-
127
- # Configure Mongoid-specific options. (optional)
128
- options:
129
- # Allow BSON::Decimal128 to be parsed and returned directly in
130
- # field values. When BSON 5 is present and the this option is set to false
131
- # (the default), BSON::Decimal128 values in the database will be returned
132
- # as BigDecimal.
133
- #
134
- # @note this option only has effect when BSON 5+ is present. Otherwise,
135
- # the setting is ignored.
136
- # allow_bson5_decimal128: false
137
-
138
- # When this flag is false, named scopes cannot unset a default scope.
139
- # This is the traditional (and default) behavior in Mongoid 9 and earlier.
140
- #
141
- # Setting this flag to true will allow named scopes to unset the default
142
- # scope. This will be the default in Mongoid 10.
143
- #
144
- # See https://jira.mongodb.org/browse/MONGOID-5785 for more details.
145
- # allow_scopes_to_unset_default_scope: false
146
-
147
- # Application name that is printed to the MongoDB logs upon establishing
148
- # a connection. Note that the name cannot exceed 128 bytes in length.
149
- # It is also used as the database name if the database name is not
150
- # explicitly defined.
151
- app_name: mongoid_geospatial
152
-
153
- # When this flag is false, callbacks for embedded documents will not be
154
- # called. This is the default in 9.0.
155
- #
156
- # Setting this flag to true restores the pre-9.0 behavior, where callbacks
157
- # for embedded documents are called. This may lead to stack overflow errors
158
- # if there are more than cicrca 1000 embedded documents in the root
159
- # document's dependencies graph.
160
- # See https://jira.mongodb.org/browse/MONGOID-5658 for more details.
161
- # around_callbacks_for_embeds: false
162
-
163
- # Sets the async_query_executor for the application. By default the thread pool executor
164
- # is set to `:immediate. Options are:
165
- #
166
- # - :immediate - Initializes a single +Concurrent::ImmediateExecutor+
167
- # - :global_thread_pool - Initializes a single +Concurrent::ThreadPoolExecutor+
168
- # that uses the +async_query_concurrency+ for the +max_threads+ value.
169
- # async_query_executor: :immediate
170
-
171
- # Mark belongs_to associations as required by default, so that saving a
172
- # model with a missing belongs_to association will trigger a validation
173
- # error.
174
- # belongs_to_required_by_default: true
175
-
176
- # Set the global discriminator key.
177
- # discriminator_key: "_type"
178
-
179
- # Raise an exception when a field is redefined.
180
- # duplicate_fields_exception: false
181
-
182
- # Defines how many asynchronous queries can be executed concurrently.
183
- # This option should be set only if `async_query_executor` is set
184
- # to `:global_thread_pool`.
185
- # global_executor_concurrency: nil
186
-
187
- # When this flag is true, any attempt to change the _id of a persisted
188
- # document will raise an exception (`Errors::ImmutableAttribute`).
189
- # This is the default in 9.0. Setting this flag to false restores the
190
- # pre-9.0 behavior, where changing the _id of a persisted
191
- # document might be ignored, or it might work, depending on the situation.
192
- # immutable_ids: true
193
-
194
- # Include the root model name in json serialization.
195
- # include_root_in_json: false
196
-
197
- # # Include the _type field in serialization.
198
- # include_type_for_serialization: false
199
-
200
- # Whether to join nested persistence contexts for atomic operations
201
- # to parent contexts by default.
202
- # join_contexts: false
203
-
204
- # When this flag is false (the default as of Mongoid 9.0), a document that
205
- # is created or loaded will remember the storage options that were active
206
- # when it was loaded, and will use those same options by default when
207
- # saving or reloading itself.
208
- #
209
- # When this flag is true you'll get pre-9.0 behavior, where a document will
210
- # not remember the storage options from when it was loaded/created, and
211
- # subsequent updates will need to explicitly set up those options each time.
212
- #
213
- # For example:
214
- #
215
- # record = Model.with(collection: 'other_collection') { Model.first }
216
- #
217
- # This will try to load the first document from 'other_collection' and
218
- # instantiate it as a Model instance. Pre-9.0, the record object would
219
- # not remember that it came from 'other_collection', and attempts to
220
- # update it or reload it would fail unless you first remembered to
221
- # explicitly specify the collection every time.
222
- #
223
- # As of Mongoid 9.0, the record will remember that it came from
224
- # 'other_collection', and updates and reloads will automatically default
225
- # to that collection, for that record object.
226
- # legacy_persistence_context_behavior: false
227
-
228
- # When this flag is false, a document will become read-only only once the
229
- # #readonly! method is called, and an error will be raised on attempting
230
- # to save or update such documents, instead of just on delete. When this
231
- # flag is true, a document is only read-only if it has been projected
232
- # using #only or #without, and read-only documents will not be
233
- # deletable/destroyable, but they will be savable/updatable.
234
- # When this feature flag is turned on, the read-only state will be reset on
235
- # reload, but when it is turned off, it won't be.
236
- # legacy_readonly: false
237
-
238
- # The log level.
239
- #
240
- # It must be set prior to referencing clients or Mongo.logger,
241
- # changes to this option are not be propagated to any clients and
242
- # loggers that already exist.
243
- #
244
- # Additionally, only when the clients are configured via the
245
- # configuration file is the log level given by this option honored.
246
- # log_level: :info
247
-
248
- # Store BigDecimals as Decimal128s instead of strings in the db.
249
- # map_big_decimal_to_decimal128: true
250
-
251
- # Preload all models in development, needed when models use inheritance.
252
- # preload_models: false
253
-
254
- # When this flag is true, callbacks for every embedded document will be
255
- # called only once, even if the embedded document is embedded in multiple
256
- # documents in the root document's dependencies graph.
257
- # This is the default in 9.0. Setting this flag to false restores the
258
- # pre-9.0 behavior, where callbacks are called for every occurrence of an
259
- # embedded document. The pre-9.0 behavior leads to a problem that for multi
260
- # level nested documents callbacks are called multiple times.
261
- # See https://jira.mongodb.org/browse/MONGOID-5542
262
- # prevent_multiple_calls_of_embedded_callbacks: true
263
-
264
- # Raise an error when performing a #find and the document is not found.
265
- # raise_not_found_error: true
266
-
267
- # Raise an error when defining a scope with the same name as an
268
- # existing method.
269
- # scope_overwrite_exception: false
270
-
271
- # Return stored times as UTC.
272
- use_utc: true
273
-
274
- # Configure Driver-specific options. (optional)
275
- driver_options:
276
- # When this flag is off, an aggregation done on a view will be executed over
277
- # the documents included in that view, instead of all documents in the
278
- # collection. When this flag is on, the view fiter is ignored.
279
- # broken_view_aggregate: true
280
-
281
- # When this flag is set to false, the view options will be correctly
282
- # propagated to readable methods.
283
- # broken_view_options: true
284
-
285
- # When this flag is set to true, the update and replace methods will
286
- # validate the paramters and raise an error if they are invalid.
287
- # validate_update_replace: false
288
-
289
- test:
290
- clients:
291
- default:
292
- database: mongoid_geospatial_test
293
- hosts:
294
- - localhost:28017
295
- options:
296
- read:
297
- mode: :primary
298
- max_pool_size: 1
data/spec/spec_helper.rb DELETED
@@ -1,42 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
-
4
- MODELS = File.join(File.dirname(__FILE__), 'models')
5
- SUPPORT = File.join(File.dirname(__FILE__), 'support')
6
- $LOAD_PATH.unshift(MODELS)
7
- $LOAD_PATH.unshift(SUPPORT)
8
-
9
- if ENV['CI']
10
- require 'coveralls'
11
- Coveralls.wear!
12
- end
13
-
14
- require 'rspec'
15
- require 'mongoid/geospatial'
16
-
17
- Mongoid.load!(File.expand_path('../mongoid.yml', __FILE__), :test)
18
-
19
- if ENV['DEBUG'] == 'true'
20
- Mongo::Logger.logger.level = Logger::DEBUG
21
- else
22
- Mongo::Logger.logger.level = Logger::INFO
23
- end
24
- # Mongo::Logger.logger.level = Logger::DEBUG
25
-
26
- # Autoload every model for the test suite that sits in spec/app/models.
27
- Dir[File.join(MODELS, '*.rb')].sort.each do |file|
28
- name = File.basename(file, '.rb')
29
- autoload name.camelize.to_sym, name
30
- end
31
-
32
- # Require all support files.
33
- Dir[File.join(SUPPORT, '*.rb')].sort.each { |file| require file }
34
-
35
- RSpec.configure do |config|
36
- config.before(:each) do
37
- Mongoid.purge!
38
- Mongoid::Geospatial::Config.reset!
39
- end
40
- end
41
-
42
- puts "Running with Mongoid v#{Mongoid::VERSION}"
@@ -1,28 +0,0 @@
1
- module Support #:nodoc:
2
- # module Authentication
3
- # extend self
4
-
5
- # def configured?
6
- # begin
7
- # master_uri = "mongodb://mongoid:test@localhost:27017/mongoid_geospatial_test"
8
- # Mongo::Connection.from_uri(master_uri)
9
- # true
10
- # rescue Mongo::AuthenticationError => e
11
- # false
12
- # end
13
- # end
14
-
15
- # def message
16
- # %Q{
17
- # ---------------------------------------------------------------------
18
- # A user needs to be configured for authentication, otherwise some
19
- # configuration specs will not get run. You may set it up from the
20
- # mongo console:
21
-
22
- # $ use mongoid_geospatial_test;
23
- # $ db.addUser("mongoid", "test");
24
- # ---------------------------------------------------------------------
25
- # }
26
- # end
27
- # end
28
- end
@@ -1,3 +0,0 @@
1
- dbpath = /usr/local/var/mongodb
2
- master = true
3
- bind_ip = 127.0.0.1
@@ -1,19 +0,0 @@
1
- test:
2
- database: mongoid_geospatial_test
3
- host: localhost
4
- port: 27018
5
- slaves:
6
- # - host: localhost
7
- # port: 27018
8
- # - host: localhost
9
- # port: 27019
10
- # allow_dynamic_fields: false
11
- # include_root_in_json: true
12
- # parameterize_keys: false
13
- # persist_in_safe_mode: false
14
- # raise_not_found_error: false
15
- # reconnect_time: 5
16
- # autocreate_indexes: false
17
- # persist_types: false
18
- # option_no_exist: false
19
- # skip_version_check: false