Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions mix_tasks/update_geoname_data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ defmodule Mix.Tasks.UpdateGeonameData do
The data source allCountries.txt clocks in at 1.5GB. Expect this to take a while.
"""
def run(_) do
# System.cmd("wget", [@allcountries_src, "-O", "/tmp/allCountries.zip"])
# System.cmd("unzip", ["/tmp/allCountries.zip", "-d", "/tmp"])
tmp_txt = Path.join(System.tmp_dir!(), "allCountries.txt")

process_geonames_file("/tmp/allCountries.txt")
unless File.exists?(tmp_txt) do
System.cmd("wget", [@allcountries_src, "-O", "/tmp/allCountries.zip"])
System.cmd("unzip", ["/tmp/allCountries.zip", "-d", "/tmp"])
end

process_geonames_file(tmp_txt)
end

defp process_geonames_file(filename) do
Expand Down