File: Rakefile

package info (click to toggle)
ruby-maxminddb 0.1.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 200 kB
  • sloc: ruby: 926; makefile: 3
file content (22 lines) | stat: -rw-r--r-- 830 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require "bundler/gem_tasks"
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

desc "Downloads maxmind free DBs if required"
task :ensure_maxmind_files do
  unless File.exist?('spec/cache/GeoLite2-City.mmdb')
    sh 'curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz -o spec/cache/GeoLite2-City.mmdb.gz'
    sh 'gunzip spec/cache/GeoLite2-City.mmdb.gz'
  end

  unless File.exist?('spec/cache/GeoLite2-Country.mmdb')
    sh 'curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz -o spec/cache/GeoLite2-Country.mmdb.gz'
    sh 'gunzip spec/cache/GeoLite2-Country.mmdb.gz'
  end
end

desc "Downloads maxmind free DBs if required and runs all specs"
task ensure_maxmind_files_and_spec: [:ensure_maxmind_files, :spec]

task default: :ensure_maxmind_files_and_spec