Module: DamnWeather

Defined in:
lib/damn_weather.rb,
lib/damn_weather/now.rb,
lib/damn_weather/version.rb,
lib/damn_weather/weather.rb,
lib/damn_weather/forecast.rb

Defined Under Namespace

Modules: Weather Classes: Forecast, Now

Constant Summary collapse

VERSION =
"0.1.3"

Instance Method Summary collapse

Instance Method Details

#db_file_checkObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/damn_weather.rb', line 14

def db_file_check
  gem_root = Gem::Specification.find_by_name('mm_geoip').gem_dir
  db_file = "#{gem_root}/data/GeoLiteCity.dat"
  unless File.exist?(db_file)
    puts "\xF0\x9F\x9A\xA7  Downloading database file... (This may take a while)"
    open(db_file, 'w') do |local_file|
      open('http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz') do |remote_file|
        local_file.write(Zlib::GzipReader.new(remote_file).read)
      end
    end
  end
end