forked from da4nik/geoip2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
37 lines (32 loc) · 841 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require "rake/extensiontask"
require 'rake/testtask'
require 'bundler'
Bundler::GemHelper.install_tasks
Rake::ExtensionTask.new "maxmind_geoip2" do |ext|
ext.lib_dir = "lib/maxmind_geoip2"
end
Rake::TestTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
t.libs.push 'spec'
end
desc "Download free IP to City database"
task :download_free_database do
file = 'GeoLite2-City.mmdb'
if File.exist?(file)
puts "File already exists"
else
puts "Downloading file"
`curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz | gzip -d > #{file}`
end
end
desc "An IRB console with the project loaded"
task :console do
$: << 'lib'
require 'maxmind_geoip2'
MaxmindGeoIP2.file('GeoLite2-City.mmdb')
require 'irb'
require 'irb/completion'
ARGV.clear
IRB.start
end
task default: [:compile, :test]