mongo_geo 0.1.0 → 0.1.1
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.
- data/README.markdown +2 -2
- data/VERSION +1 -1
- data/mongo_geo.gemspec +4 -4
- data/test/helper.rb +1 -1
- data/test/test_mongo_geo.rb +3 -3
- data/test/test_plucky_extensions.rb +2 -2
- metadata +13 -4
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# mongo_geo
|
2
2
|
|
3
|
-
mongo_geo is a plugin for MongoMapper that exposes the [GeoSpatial indexing features](http://www.mongodb.org/display/DOCS/Geospatial+Indexing) in MongoDb.
|
3
|
+
mongo_geo is a plugin for [MongoMapper](http://github.com/jnunemaker/mongomapper) that exposes the [GeoSpatial indexing features](http://www.mongodb.org/display/DOCS/Geospatial+Indexing) in MongoDb.
|
4
4
|
|
5
5
|
Currently, I'm only developing against Ruby 1.9.1 so other versions may be flakey.
|
6
6
|
|
@@ -15,7 +15,7 @@ Currently, I'm only developing against Ruby 1.9.1 so other versions may be flake
|
|
15
15
|
|
16
16
|
### [Plucky](http://github.com/jnunemaker/plucky) style queries:
|
17
17
|
TestAsset.where(:coords.near => [50, 50]).limit(10).to_a
|
18
|
-
TestAsset.where(:coords.within => { "$center" => [[50, 50], 10] }).to_a
|
18
|
+
TestAsset.where(:coords.within => { "$center" => [[50, 50], 10] }).to_a # "$center" => [center, radius]
|
19
19
|
TestAsset.where(:coords.within => { "$box" => [ [45, 45], [55, 55] ] }).to_a # [lower_left, top_right]
|
20
20
|
|
21
21
|
N.B. bounds queries are syntactically ugly at the moment and are likely to change soon
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/mongo_geo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mongo_geo}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Parrish"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-27}
|
13
13
|
s.description = %q{A MongoMapper plugin that adds geospatial functionality.}
|
14
14
|
s.email = %q{mtparrish@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.homepage = %q{http://github.com/parrish/mongo_geo}
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
34
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.
|
35
|
+
s.rubygems_version = %q{1.3.7}
|
36
36
|
s.summary = %q{A MongoMapper plugin that adds geospatial functionality.}
|
37
37
|
s.test_files = [
|
38
38
|
"test/helper.rb",
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
45
|
s.specification_version = 3
|
46
46
|
|
47
|
-
if Gem::Version.new(Gem::
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
48
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
49
49
|
s.add_runtime_dependency(%q<mongo_mapper>, [">= 0.8.2"])
|
50
50
|
else
|
data/test/helper.rb
CHANGED
data/test/test_mongo_geo.rb
CHANGED
@@ -34,15 +34,15 @@ class TestMongoGeo < Test::Unit::TestCase
|
|
34
34
|
assert_equal(2, nearby.count)
|
35
35
|
assert_equal(@asset1, nearby.first)
|
36
36
|
|
37
|
-
assert(nearby.methods.include?(:average_distance), "#near did not define average_distance")
|
37
|
+
assert(nearby.methods.collect{ |m| m.to_sym }.include?(:average_distance), "#near did not define average_distance")
|
38
38
|
assert_equal(nearby.average_distance.class, Float)
|
39
39
|
|
40
|
-
assert(nearby.first.methods.include?(:distance), "#near did not define distance on each record")
|
40
|
+
assert(nearby.first.methods.collect{ |m| m.to_sym }.include?(:distance), "#near did not define distance on each record")
|
41
41
|
assert_equal(nearby.first.distance.class, Float)
|
42
42
|
end
|
43
43
|
|
44
44
|
should "perform a simple #distance_from calculation" do
|
45
|
-
assert(@asset1.methods.include?(:distance_from), "GeoSpatial::InstanceMethods were not included")
|
45
|
+
assert(@asset1.methods.collect{ |m| m.to_sym }.include?(:distance_from), "GeoSpatial::InstanceMethods were not included")
|
46
46
|
assert_equal(Math.sqrt(2), @asset1.distance_from([51, 51]))
|
47
47
|
assert_raise(ArgumentError) { @asset1.distance_from(51) }
|
48
48
|
|
@@ -3,11 +3,11 @@ require 'helper'
|
|
3
3
|
class TestMongoGeo < Test::Unit::TestCase
|
4
4
|
context "Extending Plucky symbols" do
|
5
5
|
should "add #near" do
|
6
|
-
assert Plucky::Extensions::Symbol.instance_methods.include?(:near), "near symbol operator not created"
|
6
|
+
assert Plucky::Extensions::Symbol.instance_methods.collect{ |m| m.to_sym }.include?(:near), "near symbol operator not created"
|
7
7
|
end
|
8
8
|
|
9
9
|
should "add #within" do
|
10
|
-
assert Plucky::Extensions::Symbol.instance_methods.include?(:within), "within symbol operator not created"
|
10
|
+
assert Plucky::Extensions::Symbol.instance_methods.collect{ |m| m.to_sym }.include?(:within), "within symbol operator not created"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_geo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Michael Parrish
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-27 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: thoughtbot-shoulda
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: mongo_mapper
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 59
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
- 8
|
@@ -74,23 +79,27 @@ rdoc_options:
|
|
74
79
|
require_paths:
|
75
80
|
- lib
|
76
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
77
83
|
requirements:
|
78
84
|
- - ">="
|
79
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
80
87
|
segments:
|
81
88
|
- 0
|
82
89
|
version: "0"
|
83
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
84
92
|
requirements:
|
85
93
|
- - ">="
|
86
94
|
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
87
96
|
segments:
|
88
97
|
- 0
|
89
98
|
version: "0"
|
90
99
|
requirements: []
|
91
100
|
|
92
101
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.3.
|
102
|
+
rubygems_version: 1.3.7
|
94
103
|
signing_key:
|
95
104
|
specification_version: 3
|
96
105
|
summary: A MongoMapper plugin that adds geospatial functionality.
|