rails-geocoder 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/LICENSE +1 -1
- data/README.rdoc +5 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/geocoder.rb +1 -0
- data/{tasks → lib/tasks}/geocoder_tasks.rake +0 -0
- data/rails-geocoder.gemspec +4 -4
- data/test/test_helper.rb +10 -11
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
Per-release changes to Geocoder.
|
4
4
|
|
5
|
+
== 0.8.9 (2010 Feb 11)
|
6
|
+
|
7
|
+
* Add Rails 3 compatibility.
|
8
|
+
* Avoid querying Google when query would be an empty string.
|
9
|
+
|
5
10
|
== 0.8.8 (2009 Dec 7)
|
6
11
|
|
7
12
|
* Automatically select a less accurate but compatible distance algorithm when SQLite database detected (fixes SQLite incompatibility).
|
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -4,6 +4,8 @@ Geocoder adds object geocoding and database-agnostic distance calculations to Ru
|
|
4
4
|
|
5
5
|
Geocoder does not rely on proprietary database functions so finding geocoded objects in a given area is easily done using out-of-the-box MySQL or even SQLite.
|
6
6
|
|
7
|
+
<b>Geocoder is currently compatible with Rails 2.x and Rails 3.</b>
|
8
|
+
|
7
9
|
|
8
10
|
== 1. Install
|
9
11
|
|
@@ -122,7 +124,9 @@ Because Geocoder needs to provide this functionality as a named scope, we must g
|
|
122
124
|
|
123
125
|
== To-do List
|
124
126
|
|
127
|
+
* prevent NameError when GOOGLE_MAPS_API_KEY is missing: show nice msg
|
125
128
|
* <tt>install.rb</tt> should do some setup when installed as a plugin
|
129
|
+
* create initializer with GOOGLE_MAPS_API_KEY?
|
126
130
|
|
127
131
|
|
128
|
-
Copyright (c) 2009 Alex Reisner, released under the MIT license
|
132
|
+
Copyright (c) 2009-10 Alex Reisner, released under the MIT license
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
gem.summary = %Q{Add geocoding functionality to Rails models.}
|
9
9
|
gem.description = %Q{Geocoder adds object geocoding and database-agnostic distance calculations to Ruby on Rails. It does not rely on proprietary database functions so finding geocoded objects in a given area is easily done using out-of-the-box MySQL or even SQLite.}
|
10
10
|
gem.email = "alex@alexreisner.com"
|
11
|
-
gem.homepage = "http://
|
11
|
+
gem.homepage = "http://github.com/alexreisner/geocoder"
|
12
12
|
gem.authors = ["Alex Reisner"]
|
13
13
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
14
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.9
|
data/lib/geocoder.rb
CHANGED
@@ -213,6 +213,7 @@ module Geocoder
|
|
213
213
|
# Returns array [lat,lon] if found, nil if not found or if network error.
|
214
214
|
#
|
215
215
|
def self.fetch_coordinates(query)
|
216
|
+
return nil if query.blank?
|
216
217
|
return nil unless doc = self.search(query)
|
217
218
|
|
218
219
|
# make sure search found a result
|
File without changes
|
data/rails-geocoder.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails-geocoder}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alex Reisner"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-02-11}
|
13
13
|
s.description = %q{Geocoder adds object geocoding and database-agnostic distance calculations to Ruby on Rails. It does not rely on proprietary database functions so finding geocoded objects in a given area is easily done using out-of-the-box MySQL or even SQLite.}
|
14
14
|
s.email = %q{alex@alexreisner.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,13 +26,13 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION",
|
27
27
|
"init.rb",
|
28
28
|
"lib/geocoder.rb",
|
29
|
+
"lib/tasks/geocoder_tasks.rake",
|
29
30
|
"rails-geocoder.gemspec",
|
30
|
-
"tasks/geocoder_tasks.rake",
|
31
31
|
"test/fixtures/madison_square_garden.xml",
|
32
32
|
"test/geocoder_test.rb",
|
33
33
|
"test/test_helper.rb"
|
34
34
|
]
|
35
|
-
s.homepage = %q{http://
|
35
|
+
s.homepage = %q{http://github.com/alexreisner/geocoder}
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
38
|
s.rubygems_version = %q{1.3.5}
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
|
-
require '
|
3
|
+
require 'active_support/core_ext'
|
4
4
|
|
5
5
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
6
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
@@ -16,16 +16,15 @@ module ActiveRecord
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def read_attribute(attr_name)
|
19
|
-
@attributes[attr_name.
|
19
|
+
@attributes[attr_name.to_sym]
|
20
20
|
end
|
21
21
|
|
22
22
|
def write_attribute(attr_name, value)
|
23
|
-
attr_name =
|
24
|
-
@attributes[attr_name] = value
|
23
|
+
@attributes[attr_name.to_sym] = value
|
25
24
|
end
|
26
25
|
|
27
26
|
def update_attribute(attr_name, value)
|
28
|
-
write_attribute(attr_name, value)
|
27
|
+
write_attribute(attr_name.to_sym, value)
|
29
28
|
end
|
30
29
|
|
31
30
|
def self.named_scope(*args); end
|
@@ -51,18 +50,18 @@ end
|
|
51
50
|
class Venue < ActiveRecord::Base
|
52
51
|
geocoded_by :address
|
53
52
|
|
54
|
-
attr_accessor :name, :address
|
55
|
-
|
56
53
|
def initialize(name, address)
|
57
54
|
super()
|
58
55
|
write_attribute :name, name
|
59
56
|
write_attribute :address, address
|
60
57
|
end
|
61
58
|
|
62
|
-
|
63
|
-
#
|
64
|
-
|
65
|
-
def
|
59
|
+
##
|
60
|
+
# If method not found, assume it's an ActiveRecord attribute reader.
|
61
|
+
#
|
62
|
+
def method_missing(name, *args, &block)
|
63
|
+
@attributes[name]
|
64
|
+
end
|
66
65
|
end
|
67
66
|
|
68
67
|
class Test::Unit::TestCase
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Reisner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-11 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -32,13 +32,13 @@ files:
|
|
32
32
|
- VERSION
|
33
33
|
- init.rb
|
34
34
|
- lib/geocoder.rb
|
35
|
+
- lib/tasks/geocoder_tasks.rake
|
35
36
|
- rails-geocoder.gemspec
|
36
|
-
- tasks/geocoder_tasks.rake
|
37
37
|
- test/fixtures/madison_square_garden.xml
|
38
38
|
- test/geocoder_test.rb
|
39
39
|
- test/test_helper.rb
|
40
40
|
has_rdoc: true
|
41
|
-
homepage: http://
|
41
|
+
homepage: http://github.com/alexreisner/geocoder
|
42
42
|
licenses: []
|
43
43
|
|
44
44
|
post_install_message:
|