ip_to_country 0.0.3 → 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 652fe8ab6090e2421962c9442bd57529ee761a41
4
+ data.tar.gz: b886d3723add2e31eb6309c30d21145704122e59
5
+ SHA512:
6
+ metadata.gz: ee51c0a26f6851e1a31e7cd719f2cb67da92ea3fcb8d90cfac06782e520668bb73182dd3b67e7b3efabd8d0c4954c29eda5aa6c4bd3ad22ee00362cb7360c4ea
7
+ data.tar.gz: 7d28d5aec3f0d3f7d30ec248b6ebb5345d240d556f20436774ec196075061eb618403a67ff88fde92f1f752afbf523419a2bbcac40fbe399211b8c75be54dda0
data/README.md CHANGED
@@ -1,11 +1,51 @@
1
1
  IpToCountry [![Gem Version](https://badge.fury.io/rb/ip_to_country.png)](http://badge.fury.io/rb/ip_to_country) [![Build Status](https://travis-ci.org/vincent-pochet/ip_to_country.png?branch=master)](https://travis-ci.org/vincent-pochet/ip_to_country) [![Dependency Status](https://gemnasium.com/vincent-pochet/ip_to_country.png)](https://gemnasium.com/vincent-pochet/ip_to_country) [![Code Climate](https://codeclimate.com/github/vincent-pochet/ip_to_country.png)](https://codeclimate.com/github/vincent-pochet/ip_to_country) [![Coverage Status](https://coveralls.io/repos/vincent-pochet/ip_to_country/badge.png?branch=master)](https://coveralls.io/r/vincent-pochet/ip_to_country)
2
2
  =====
3
3
 
4
- Description and documentation comming soon
4
+ IpToCountry is a simple rails extension to find the origin (ISO country code or country name) of an IP address.
5
+
6
+ IpToCountry only supports ruby 1.9.3+, rails 3.2+ and only works with a postgresql database. Support mysql is planned.
7
+
8
+ Installation
9
+ ------------
10
+
11
+ Add the following line to your gemfile:
12
+
13
+ gem 'geocoder'
14
+
15
+ and run command
16
+
17
+ bundle install
18
+
19
+ Generate migration
20
+
21
+ rails generate geoip
22
+ rake db:migrate
23
+ rake ip_to_country:populate
24
+
25
+ Geoip model
26
+ ------------
27
+
28
+ All logic takes place in `IpToCountry::Geoip` model
29
+
30
+ You can find detail of an IP address, using:
31
+
32
+ IpToCountry::Geoip.by_ip('192.168.1.34')
33
+
34
+ Request location
35
+ ------------
36
+
37
+ The gem add an extension to `Rack::Request` to quickly get the country code/name origin of a request.
38
+
39
+ In your controller, you can do:
40
+
41
+ request.geoip.country_name
42
+ request.geoip.country_code
5
43
 
6
44
  Development
7
45
  -----------
8
46
 
47
+ Pull requests and bug reports are welcome!
48
+
9
49
  ### Author
10
50
 
11
51
  [Vincent Pochet](https://github.com/vincent-pochet) ([@vin100pochet](https://twitter.com/vin100pochet))
@@ -3,8 +3,6 @@
3
3
  module IpToCountry
4
4
  class Geoip < ActiveRecord::Base
5
5
 
6
- attr_accessible :ip_from_string, :ip_to_string, :ip_from, :ip_to, :country_code, :country_name
7
-
8
6
  ###################
9
7
  ### Validations ###
10
8
  ###################
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module IpToCountry
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
  end
@@ -3771,3 +3771,550 @@ Unable to load geoip, underlying cause No such file to load -- geoip
3771
3771
  from geoips where ip_to >= 3232235778)) LIMIT 1
3772
3772
  IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3773
3773
  from geoips where ip_to >= 3232235778)) LIMIT 1
