lib/europe/tasks/eurostat.rake in europe-0.0.15 vs lib/europe/tasks/eurostat.rake in europe-0.0.16

- old
+ new

@@ -1,17 +1,17 @@ # frozen_string_literal: true require 'open-uri' namespace :eurostat do - EUROSTAT_BULK_URL = 'http://ec.europa.eu/eurostat/' \ - 'estat-navtree-portlet-prod/BulkDownloadListing' \ - '?sort=1&file=' - desc 'Download categories from Eurostat Bulk Facility' task :download_categories do + eurostat_bulk_url = 'http://ec.europa.eu/eurostat/' \ + 'estat-navtree-portlet-prod/BulkDownloadListing' \ + '?sort=1&file=' + data = Net::HTTP.get_response( - URI.parse(EUROSTAT_BULK_URL + 'table_of_contents_en.txt') + URI.parse("#{eurostat_bulk_url}table_of_contents_en.txt") ).body File.open('cat.txt', 'w') do |f| IO.copy_stream(data, f) end end