Permalink
Browse files

initial commit

  • Loading branch information...
1 parent 9dc4ff7 commit d11bb4b5b5649c02e62ca5592e1691186ea9346f Andre Lewis committed Dec 19, 2008
View
@@ -0,0 +1,20 @@
+Copyright (c) 2007 Bill Eisenhauer & Andre Lewis
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the GeoKit plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the GeoKit plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'GeoKit'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
@@ -0,0 +1,5 @@
+12/18/08 Split Rails plugin from geocoder gem, updated for Rails 2.2.2
+01/20/08 Version 1.0.1. Further fix of distance calculation, this time in SQL. Now uses least() function, which is available in MySQL version 3.22.5+ and postgres versions 8.1+
+01/16/08 fixed the "zero-distance" bug (calculating between two points that are the same)
+12/11/07 fixed a small but with queries crossing meridian, and also fixed find(:closest)
+10/11/07 Fixed Rails2/Edge compatability
View
@@ -0,0 +1,9 @@
+author:
+ name_1: Bill Eisenhauer
+ homepage_1: http://blog.billeisenhauer.com
+ name_2: Andre Lewis
+ homepage_2: http://www.earthcode.com
+summary: Geo distance calculations, distance calculation query support, geocoding for physical and ip addresses.
+version: 1.0.1
+rails_version: 1.0+
+license: MIT
View
@@ -0,0 +1,50 @@
+# These defaults are used in GeoKit::Mappable.distance_to and in acts_as_mappable
+GeoKit::default_units = :miles
+GeoKit::default_formula = :sphere
+
+# This is the timeout value in seconds to be used for calls to the geocoder web
+# services. For no timeout at all, comment out the setting. The timeout unit
+# is in seconds.
+GeoKit::Geocoders::timeout = 3
+
+# These settings are used if web service calls must be routed through a proxy.
+# These setting can be nil if not needed, otherwise, addr and port must be
+# filled in at a minimum. If the proxy requires authentication, the username
+# and password can be provided as well.
+GeoKit::Geocoders::proxy_addr = nil
+GeoKit::Geocoders::proxy_port = nil
+GeoKit::Geocoders::proxy_user = nil
+GeoKit::Geocoders::proxy_pass = nil
+
+# This is your yahoo application key for the Yahoo Geocoder.
+# See http://developer.yahoo.com/faq/index.html#appid
+# and http://developer.yahoo.com/maps/rest/V1/geocode.html
+GeoKit::Geocoders::yahoo = 'REPLACE_WITH_YOUR_YAHOO_KEY'
+
+# This is your Google Maps geocoder key.
+# See http://www.google.com/apis/maps/signup.html
+# and http://www.google.com/apis/maps/documentation/#Geocoding_Examples
+GeoKit::Geocoders::google = 'REPLACE_WITH_YOUR_GOOGLE_KEY'
+
+# This is your username and password for geocoder.us.
+# To use the free service, the value can be set to nil or false. For
+# usage tied to an account, the value should be set to username:password.
+# See http://geocoder.us
+# and http://geocoder.us/user/signup
+GeoKit::Geocoders::geocoder_us = false
+
+# This is your authorization key for geocoder.ca.
+# To use the free service, the value can be set to nil or false. For
+# usage tied to an account, set the value to the key obtained from
+# Geocoder.ca.
+# See http://geocoder.ca
+# and http://geocoder.ca/?register=1
+GeoKit::Geocoders::geocoder_ca = false
+
+# This is the order in which the geocoders are called in a failover scenario
+# If you only want to use a single geocoder, put a single symbol in the array.
+# Valid symbols are :google, :yahoo, :us, and :ca.
+# Be aware that there are Terms of Use restrictions on how you can use the
+# various geocoders. Make sure you read up on relevant Terms of Use for each
+# geocoder you are going to use.
+GeoKit::Geocoders::provider_order = [:google,:us]
View
13 init.rb
@@ -0,0 +1,13 @@
+# Load modules and classes needed to automatically mix in ActiveRecord and
+# ActionController helpers. All other functionality must be explicitly
+# required.
+require 'geokit' #requires the geokit gem
+require 'geokit/defaults'
+require 'geokit/acts_as_mappable'
+require 'geokit/ip_geocode_lookup'
+
+# Automatically mix in distance finder support into ActiveRecord classes.
+ActiveRecord::Base.send :include, GeoKit::ActsAsMappable
+
+# Automatically mix in ip geocoding helpers into ActionController classes.
+ActionController::Base.send :include, GeoKit::IpGeocodeLookup
View
@@ -0,0 +1,14 @@
+# Display to the console the contents of the README file.
+puts IO.read(File.join(File.dirname(__FILE__), 'README'))
+
+# place the api_keys_template in the application's /config/initializers/geokit_config.rb
+path=File.expand_path(File.join(File.dirname(__FILE__), '../../../config/initializers/geokit_config.rb'))
+template_path=File.join(File.dirname(__FILE__), '/assets/api_keys_template')
+if File.exists?(path)
+ puts "It looks like you already have a configuration file at #{path}. We've left it as-is. Recommended: check #{template_path} to see if anything has changed, and update config file accordingly."
+else
+ File.open(path) do |f|
+ f.puts IO.read(template_path)
+ puts "We created a configuration file for you in config/initializers/geokit_config.rb. Add your Google API keys, etc. there."
+ end
+end
Oops, something went wrong.

0 comments on commit d11bb4b

Please sign in to comment.