diff --git a/.travis.yml b/.travis.yml index b6903bd..e991dcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,15 @@ language: ruby rvm: - - 1.9.3 - - 2.0 - - 2.1 - - 2.2 - - 2.3 - - 2.4.5 - - 2.5.3 - - 2.6.0 - - jruby-19mode - +- 2.4 +- 2.5 +- 2.6 +- 2.7 script: bundle exec rake - before_install: - - gem update bundler - +- gem update bundler cache: directories: - - spec/cache + - spec/cache +env: + global: + secure: VCgYOWeLKAAiXnLw3vWLs8PRbSg4pPLeLZPbBCIRUQKqttzL6pEL28lkB/05YVbu1v9wQxogtk0zv+ZacJK0SbIL96BHVrCaRebWik5A8UOoOGTanTQj0SRCCmacrOm3EhWF9t262uv31byAdw73S08jCPIYd2JqA5IOrcJYJ0Y= diff --git a/Rakefile b/Rakefile index 831db08..e6b2f89 100644 --- a/Rakefile +++ b/Rakefile @@ -6,13 +6,27 @@ 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' + sh "curl 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz&license_key=#{ENV['API_KEY']}' -o spec/cache/GeoLite2-City.mmdb.tar.gz" + sh 'tar zxvf spec/cache/GeoLite2-City.mmdb.tar.gz *.mmdb' + src = %x{tar ztf spec/cache/GeoLite2-City.mmdb.tar.gz *.mmdb}.strip + dir = %x{dirname `tar ztf spec/cache/GeoLite2-City.mmdb.tar.gz *.mmdb`} + fname = %x{basename `tar ztf spec/cache/GeoLite2-City.mmdb.tar.gz *.mmdb`} + dst = ('spec/cache/' + fname).strip + sh "mv #{src} #{dst}" + sh "rmdir #{dir}" + sh 'rm spec/cache/GeoLite2-City.mmdb.tar.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' + sh "curl 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&suffix=tar.gz&license_key=#{ENV['API_KEY']}' -o spec/cache/GeoLite2-Country.mmdb.tar.gz" + sh 'tar zxvf spec/cache/GeoLite2-Country.mmdb.tar.gz *.mmdb' + src = %x{tar ztf spec/cache/GeoLite2-Country.mmdb.tar.gz *.mmdb}.strip + dir = %x{dirname `tar ztf spec/cache/GeoLite2-Country.mmdb.tar.gz *.mmdb`} + fname = %x{basename `tar ztf spec/cache/GeoLite2-Country.mmdb.tar.gz *.mmdb`} + dst = ('spec/cache/' + fname).strip + sh "mv #{src} #{dst}" + sh "rmdir #{dir}" + sh 'rm spec/cache/GeoLite2-Country.mmdb.tar.gz' end end diff --git a/spec/maxminddb_spec.rb b/spec/maxminddb_spec.rb index ac2fed8..e370134 100644 --- a/spec/maxminddb_spec.rb +++ b/spec/maxminddb_spec.rb @@ -27,8 +27,8 @@ expect(city_db.lookup(ip).city.name).to eq('Mountain View') end - it 'returns -122.0775 as the longitude' do - expect(city_db.lookup(ip).location.longitude).to eq(-122.0775) + it 'returns -122.0748 as the longitude' do + expect(city_db.lookup(ip).location.longitude).to eq(-122.0748) end it 'returns nil for is_anonymous_proxy' do @@ -160,8 +160,8 @@ expect(city_db.lookup(ip).city.name).to eq('Mountain View') end - it 'returns -122.0775 as the longitude' do - expect(city_db.lookup(ip).location.longitude).to eq(-122.0775) + it 'returns -122.0748 as the longitude' do + expect(city_db.lookup(ip).location.longitude).to eq(-122.0748) end it 'returns nil for is_anonymous_proxy' do