Giter Site home page Giter Site logo

How to install about geoip2 HOT 9 CLOSED

da4nik avatar da4nik commented on July 16, 2024
How to install

from geoip2.

Comments (9)

da4nik avatar da4nik commented on July 16, 2024
  1. Install libmaxminddb
  2. Put into your Gemfile "gem 'geoip2', github: 'da4nik/geoip2'" or "gem 'geoip2', github: 'da4nik/geoip2' require: 'GeoIP2'"
  3. bundle install
  4. download local GeoLite2 database file
  5. use it

let me know if there are still questions.

from geoip2.

ericgriffis avatar ericgriffis commented on July 16, 2024

I had some issues installing this until I changed gem 'geoip2', github: 'da4nik/geoip2' to gem 'geoip2', github: 'da4nik/geoip2', require: 'GeoIP2' in my Gemfile. This is the only place in the repo where I found anything on setting the require option as such, so I'm wondering if this should be added to the Readme? Just a suggestion, thanks for the gem :)

from geoip2.

bitsofinfo avatar bitsofinfo commented on July 16, 2024

Basically I am trying to use this from within a fluentd plugin. At the top of my class I have "required 'Geoip2'

then in a method in my class I do GeoIP2::locate(....

and it errors with

NameError: uninitialized constant MyClass::GeoIP2

from geoip2.

bitsofinfo avatar bitsofinfo commented on July 16, 2024

Also tried a simple ruby file like your example and get

x.rb:3:in `

': uninitialized constant GeoIP2 (NameError)

require 'GeoIP2'

city = GeoIP2::locate('/patch/to/GeoLite2-City.mmdb', 'some.ip', 'en')

from geoip2.

da4nik avatar da4nik commented on July 16, 2024

Hey guys, i've just updated gem with autorequire fix and basic configuration.

from geoip2.

bitsofinfo avatar bitsofinfo commented on July 16, 2024

Pulled down the latest and did:

gem build geoip2.gemspec
Successfully built RubyGem
Name: geoip2
Version: 0.0.7
File: geoip2-0.0.7.gem

fluent-gem install geoip2-0.0.7.gem
Building native extensions. This could take a while...
Successfully installed geoip2-0.0.7
Parsing documentation for geoip2-0.0.7
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/GeoIP2.bundle, skipping
1 gem installed

Then when trying to run, (note this is not a rails project)

error_class=NameError error=NameError: uninitialized constant MyClassName::GeoIP2

My class does

require 'GeoIP2' at the top and then in an instance method

geoip = GeoIP2::locate('/my/path/GeoLite2-City.mmdb', someIpAddr, 'en')

from geoip2.

J-Swift avatar J-Swift commented on July 16, 2024

I've had to do

require 'geoip2.o'

In order to get the GeoIP2 constant exported correctly (OSX 10.9)

from geoip2.

da4nik avatar da4nik commented on July 16, 2024

Merged pull request for fixing this.

from geoip2.

thekindofme avatar thekindofme commented on July 16, 2024

TL;DR brew install libmaxminddb

from geoip2.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.