
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
CmGeocoder is a Ruby gem that provides IP-based geocoding functionality for Rails applications. It allows you to determine the country of origin for IP addresses using comprehensive IPv4 and IPv6 network mappings.
Add this line to your application's Gemfile:
gem 'cm-geocoder'
And then execute:
bundle install
CmGeocoder provides two main models:
CmGeoIpNetwork
CmGeoIpLocation
CmGeoIpNetwork
The gem provides several methods for IP-based geocoding:
# Get country ISO code for an IP address
CmGeoIpNetwork.geo_country_iso_code('192.0.2.1')
# Returns: 'US' (or nil if not found)
# Get country name for an IP address
CmGeoIpNetwork.geo_country_name('192.0.2.1')
# Returns: 'United States' (or nil if not found)
# Get full country information for an IP address
CmGeoIpNetwork.geo_country('192.0.2.1')
# Returns: CmGeoIpLocation object with attributes like:
# {
# id: 1,
# locale_code: "en",
# continent_code: "AS",
# continent_name: "Asia",
# country_iso_code: "IN",
# country_name: "India",
# is_in_european_union: false
# }
The gem provides database migrations for setting up the required tables. Run these migrations after installing the gem:
rails generate cm_geocoder:install
rails db:migrate
This will create:
cm_geo_ip_networks
table for storing IP network rangescm_geo_ip_locations
table for storing geolocation dataTo seed the IP data:
rake cm_geocoder:import_ip_data
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/commutatus/cm-geocoder. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the CmGeocoder project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that cm-geocoder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.