mongoid_geospatial 2.7.1 → 2.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
  gemspec # Specify gem's dependencies in mongoid_geospatial.gemspec
3
3
 
4
- gem 'mongoid', '~> 3.0'
4
+ gem 'mongoid', '>= 3.0'
5
5
 
6
6
  group :development do
7
7
  gem 'rgeo'
@@ -12,3 +12,8 @@ group :development do
12
12
  gem 'pry'
13
13
  # gem 'fuubar'
14
14
  end
15
+
16
+ group :test do
17
+ gem 'dbf'
18
+ gem 'nokogiri'
19
+ end
data/README.md CHANGED
@@ -14,7 +14,6 @@ There are no plans to support MongoDB < 2.0
14
14
  There are no plans to support Mongoid <= 2.0
15
15
 
16
16
 
17
-
18
17
  Quick Start
19
18
  -----------
20
19
 
@@ -44,12 +43,33 @@ You can also use an external Geometric/Spatial alongside.
44
43
  end
45
44
 
46
45
 
46
+ For geo points, an extra macro `geo_field` is available
47
+
48
+
49
+ class Place
50
+ include Mongoid::Document
51
+ include Mongoid::Geospatial
52
+
53
+ # field :location, type: Point, spatial: true
54
+ geo_field :location
55
+ end
56
+
57
+
47
58
  Generate indexes on MongoDB:
48
59
 
49
60
 
50
61
  rake db:mongoid:create_indexes
51
62
 
52
63
 
64
+ Index programatically via https://github.com/kristianmandrup/mongoid_indexing gem
65
+
66
+
67
+ Mongoid::Indexing.create_indexes
68
+
69
+
70
+ This is fx useful when running specs or when working with spatials on a gem or engine.
71
+
72
+
53
73
  Points
54
74
  ------
55
75
 
@@ -41,6 +41,9 @@ module Mongoid
41
41
  end
42
42
 
43
43
  module ClassMethods #:nodoc:
44
+ def geo_field name, options = {}
45
+ field name, {type: Mongoid::Geospatial::Point, spatial: true}.merge(options)
46
+ end
44
47
 
45
48
  # create spatial index for given field
46
49
  # @param [String,Symbol] name
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Geospatial
3
- VERSION = "2.7.1"
3
+ VERSION = "2.7.2"
4
4
  end
5
5
  end
@@ -16,10 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Mongoid::Geospatial::VERSION
17
17
 
18
18
  gem.add_dependency('mongoid', ['>= 3.0.0'])
19
- gem.add_dependency('activesupport', ["~> 3.2"])
20
- gem.add_development_dependency('yard', ["~>0.6.0"])
21
- gem.add_development_dependency('rspec', ['~>2.11'])
22
- gem.add_development_dependency('mocha', ['>= 0'])
23
- gem.add_development_dependency('will_paginate', ['>= 0'])
19
+ gem.add_dependency('activesupport', [">= 3.2"])
20
+ gem.add_development_dependency('yard', [">= 0.6.0"])
21
+ gem.add_development_dependency('rspec', ['>= 2.11'])
24
22
  gem.add_development_dependency('kaminari', ['>= 0'])
23
+ gem.add_development_dependency('will_paginate', ['>= 0'])
25
24
  end
data/spec/models/bar.rb CHANGED
@@ -3,10 +3,10 @@ class Bar
3
3
  include Mongoid::Geospatial
4
4
 
5
5
  field :name, :type => String
6
- field :location, :type => Point, :spatial => true
6
+
7
+ geo_field :location
7
8
 
8
9
  has_one :rating, :as => :ratable
9
10
 
10
11
  spatial_scope :location
11
-
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_geospatial
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-11 00:00:00.000000000 Z
13
+ date: 2013-03-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mongoid
@@ -33,7 +33,7 @@ dependencies:
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
- - - ~>
36
+ - - ! '>='
37
37
  - !ruby/object:Gem::Version
38
38
  version: '3.2'
39
39
  type: :runtime
@@ -41,7 +41,7 @@ dependencies:
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
- - - ~>
44
+ - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3.2'
47
47
  - !ruby/object:Gem::Dependency
@@ -49,7 +49,7 @@ dependencies:
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.6.0
55
55
  type: :development
@@ -57,7 +57,7 @@ dependencies:
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
- - - ~>
60
+ - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: 0.6.0
63
63
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
- - - ~>
68
+ - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: '2.11'
71
71
  type: :development
@@ -73,11 +73,11 @@ dependencies:
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
- - - ~>
76
+ - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '2.11'
79
79
  - !ruby/object:Gem::Dependency
80
- name: mocha
80
+ name: kaminari
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
@@ -108,22 +108,6 @@ dependencies:
108
108
  - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: kaminari
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
111
  description: Mongoid Extension that simplifies spatial calculations. Adds integration
128
112
  into mongoid so pagination and other function continue to work. It adds symbol extensions
129
113
  to simplify query creation.