jam-cloud/web/lib/tasks/import_max_mind.rake

34 lines
1.3 KiB
Ruby
Raw Normal View History

2012-11-30 09:36:41 +00:00
namespace :db do
desc "Import a maxmind geo (139) database; run like this: rake db:import_maxmind_geo file=<path_to_GeoIPCity.csv>"
task import_maxmind_geo: :environment do
MaxMindGeo.import_from_max_mind ENV['file']
end
desc "Import a maxmind isp (142) database; run like this: rake db:import_maxmind_isp file=<path_to_GeoIPISP-142.csv>"
task import_maxmind_isp: :environment do
MaxMindIsp.import_from_max_mind ENV['file']
2012-11-30 09:36:41 +00:00
end
desc "Import a maxmind blocks (134) database; run like this: rake db:import_geoip_blocks file=<path_to_GeoIPCity-134-Blocks.csv>"
task import_geoip_blocks: :environment do
GeoIpBlocks.import_from_max_mind ENV['file']
end
desc "Import a maxmind locations (134) database; run like this: rake db:import_geoip_locations file=<path_to_GeoIPCity-134-Location.csv>"
task import_geoip_locations: :environment do
GeoIpLocations.import_from_max_mind ENV['file']
end
desc "Import a maxmind isp (124) database; run like this: rake db:import_jam_isp file=<path_to_GeoIPISP.csv>"
task import_jam_isp: :environment do
JamIsp.import_from_max_mind ENV['file']
end
2012-11-30 09:36:41 +00:00
desc "Create a fake set of maxmind data"
task phony_maxmind: :environment do
2012-11-30 09:36:41 +00:00
MaxMindManager.active_record_transaction do |manager|
manager.create_phony_database()
end
end
end