geoipdb 0.5.5-java → 0.5.6-java

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 132f6fde9a253cfc08c90276c6ff39a6b03ba48a
4
+ data.tar.gz: 8abeb447c126c6011c817a34f6284fea52eb32db
5
+ SHA512:
6
+ metadata.gz: 70c1b265c2f42c0daf177b6c4f9c47e572f616fdc0ef63a30b558cdc1278d5100504b730770255c6534c250ffce8b567989ee0d5dc41d0740b0863ffd4f0a3df
7
+ data.tar.gz: 751b2acfdbaa3864ea689624eab464fed95d2a00cf3dcb731e559f73b89f9c55ff6b5e1b31c8ee3e9ad84ff6fe9738c1068d574b78a078f3be985b801e621b8f
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
data/.travis.yml ADDED
@@ -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
data/README.md ADDED
@@ -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
  }
data/geoipdb.gemspec CHANGED
@@ -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
data/lib/cgeoipdb.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'rbconfig'
2
+ require File.expand_path('../geoipdb.so', __FILE__)
data/lib/geoipdb.jar CHANGED
Binary file
data/lib/geoipdb.rb CHANGED
@@ -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
data/lib/jgeoipdb.rb CHANGED
@@ -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
 
data/spec/geoipdb_spec.rb CHANGED
@@ -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,55 +1,42 @@
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: java
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
15
  version_requirements: !ruby/object:Gem::Requirement
20
16
  requirements:
21
- - - ">="
17
+ - - '>='
22
18
  - !ruby/object:Gem::Version
23
- version: !binary |-
24
- MA==
25
- none: false
19
+ version: '0'
26
20
  requirement: !ruby/object:Gem::Requirement
27
21
  requirements:
28
- - - ">="
22
+ - - '>='
29
23
  - !ruby/object:Gem::Version
30
- version: !binary |-
31
- MA==
32
- none: false
24
+ version: '0'
33
25
  prerelease: false
34
26
  type: :development
35
- description: Returns a GeoLocation and additional information for given IP. Reads Data from CSV-Files and uses internal binary caching.
27
+ description: Fast GeoIpDb implementation for Ruby
36
28
  email:
37
- - eugeniusmartinus@googlemail.com
38
- - martin.karlsch@madvertise.com
39
- - thomas.hirsch@madvertise.com
40
- - benedikt.boehm@madvertise.com
29
+ - opensource@liquidm.com
41
30
  executables: []
42
31
  extensions: []
43
32
  extra_rdoc_files: []
44
33
  files:
45
- - ".document"
46
- - ".gitignore"
47
- - ".jrubyrc"
48
- - ".rspec"
49
- - ".rvmrc"
34
+ - .gitignore
35
+ - .rspec
36
+ - .travis.yml
50
37
  - Gemfile
51
38
  - LICENSE.txt
52
- - README.markdown
39
+ - README.md
53
40
  - Rakefile
54
41
  - ext/geoipdb/extconf.rb
55
42
  - ext/geoipdb/geoipdb.c
@@ -60,7 +47,7 @@ files:
60
47
  - ext/geoipdb/src/GeoIpDb.java
61
48
  - ext/geoipdb/src/IpRange.java
62
49
  - geoipdb.gemspec
63
- - lib/geoipdb.jar
50
+ - lib/cgeoipdb.rb
64
51
  - lib/geoipdb.rb
65
52
  - lib/ip_information.rb
66
53
  - lib/jgeoipdb.rb
@@ -70,12 +57,11 @@ files:
70
57
  - sample_data/ip_ranges_corrupt.csv
71
58
  - spec/geoipdb_spec.rb
72
59
  - spec/spec_helper.rb
73
- - tasks/compile.rake
74
- - tasks/rspec.rake
75
- - tasks/yard.rake
76
- homepage: http://github.com/madvertise/geoipdb
60
+ - lib/geoipdb.jar
61
+ homepage: http://github.com/liquidm/geoipdb
77
62
  licenses:
78
63
  - MIT
64
+ metadata: {}
79
65
  post_install_message:
80
66
  rdoc_options: []
81
67
  require_paths:
@@ -83,27 +69,20 @@ require_paths:
83
69
  - ext
84
70
  required_ruby_version: !ruby/object:Gem::Requirement
85
71
  requirements:
86
- - - ">="
72
+ - - '>='
87
73
  - !ruby/object:Gem::Version
88
- segments:
89
- - 0
90
- version: !binary |-
91
- MA==
92
- hash: 2
93
- none: false
74
+ version: '0'
94
75
  required_rubygems_version: !ruby/object:Gem::Requirement
95
76
  requirements:
96
- - - ">="
77
+ - - '>='
97
78
  - !ruby/object:Gem::Version
98
- version: !binary |-
99
- MA==
100
- none: false
79
+ version: '0'
101
80
  requirements: []
102
81
  rubyforge_project:
103
- rubygems_version: 1.8.24
82
+ rubygems_version: 2.1.9
104
83
  signing_key:
105
- specification_version: 3
106
- summary: Fast (>3 Mio queries/sec!!!) GeoIpDb implementation for Ruby using C-Extensions.
84
+ specification_version: 4
85
+ summary: Fast GeoIpDb implementation for Ruby
107
86
  test_files:
108
87
  - spec/geoipdb_spec.rb
109
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
data/README.markdown DELETED
@@ -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.
data/tasks/compile.rake DELETED
@@ -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
data/tasks/rspec.rake DELETED
@@ -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
data/tasks/yard.rake DELETED
@@ -1,5 +0,0 @@
1
- require 'yard'
2
-
3
- YARD::Rake::YardocTask.new do |t|
4
- t.files = ['lib/**/*.rb', 'README.rdoc']
5
- end