autometal-geoip 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -6,14 +6,18 @@
6
6
  A wrapper to MaxMind's GeoIP services, that can work with both free and paid versions.
7
7
  Also provides geo-location methods to Active Record and Sequel Models.
8
8
 
9
- This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."
9
+ This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
10
+
11
+ === Why?
12
+ It is quite fast, simple and hackable, and it doesn't require any change to your application schema - unless you want to.
13
+ Plus, the ruby bindings available from MaxMind are quite crap to use.
10
14
 
11
15
  == FEATURES/PROBLEMS:
12
16
 
13
17
  * While you are installing the MaxMind binaries on Linux systems, you mayget an error similar to this:
14
18
  libGeoIP.so.1: cannot open shared object file: No such file or directory
15
19
  If you do, do the following:
16
- $ vim /etc/ld.so.conf (and add the directory the libraries were installed in usually /var/lib or /var/shared/lib)
20
+ $ vim /etc/ld.so.conf (and add /var/shared/lib)
17
21
  $ ldconfig
18
22
  And rerun the installer
19
23
 
@@ -57,12 +61,13 @@ You can override the attribute used to geolocate by overriding +geo_attr+
57
61
  == REQUIREMENTS:
58
62
 
59
63
  * GeoIP C bindings (installed along with the Gem)
60
- * Active Support (sudo gem install active-support --no-ri --no-rdoc)
64
+ * Active Support
61
65
  This isn't really needed, I just like using the 1.day.ago stuff too much...
62
66
 
63
67
  == INSTALL:
64
68
 
65
- sudo gem install autometal-geoip
69
+ sudo gem install autometal-geoip
70
+ sudo install_geoip (unless already installed)
66
71
 
67
72
  == LICENSE:
68
73
 
data/lib/geoip.rb CHANGED
@@ -5,7 +5,7 @@ $:.unshift(File.dirname(__FILE__)) unless
5
5
 
6
6
  module Autometal
7
7
  class Geoip
8
- VERSION = '0.1.2'
8
+ VERSION = '0.1.3'
9
9
  DEFAULT_PACKAGE = "GeoLiteCity"
10
10
  DATA_FILE_PATH = "/usr/local/share/GeoIP/"
11
11
  BIN = "geoiplookup"
@@ -1,4 +1,5 @@
1
1
  require "active_support"
2
+ require "fileutils"
2
3
 
3
4
  module Autometal
4
5
  class Geoip
@@ -23,7 +24,8 @@ module Autometal
23
24
  end
24
25
 
25
26
  def install_database
26
- if File::ctime(File.join(Autometal::Geoip::DATA_FILE_PATH,"#{@package_name}.dat")) > 1.month.ago
27
+ target = File.join(Autometal::Geoip::DATA_FILE_PATH,"#{@package_name}.dat")
28
+ if File.exists?(target) and File::ctime(target) > 1.month.ago
27
29
  puts "Datafile is up to date, skipping"
28
30
  else
29
31
  `cd #{File.dirname(__FILE__)}/../../shellscripts/ && ./install_db #{@db_url}`
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autometal-geoip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Achillefs Charmpilas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-11 00:00:00 +02:00
18
+ date: 2010-12-06 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -68,7 +68,7 @@ description: |-
68
68
  A wrapper to MaxMind's GeoIP services, that can work with both free and paid versions.
69
69
  Also provides geo-location methods to Active Record and Sequel Models.
70
70
 
71
- This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."
71
+ This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
72
72
  email:
73
73
  - ac@humbuckercode.co.uk
74
74
  executables: