geoipdb 0.5.5 → 0.5.6

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: bd4014a1f5219ad80dcc4edf0f2676cfe6a25c15
4
+ data.tar.gz: 9023e01afee88c14087ce533ba53a835db050153
5
+ SHA512:
6
+ metadata.gz: 051bf0ed38ea950a7ac3d738cbbce26f5dfa13d748c5d56a80676124ac8c82c950265bc937cffafcb615c84bc8a096aca2225ffa2625d14927a878ad8d822431
7
+ data.tar.gz: a86a82c253f1f1521adfc046765d3b3b6b57dec78ee9990d8f8666534c9db82a0faf99da8bdb58720cd2b4ce1802e74e38a72db2325859bfa03e68e3f01ae1c6
data/.gitignore CHANGED
@@ -12,6 +12,7 @@ ext/geoipdb/geoipdb.o
12
12
  ext/geoipdb/ipdb.o
13
13
  ext/geoipdb/test
14
14
  ext/geoipdb/test.o
15
+ lib/geoipdb.jar
15
16
  pkg
16
17
  rdoc
17
18
  tags
data/.rspec CHANGED
@@ -1 +1,2 @@
1
+ --require spec_helper
1
2
  --color
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - jruby
4
+ - 2.1.0
5
+ - 2.0.0
6
+ - 1.9.3
7
+ notifications:
8
+ email: false
9
+ hipchat:
10
+ rooms:
11
+ secure: RFtqDVDCk3BfP9yrVgToifCEbtEljndNWX61YCtsFXuCYihPODfii33HqEJ/CCZARuSMpomezOWsHP10+gT2VgRG8nfSQ6AIPLR1H2cs4uFtNN3WKd3I+LDF/GDua4rfEY8g4tZWFYTLbxgtpxD5rrGL6/ASLdAlKy33i/gTuPM=
data/Gemfile CHANGED
@@ -1,10 +1,9 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'liquid-ext'
2
6
 
3
7
  group :development, :test do
4
- gem 'bundler'
5
- gem 'rake'
6
- gem 'rake-compiler'
7
- gem 'rspec'
8
- gem 'simplecov'
9
- gem 'yard'
8
+ gem 'liquid-development'
10
9
  end