3774
+ Connecting to database specified by database.yml
3775
+ Connecting to database specified by database.yml
3776
+  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
3777
+ Migrating to CreateGeoips (1)
3778
+ Unable to load geoip, underlying cause No such file to load -- geoip
3779
+
3780
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
3781
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
3782
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
3783
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
3784
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
3785
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
3786
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
3787
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
3788
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:32:in `<class:TestCase>'
3789
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:29:in `<top (required)>'
3790
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
3791
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
3792
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
3793
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
3794
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
3795
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
3796
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
3797
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
3798
+  (0.4ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
3799
+  (0.2ms) BEGIN
3800
+ Fixture Delete (0.8ms) DELETE FROM "geoips"
3801
+ Fixture Insert (0.6ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
3802
+  (22.0ms) COMMIT
3803
+  (0.6ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
3804
+  (0.2ms) BEGIN
3805
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3806
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3807
+  (0.2ms) ROLLBACK
3808
+  (0.1ms) BEGIN
3809
+  (0.1ms) ROLLBACK
3810
+  (0.1ms) BEGIN
3811
+  (0.1ms) ROLLBACK
3812
+  (0.1ms) BEGIN
3813
+  (0.1ms) ROLLBACK
3814
+  (0.1ms) BEGIN
3815
+  (66.6ms) DROP TABLE IF EXISTS geoips_tempo;
3816
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3817
+
3818
+  (0.8ms) ROLLBACK
3819
+  (0.1ms) BEGIN
3820
+  (0.1ms) ROLLBACK
3821
+  (0.1ms) BEGIN
3822
+  (61.0ms)  DROP TABLE IF EXISTS geoips_tempo;
3823
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3824
+ 
3825
+  (1.9ms) ALTER TABLE geoips RENAME TO tmp;
3826
+ ALTER TABLE geoips_tempo RENAME TO geoips;
3827
+ ALTER TABLE tmp RENAME TO geoips_tempo;
3828
+ DROP TABLE geoips_tempo;
3829
+
3830
+ IpToCountry::Geoip Load (0.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
3831
+ from geoips where ip_to >= 35037184)) LIMIT 1
3832
+  (0.8ms) ROLLBACK
3833
+  (0.1ms) BEGIN
3834
+  (0.2ms) ROLLBACK
3835
+  (0.1ms) BEGIN
3836
+  (22.7ms) DROP TABLE IF EXISTS geoips_tempo;
3837
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3838
+
3839
+  (1.5ms)  ALTER TABLE geoips RENAME TO tmp;
3840
+ ALTER TABLE geoips_tempo RENAME TO geoips;
3841
+ ALTER TABLE tmp RENAME TO geoips_tempo;
3842
+ DROP TABLE geoips_tempo;
3843
+ 
3844
+  (0.8ms) ROLLBACK
3845
+ IpToCountry::Geoip Load (2.3ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3846
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3847
+ IpToCountry::Geoip Load (1.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3848
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3849
+ IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3850
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3851
+ IpToCountry::Geoip Load (0.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3852
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3853
+ Connecting to database specified by database.yml
3854
+  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
3855
+ Migrating to CreateGeoips (1)
3856
+ Unable to load geoip, underlying cause No such file to load -- geoip
3857
+
3858
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
3859
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
3860
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
3861
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
3862
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
3863
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
3864
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
3865
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
3866
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:28:in `<class:TestCase>'
3867
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:25:in `<top (required)>'
3868
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
3869
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
3870
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
3871
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
3872
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
3873
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
3874
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
3875
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
3876
+  (0.4ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
3877
+  (0.1ms) BEGIN
3878
+ Fixture Delete (0.7ms) DELETE FROM "geoips"
3879
+ Fixture Insert (0.6ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
3880
+  (14.4ms) COMMIT
3881
+  (0.2ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
3882
+  (0.1ms) BEGIN
3883
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3884
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3885
+  (0.2ms) ROLLBACK
3886
+  (0.1ms) BEGIN
3887
+  (0.1ms) ROLLBACK
3888
+  (0.1ms) BEGIN
3889
+  (0.1ms) ROLLBACK
3890
+  (0.1ms) BEGIN
3891
+  (0.1ms) ROLLBACK
3892
+  (0.1ms) BEGIN
3893
+  (48.6ms) DROP TABLE IF EXISTS geoips_tempo;
3894
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3895
+
3896
+  (1.1ms) ROLLBACK
3897
+  (0.1ms) BEGIN
3898
+  (0.1ms) ROLLBACK
3899
+  (0.1ms) BEGIN
3900
+  (37.5ms)  DROP TABLE IF EXISTS geoips_tempo;
3901
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3902
+ 
3903
+  (2.1ms) ALTER TABLE geoips RENAME TO tmp;
3904
+ ALTER TABLE geoips_tempo RENAME TO geoips;
3905
+ ALTER TABLE tmp RENAME TO geoips_tempo;
3906
+ DROP TABLE geoips_tempo;
3907
+
3908
+ IpToCountry::Geoip Load (1.1ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
3909
+ from geoips where ip_to >= 35037184)) LIMIT 1
3910
+  (0.7ms) ROLLBACK
3911
+  (0.1ms) BEGIN
3912
+  (0.1ms) ROLLBACK
3913
+  (0.1ms) BEGIN
3914
+  (22.9ms) DROP TABLE IF EXISTS geoips_tempo;
3915
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3916
+
3917
+  (1.5ms)  ALTER TABLE geoips RENAME TO tmp;
3918
+ ALTER TABLE geoips_tempo RENAME TO geoips;
3919
+ ALTER TABLE tmp RENAME TO geoips_tempo;
3920
+ DROP TABLE geoips_tempo;
3921
+ 
3922
+  (0.9ms) ROLLBACK
3923
+ IpToCountry::Geoip Load (12.7ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3924
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3925
+ IpToCountry::Geoip Load (0.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3926
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3927
+ IpToCountry::Geoip Load (0.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3928
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3929
+ IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3930
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3931
+ Connecting to database specified by database.yml
3932
+  (6.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
3933
+ Migrating to CreateGeoips (1)
3934
+ Unable to load geoip, underlying cause No such file to load -- geoip
3935
+
3936
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
3937
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
3938
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
3939
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
3940
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
3941
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
3942
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
3943
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
3944
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:28:in `<class:TestCase>'
3945
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:25:in `<top (required)>'
3946
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
3947
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
3948
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
3949
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
3950
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
3951
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
3952
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
3953
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
3954
+  (9.4ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
3955
+  (0.1ms) BEGIN
3956
+ Fixture Delete (22.6ms) DELETE FROM "geoips"
3957
+ Fixture Insert (55.1ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
3958
+  (87.3ms) COMMIT
3959
+  (0.3ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
3960
+  (0.1ms) BEGIN
3961
+ IpToCountry::Geoip Load (17.3ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
3962
+ from geoips where ip_to >= 3232235778)) LIMIT 1
3963
+  (0.2ms) ROLLBACK
3964
+  (0.1ms) BEGIN
3965
+  (0.1ms) ROLLBACK
3966
+  (0.1ms) BEGIN
3967
+  (0.2ms) ROLLBACK
3968
+  (0.1ms) BEGIN
3969
+  (0.1ms) ROLLBACK
3970
+  (0.1ms) BEGIN
3971
+  (236.1ms) DROP TABLE IF EXISTS geoips_tempo;
3972
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3973
+
3974
+  (0.6ms) ROLLBACK
3975
+  (0.1ms) BEGIN
3976
+  (0.1ms) ROLLBACK
3977
+  (0.1ms) BEGIN
3978
+  (26.8ms)  DROP TABLE IF EXISTS geoips_tempo;
3979
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3980
+ 
3981
+  (32.8ms) ALTER TABLE geoips RENAME TO tmp;
3982
+ ALTER TABLE geoips_tempo RENAME TO geoips;
3983
+ ALTER TABLE tmp RENAME TO geoips_tempo;
3984
+ DROP TABLE geoips_tempo;
3985
+
3986
+ IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
3987
+ from geoips where ip_to >= 35037184)) LIMIT 1
3988
+  (0.7ms) ROLLBACK
3989
+  (0.1ms) BEGIN
3990
+  (0.2ms) ROLLBACK
3991
+  (0.1ms) BEGIN
3992
+  (125.5ms) DROP TABLE IF EXISTS geoips_tempo;
3993
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
3994
+
3995
+  (1.3ms)  ALTER TABLE geoips RENAME TO tmp;
3996
+ ALTER TABLE geoips_tempo RENAME TO geoips;
3997
+ ALTER TABLE tmp RENAME TO geoips_tempo;
3998
+ DROP TABLE geoips_tempo;
3999
+ 
4000
+  (0.7ms) ROLLBACK
4001
+ IpToCountry::Geoip Load (5.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4002
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4003
+ IpToCountry::Geoip Load (0.7ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4004
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4005
+ IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4006
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4007
+ IpToCountry::Geoip Load (1.3ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4008
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4009
+ Connecting to database specified by database.yml
4010
+  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
4011
+ Migrating to CreateGeoips (1)
4012
+ Unable to load geoip, underlying cause No such file to load -- geoip
4013
+
4014
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
4015
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
4016
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
4017
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
4018
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
4019
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
4020
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
4021
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
4022
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:28:in `<class:TestCase>'
4023
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:25:in `<top (required)>'
4024
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
4025
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
4026
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
4027
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
4028
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
4029
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
4030
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
4031
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
4032
+  (29.3ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
4033
+  (0.1ms) BEGIN
4034
+ Fixture Delete (0.6ms) DELETE FROM "geoips"
4035
+ Fixture Insert (0.5ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
4036
+  (18.5ms) COMMIT
4037
+  (0.3ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
4038
+  (0.1ms) BEGIN
4039
+ IpToCountry::Geoip Load (35.6ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4040
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4041
+  (0.2ms) ROLLBACK
4042
+  (0.1ms) BEGIN
4043
+  (0.1ms) ROLLBACK
4044
+  (0.1ms) BEGIN
4045
+  (0.1ms) ROLLBACK
4046
+  (0.1ms) BEGIN
4047
+  (0.1ms) ROLLBACK
4048
+  (0.1ms) BEGIN
4049
+  (74.7ms) DROP TABLE IF EXISTS geoips_tempo;
4050
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4051
+
4052
+  (0.6ms) ROLLBACK
4053
+  (0.1ms) BEGIN
4054
+  (0.1ms) ROLLBACK
4055
+  (0.1ms) BEGIN
4056
+  (37.1ms)  DROP TABLE IF EXISTS geoips_tempo;
4057
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4058
+ 
4059
+  (1.9ms) ALTER TABLE geoips RENAME TO tmp;
4060
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4061
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4062
+ DROP TABLE geoips_tempo;
4063
+
4064
+ IpToCountry::Geoip Load (1.4ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
4065
+ from geoips where ip_to >= 35037184)) LIMIT 1
4066
+  (1.2ms) ROLLBACK
4067
+  (0.1ms) BEGIN
4068
+  (0.2ms) ROLLBACK
4069
+  (0.1ms) BEGIN
4070
+  (16.8ms) DROP TABLE IF EXISTS geoips_tempo;
4071
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4072
+
4073
+  (2.4ms)  ALTER TABLE geoips RENAME TO tmp;
4074
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4075
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4076
+ DROP TABLE geoips_tempo;
4077
+ 
4078
+  (0.9ms) ROLLBACK
4079
+ IpToCountry::Geoip Load (14.0ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4080
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4081
+ IpToCountry::Geoip Load (0.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4082
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4083
+ IpToCountry::Geoip Load (0.7ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4084
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4085
+ IpToCountry::Geoip Load (0.7ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4086
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4087
+ Connecting to database specified by database.yml
4088
+  (7.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
4089
+ Migrating to CreateGeoips (1)
4090
+ Unable to load geoip, underlying cause No such file to load -- geoip
4091
+
4092
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
4093
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
4094
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
4095
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
4096
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
4097
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
4098
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
4099
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
4100
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:28:in `<class:TestCase>'
4101
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:25:in `<top (required)>'
4102
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
4103
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
4104
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
4105
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
4106
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
4107
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
4108
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
4109
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
4110
+  (9.4ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
4111
+  (0.2ms) BEGIN
4112
+ Fixture Delete (10.6ms) DELETE FROM "geoips"
4113
+ Fixture Insert (71.1ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
4114
+  (90.0ms) COMMIT
4115
+  (0.3ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
4116
+  (0.2ms) BEGIN
4117
+ IpToCountry::Geoip Load (21.3ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4118
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4119
+  (0.2ms) ROLLBACK
4120
+  (0.1ms) BEGIN
4121
+  (0.1ms) ROLLBACK
4122
+  (0.1ms) BEGIN
4123
+  (0.1ms) ROLLBACK
4124
+  (0.1ms) BEGIN
4125
+  (0.1ms) ROLLBACK
4126
+  (0.1ms) BEGIN
4127
+  (209.1ms) DROP TABLE IF EXISTS geoips_tempo;
4128
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4129
+
4130
+  (1.2ms) ROLLBACK
4131
+  (0.1ms) BEGIN
4132
+  (0.2ms) ROLLBACK
4133
+  (0.1ms) BEGIN
4134
+  (24.7ms)  DROP TABLE IF EXISTS geoips_tempo;
4135
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4136
+ 
4137
+  (53.3ms) ALTER TABLE geoips RENAME TO tmp;
4138
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4139
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4140
+ DROP TABLE geoips_tempo;
4141
+
4142
+ IpToCountry::Geoip Load (1.3ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
4143
+ from geoips where ip_to >= 35037184)) LIMIT 1
4144
+  (1.3ms) ROLLBACK
4145
+  (0.1ms) BEGIN
4146
+  (0.2ms) ROLLBACK
4147
+  (0.2ms) BEGIN
4148
+  (23.2ms) DROP TABLE IF EXISTS geoips_tempo;
4149
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4150
+
4151
+  (2.5ms)  ALTER TABLE geoips RENAME TO tmp;
4152
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4153
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4154
+ DROP TABLE geoips_tempo;
4155
+ 
4156
+  (1.0ms) ROLLBACK
4157
+ IpToCountry::Geoip Load (1.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4158
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4159
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4160
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4161
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4162
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4163
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4164
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4165
+ Connecting to database specified by database.yml
4166
+  (0.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
4167
+ Migrating to CreateGeoips (1)
4168
+ Unable to load geoip, underlying cause No such file to load -- geoip
4169
+
4170
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
4171
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
4172
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
4173
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
4174
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
4175
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
4176
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
4177
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
4178
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:28:in `<class:TestCase>'
4179
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:25:in `<top (required)>'
4180
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
4181
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
4182
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
4183
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
4184
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
4185
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
4186
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
4187
+ /home/vince/.rvm/gems/ruby-1.9.3-head/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
4188
+  (0.3ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
4189
+  (0.2ms) BEGIN
4190
+ Fixture Delete (0.4ms) DELETE FROM "geoips"
4191
+ Fixture Insert (0.5ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
4192
+  (15.3ms) COMMIT
4193
+  (0.1ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
4194
+  (0.1ms) BEGIN
4195
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4196
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4197
+  (0.2ms) ROLLBACK
4198
+  (0.1ms) BEGIN
4199
+  (0.1ms) ROLLBACK
4200
+  (0.1ms) BEGIN
4201
+  (0.1ms) ROLLBACK
4202
+  (0.1ms) BEGIN
4203
+  (0.1ms) ROLLBACK
4204
+  (0.1ms) BEGIN
4205
+  (32.7ms) DROP TABLE IF EXISTS geoips_tempo;
4206
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4207
+
4208
+  (0.6ms) ROLLBACK
4209
+  (0.1ms) BEGIN
4210
+  (0.1ms) ROLLBACK
4211
+  (0.1ms) BEGIN
4212
+  (17.6ms)  DROP TABLE IF EXISTS geoips_tempo;
4213
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4214
+ 
4215
+  (1.6ms) ALTER TABLE geoips RENAME TO tmp;
4216
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4217
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4218
+ DROP TABLE geoips_tempo;
4219
+
4220
+ IpToCountry::Geoip Load (0.9ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
4221
+ from geoips where ip_to >= 35037184)) LIMIT 1
4222
+  (0.7ms) ROLLBACK
4223
+  (0.1ms) BEGIN
4224
+  (0.1ms) ROLLBACK
4225
+  (0.1ms) BEGIN
4226
+  (24.0ms) DROP TABLE IF EXISTS geoips_tempo;
4227
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4228
+
4229
+  (1.9ms)  ALTER TABLE geoips RENAME TO tmp;
4230
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4231
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4232
+ DROP TABLE geoips_tempo;
4233
+ 
4234
+  (0.8ms) ROLLBACK
4235
+ IpToCountry::Geoip Load (14.7ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4236
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4237
+ IpToCountry::Geoip Load (0.7ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4238
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4239
+ IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4240
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4241
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4242
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4243
+ Connecting to database specified by database.yml
4244
+  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
4245
+ Migrating to CreateGeoips (1)
4246
+ Unable to load geoip, underlying cause No such file to load -- geoip
4247
+
4248
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on'
4249
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
4250
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
4251
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:767:in `try_to_load_dependency'
4252
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:782:in `block in require_fixture_classes'
4253
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `each'
4254
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:779:in `require_fixture_classes'
4255
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.13/lib/active_record/fixtures.rb:762:in `fixtures'
4256
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:28:in `<class:TestCase>'
4257
+ /home/vince/Projets/ip_to_country/test/test_helper.rb:25:in `<top (required)>'
4258
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `require'
4259
+ /home/vince/Projets/ip_to_country/test/geoip_test.rb:2:in `<top (required)>'
4260
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `require'
4261
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
4262
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `each'
4263
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:9:in `block in <main>'
4264
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `select'
4265
+ /home/vince/.rvm/gems/ruby-2.0.0-p0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb:4:in `<main>'
4266
+  (0.3ms) ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "geoips" DISABLE TRIGGER ALL
4267
+  (0.1ms) BEGIN
4268
+ Fixture Delete (0.5ms) DELETE FROM "geoips"
4269
+ Fixture Insert (0.5ms) INSERT INTO "geoips" ("ip_from_string", "ip_to_string", "ip_from", "ip_to", "country_code", "country_name") VALUES ('192.168.1.1', '192.168.1.20', 3232235777, 3232235794, 'wd', 'wonderland')
4270
+  (22.9ms) COMMIT
4271
+  (0.2ms) ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "geoips" ENABLE TRIGGER ALL
4272
+  (0.1ms) BEGIN
4273
+ IpToCountry::Geoip Load (2.1ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4274
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4275
+  (0.3ms) ROLLBACK
4276
+  (0.1ms) BEGIN
4277
+  (0.1ms) ROLLBACK
4278
+  (0.1ms) BEGIN
4279
+  (0.1ms) ROLLBACK
4280
+  (0.1ms) BEGIN
4281
+  (0.1ms) ROLLBACK
4282
+  (0.1ms) BEGIN
4283
+  (31.9ms) DROP TABLE IF EXISTS geoips_tempo;
4284
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4285
+
4286
+  (0.7ms) ROLLBACK
4287
+  (0.1ms) BEGIN
4288
+  (0.2ms) ROLLBACK
4289
+  (0.1ms) BEGIN
4290
+  (15.4ms)  DROP TABLE IF EXISTS geoips_tempo;
4291
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4292
+ 
4293
+  (1.5ms) ALTER TABLE geoips RENAME TO tmp;
4294
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4295
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4296
+ DROP TABLE geoips_tempo;
4297
+
4298
+ IpToCountry::Geoip Load (0.8ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 35037184) and ip_to = (select min(ip_to)
4299
+ from geoips where ip_to >= 35037184)) LIMIT 1
4300
+  (0.6ms) ROLLBACK
4301
+  (0.1ms) BEGIN
4302
+  (0.2ms) ROLLBACK
4303
+  (0.2ms) BEGIN
4304
+  (40.7ms) DROP TABLE IF EXISTS geoips_tempo;
4305
+ CREATE TABLE geoips_tempo AS SELECT * FROM geoips WHERE ip_from = -1;
4306
+
4307
+  (2.0ms)  ALTER TABLE geoips RENAME TO tmp;
4308
+ ALTER TABLE geoips_tempo RENAME TO geoips;
4309
+ ALTER TABLE tmp RENAME TO geoips_tempo;
4310
+ DROP TABLE geoips_tempo;
4311
+ 
4312
+  (1.3ms) ROLLBACK
4313
+ IpToCountry::Geoip Load (16.6ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4314
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4315
+ IpToCountry::Geoip Load (1.3ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4316
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4317
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4318
+ from geoips where ip_to >= 3232235778)) LIMIT 1
4319
+ IpToCountry::Geoip Load (1.2ms) SELECT "geoips".* FROM "geoips" WHERE (ip_from = (select max(ip_from) from geoips where ip_from <= 3232235778) and ip_to = (select min(ip_to)
4320
+ from geoips where ip_to >= 3232235778)) LIMIT 1
@@ -4,6 +4,7 @@ ENV["RAILS_ENV"] = "test"
4
4
 
5
5
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
6
6
  require "rails/test_help"
7
+ require "simplecov"
7
8
  require 'coveralls'
8
9
  require "mocha/setup"
9
10
 
metadata CHANGED
@@ -1,28 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip_to_country
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Vincent Pochet
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-19 00:00:00.000000000 Z
11
+ date: 2013-04-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
- requirement: &14328020 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.2.12
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *14328020
25
- description: Simple tool to find the country of an ip address.
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.12
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ description: IpToCountry is a simple rails tool to determine the origin (ISO country
34
+ code or country name) of an IP address. The gem uses data from GeoLite by MaxMind.
26
35
  email:
27
36
  - vincent.pochet@gmail.com
28
37
  executables: []
@@ -81,28 +90,27 @@ files:
81
90
  - test/dummy/db/migrate/001_create_geoips.rb
82
91
  homepage: https://github.com/vincent-pochet/ip_to_country
83
92
  licenses: []
93
+ metadata: {}
84
94
  post_install_message:
85
95
  rdoc_options: []
86
96
  require_paths:
87
97
  - lib
88
98
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
99
  requirements:
91
- - - ! '>='
100
+ - - '>='
92
101
  - !ruby/object:Gem::Version
93
102
  version: '0'
94
103
  required_rubygems_version: !ruby/object:Gem::Requirement
95
- none: false
96
104
  requirements:
97
- - - ! '>='
105
+ - - '>='
98
106
  - !ruby/object:Gem::Version
99
107
  version: '0'
100
108
  requirements: []
101
109
  rubyforge_project:
102
- rubygems_version: 1.8.10
110
+ rubygems_version: 2.0.0.rc.2
103
111
  signing_key:
104
- specification_version: 3
105
- summary: Simple tool to find the country of an ip address
112
+ specification_version: 4
113
+ summary: Rails extension to get country name or country code from an IP address.
106
114
  test_files:
107
115
  - test/ip_to_country_test.rb
108
116
  - test/loader_test.rb