@@ -0,0 +1,40 @@
1
+ # geoipdb: fast (in memory!) geo location db.
2
+
3
+ Fast GeoIpDb implementation for Ruby using C/Java-Extensions.
4
+
5
+ * Returns a GeoLocation and additional information for a given IP.
6
+ * Reads Data from CSV-Files and uses internal binary caching.
7
+
8
+ [![Gem Version](https://badge.fury.io/rb/geoipdb.png)](http://badge.fury.io/rb/geoipdb)
9
+ [![Build Status](https://secure.travis-ci.org/liquidm/geoipdb.png)](http://travis-ci.org/liquidm/geoipdb)
10
+ [![Code Climate](https://codeclimate.com/github/liquidm/geoipdb.png)](https://codeclimate.com/github/liquidm/geoipdb)
11
+ [![Dependency Status](https://gemnasium.com/liquidm/geoipdb.png)](https://gemnasium.com/liquidm/geoipdb)
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'geoipdb'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install geoipdb
26
+
27
+ ## Usage
28
+
29
+ db = IpDb.init "city_codes.csv", "ip_city.txt", "ip_city.cache"
30
+ ip_info = db.information_for_ip("178.0.0.1")
31
+ ip_info.inspect
32
+ => #<IpInformation:0x101385c78 @city_name="eschborn", @city_code="ax5", @lng=8.55, @country_iso_code="de", @lat=50.133333, @is_mobile=true>
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it ( http://github.com/liquidm/geoipdb/fork )
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,7 +1,15 @@
1
- require 'bundler/setup'
2
- require 'bundler/gem_tasks'
1
+ require "bundler/setup"
2
+ require "bundler/gem_tasks"
3
+ require "liquid/tasks"
3
4
 
4
- Dir['tasks/**/*.rake'].each { |t| load t }
5
+ case RUBY_PLATFORM
6
+ when 'java'
7
+ require 'rake/javaextensiontask'
8
+ Rake::JavaExtensionTask.new('geoipdb')
9
+ else
10
+ require 'rake/extensiontask'
11
+ Rake::ExtensionTask.new('geoipdb')
12
+ end
5
13
 
6
14
  task :default => [:spec]
7
15
  task :build => :compile
@@ -74,7 +74,7 @@ VALUE build_ip_information_object(IpRange *range, City *city, char* isp) {
74
74
  rb_ivar_set(ip_information, rb_intern("@lng"), rb_float_new(city->lng) );
75
75
  rb_ivar_set(ip_information, rb_intern("@lat"), rb_float_new(city->lat) );
76
76
  rb_ivar_set(ip_information, rb_intern("@is_mobile"), range->is_mobile == 1 ? Qtrue : Qfalse );
77
- rb_ivar_set(ip_information, rb_intern("@isp_name"), isp == NULL ? Qnil : ID2SYM( rb_intern(isp) ) );
77
+ rb_ivar_set(ip_information, rb_intern("@isp_name"), isp == NULL || strcmp(isp, "?") == 0 ? Qnil : ID2SYM( rb_intern(isp) ) );
78
78
 
79
79
  return ip_information;
80
80
  }
@@ -1,28 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- Gem::Specification.new do |gem|
4
- gem.name = "geoipdb"
5
- gem.version = "0.5.5"
6
- gem.licenses = ["MIT"]
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "geoipdb"
5
+ spec.version = "0.5.6"
6
+ spec.authors = ["LiquidM, Inc."]
7
+ spec.email = ["opensource@liquidm.com"]
8
+ spec.description = "Fast GeoIpDb implementation for Ruby"
9
+ spec.summary = "Fast GeoIpDb implementation for Ruby"
10
+ spec.homepage = "http://github.com/liquidm/geoipdb"
11
+ spec.licenses = ["MIT"]
7
12
 
8
- gem.authors = ["Eugen Martin", "Martin Karlsch", "Thomas Hirsch", "Benedikt Böhm"]
9
- gem.email = ["eugeniusmartinus@googlemail.com", "martin.karlsch@madvertise.com", "thomas.hirsch@madvertise.com", "benedikt.boehm@madvertise.com"]
10
-
11
- gem.description = "Returns a GeoLocation and additional information for given IP. Reads Data from CSV-Files and uses internal binary caching."
12
- gem.summary = "Fast (>3 Mio queries/sec!!!) GeoIpDb implementation for Ruby using C-Extensions."
13
- gem.homepage = "http://github.com/madvertise/geoipdb"
14
-
15
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
- gem.files = `git ls-files`.split("\n")
17
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- gem.require_paths = ["lib", "ext"]
13
+ spec.files = `git ls-files`.split($/)
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib", "ext"]
19
17
 
20
18
  if RUBY_PLATFORM =~ /java/
21
- gem.platform = "java"
22
- gem.files << "lib/geoipdb.jar"
19
+ spec.platform = "java"
20
+ spec.files << "lib/geoipdb.jar"
23
21
  else
24
- gem.extensions = ["ext/geoipdb/extconf.rb"]
22
+ spec.extensions = ["ext/geoipdb/extconf.rb"]
25
23
  end
26
24
 
27
- gem.add_development_dependency "rake-compiler"
25
+ spec.add_development_dependency "rake-compiler"
28
26
  end
@@ -0,0 +1,2 @@
1
+ require 'rbconfig'
2
+ require File.expand_path('../geoipdb.so', __FILE__)
@@ -2,7 +2,6 @@ require 'ip_information'
2
2
 
3
3
  if defined?(JRUBY_VERSION)
4
4
  require 'jgeoipdb'
5
- require 'rbconfig'
6
5
  else
7
- require 'geoipdb/geoipdb'
6
+ require 'cgeoipdb'
8
7
  end
@@ -1,3 +1,4 @@
1
+ require 'rbconfig'
1
2
  require 'java'
2
3
  require File.expand_path('../geoipdb.jar', __FILE__)
3
4
 
@@ -28,15 +29,13 @@ class GeoIpDb
28
29
 
29
30
  def build_ip_information_object(range, city, isp)
30
31
  info = IpInformation.new
31
-
32
32
  info.country_iso_code = city.country_iso2
33
33
  info.city_name = city.name
34
34
  info.city_code = city.city_code
35
35
  info.lng = city.lng
36
36
  info.lat = city.lat
37
37
  info.is_mobile = range.is_mobile
38
- info.isp_name = isp && isp.to_sym
39
-
38
+ info.isp_name = isp ? isp.to_sym : :"?"
40
39
  info
41
40
  end
42
41
 
@@ -51,7 +51,7 @@ describe GeoIpDb do
51
51
  init_db
52
52
  @db.information_for_ip("1.0.0.1").isp_name.should == :vodafone
53
53
  @db.information_for_ip("1.1.1.1").isp_name.should == "1vodafone2vodafone3vodafone4vodafone5vodafone1vodafone2vodafone3vodafone4vodafone5vodafone1vodafone2vodafone3vodafone4vodafone5vodafone1vodafone2vodafone3vodafone4vodafone5vodafone"[0..99].to_sym
54
- @db.information_for_ip("1.2.1.1").isp_name.should == nil
54
+ @db.information_for_ip("1.2.1.1").isp_name.should == :"?"
55
55
  end
56
56
 
57
57
  it "should write and read the cachefile correctly"
metadata CHANGED
@@ -1,50 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoipdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
5
- prerelease:
4
+ version: 0.5.6
6
5
  platform: ruby
7
6
  authors:
8
- - Eugen Martin
9
- - Martin Karlsch
10
- - Thomas Hirsch
11
- - Benedikt Böhm
7
+ - LiquidM, Inc.
12
8
  autorequire:
13
9
  bindir: bin
14
10
  cert_chain: []
15
- date: 2013-01-17 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
16
12
  dependencies:
17
13
  - !ruby/object:Gem::Dependency
18
14
  name: rake-compiler
19
- requirement: &70164140517280 !ruby/object:Gem::Requirement
20
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
21
16
  requirements:
22
- - - ! '>='
17
+ - - ">="
23
18
  - !ruby/object:Gem::Version
24
19
  version: '0'
25
20
  type: :development
26
21
  prerelease: false
27
- version_requirements: *70164140517280
28
- description: Returns a GeoLocation and additional information for given IP. Reads
29
- Data from CSV-Files and uses internal binary caching.
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Fast GeoIpDb implementation for Ruby
30
28
  email:
31
- - eugeniusmartinus@googlemail.com
32
- - martin.karlsch@madvertise.com
33
- - thomas.hirsch@madvertise.com
34
- - benedikt.boehm@madvertise.com
29
+ - opensource@liquidm.com
35
30
  executables: []
36
31
  extensions:
37
32
  - ext/geoipdb/extconf.rb
38
33
  extra_rdoc_files: []
39
34
  files:
40
- - .document
41
- - .gitignore
42
- - .jrubyrc
43
- - .rspec
44
- - .rvmrc
35
+ - ".gitignore"
36
+ - ".rspec"
37
+ - ".travis.yml"
45
38
  - Gemfile
46
39
  - LICENSE.txt
47
- - README.markdown
40
+ - README.md
48
41
  - Rakefile
49
42
  - ext/geoipdb/extconf.rb
50
43
  - ext/geoipdb/geoipdb.c
@@ -55,7 +48,7 @@ files:
55
48
  - ext/geoipdb/src/GeoIpDb.java
56
49
  - ext/geoipdb/src/IpRange.java
57
50
  - geoipdb.gemspec
58
- - lib/geoipdb.jar
51
+ - lib/cgeoipdb.rb
59
52
  - lib/geoipdb.rb
60
53
  - lib/ip_information.rb
61
54
  - lib/jgeoipdb.rb
@@ -65,38 +58,31 @@ files:
65
58
  - sample_data/ip_ranges_corrupt.csv
66
59
  - spec/geoipdb_spec.rb
67
60
  - spec/spec_helper.rb
68
- - tasks/compile.rake
69
- - tasks/rspec.rake
70
- - tasks/yard.rake
71
- homepage: http://github.com/madvertise/geoipdb
61
+ homepage: http://github.com/liquidm/geoipdb
72
62
  licenses:
73
63
  - MIT
64
+ metadata: {}
74
65
  post_install_message:
75
66
  rdoc_options: []
76
67
  require_paths:
77
68
  - lib
78
69
  - ext
79
70
  required_ruby_version: !ruby/object:Gem::Requirement
80
- none: false
81
71
  requirements:
82
- - - ! '>='
72
+ - - ">="
83
73
  - !ruby/object:Gem::Version
84
74
  version: '0'
85
- segments:
86
- - 0
87
- hash: -2066128621521199120
88
75
  required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
76
  requirements:
91
- - - ! '>='
77
+ - - ">="
92
78
  - !ruby/object:Gem::Version
93
79
  version: '0'
94
80
  requirements: []
95
81
  rubyforge_project:
96
- rubygems_version: 1.8.17
82
+ rubygems_version: 2.2.0
97
83
  signing_key:
98
- specification_version: 3
99
- summary: Fast (>3 Mio queries/sec!!!) GeoIpDb implementation for Ruby using C-Extensions.
84
+ specification_version: 4
85
+ summary: Fast GeoIpDb implementation for Ruby
100
86
  test_files:
101
87
  - spec/geoipdb_spec.rb
102
88
  - spec/spec_helper.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.jrubyrc DELETED
@@ -1,12 +0,0 @@
1
- compat.version=1.9
2
- compile.mode=JIT
3
-
4
- cext.enabled=true
5
- native.enabled=true
6
- compile.invokedynamic=false
7
-
8
- invokedynamic.all=true
9
-
10
- errno.backtrace=true
11
-
12
- fiber.coroutines=false
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use --create jruby-1.7.2@geoipdb
@@ -1,18 +0,0 @@
1
- # geoipdb: fast (in memory!) geo location db.
2
-
3
- Fast (>3 Mio queries/sec!!!) GeoIpDb implementation for Ruby using C/Java-Extensions.
4
-
5
- * Returns a GeoLocation and additional information for a given IP.
6
- * Reads Data from CSV-Files and uses internal binary caching.
7
-
8
- ## Usage
9
-
10
- db = IpDb.init "city_codes.csv", "ip_city.txt", "ip_city.cache"
11
- ip_info = db.information_for_ip("178.0.0.1")
12
- ip_info.inspect
13
- => #<IpInformation:0x101385c78 @city_name="eschborn", @city_code="ax5", @lng=8.55, @country_iso_code="de", @lat=50.133333, @is_mobile=true>
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2010 madvertise GmbH. See LICENSE.txt for
18
- further details.
Binary file
@@ -1,8 +0,0 @@
1
- case RUBY_PLATFORM
2
- when 'java'
3
- require 'rake/javaextensiontask'
4
- Rake::JavaExtensionTask.new('geoipdb')
5
- else
6
- require 'rake/extensiontask'
7
- Rake::ExtensionTask.new('geoipdb')
8
- end
@@ -1,7 +0,0 @@
1
- require 'rspec'
2
- require 'rspec/core/rake_task'
3
-
4
- desc "Run the specs"
5
- RSpec::Core::RakeTask.new do |t|
6
- t.verbose = false
7
- end
@@ -1,5 +0,0 @@
1
- require 'yard'
2
-
3
- YARD::Rake::YardocTask.new do |t|
4
- t.files = ['lib/**/*.rb', 'README.rdoc']
5
- end