From cddcb68ba04118f029b0b5770fe3c30d725e8ed8 Mon Sep 17 00:00:00 2001 From: mathieuprog <5883963+mathieuprog@users.noreply.github.com> Date: Fri, 25 Jun 2021 12:07:43 +0200 Subject: [PATCH] Rename database_version/0 to iana_version/0 --- lib/compiler.ex | 2 +- lib/tz.ex | 2 +- lib/updater.ex | 2 +- lib/watch_periodically.ex | 2 +- test/time_zone_database_test.exs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/compiler.ex b/lib/compiler.ex index b5c59e5..c2a7386 100644 --- a/lib/compiler.ex +++ b/lib/compiler.ex @@ -75,7 +75,7 @@ defmodule Tz.Compiler do quote do @moduledoc(false) - def database_version() do + def iana_version() do unquote(tzdata_version) end end, diff --git a/lib/tz.ex b/lib/tz.ex index 12780cb..420e4c1 100644 --- a/lib/tz.ex +++ b/lib/tz.ex @@ -1,5 +1,5 @@ defmodule Tz do alias Tz.PeriodsProvider - defdelegate database_version(), to: PeriodsProvider + defdelegate iana_version(), to: PeriodsProvider end diff --git a/lib/updater.ex b/lib/updater.ex index effb2f4..82e93ba 100644 --- a/lib/updater.ex +++ b/lib/updater.ex @@ -14,7 +14,7 @@ defmodule Tz.Updater do saved_tz_version = get_latest_tz_database() - if saved_tz_version != PeriodsProvider.database_version() do + if saved_tz_version != PeriodsProvider.iana_version() do Logger.info("Tz is recompiling time zone periods...") Code.compiler_options(ignore_module_conflict: true) Compiler.compile() diff --git a/lib/watch_periodically.ex b/lib/watch_periodically.ex index 5c260d5..49a5c1c 100644 --- a/lib/watch_periodically.ex +++ b/lib/watch_periodically.ex @@ -10,7 +10,7 @@ defmodule Tz.WatchPeriodically do case Updater.fetch_iana_tz_version() do {:ok, latest_version} -> - if latest_version != PeriodsProvider.database_version() do + if latest_version != PeriodsProvider.iana_version() do link = "https://data.iana.org/time-zones/releases/tzdata#{latest_version}.tar.gz" Logger.warn("Tz found a more recent time zone database available for download at #{link}") end diff --git a/test/time_zone_database_test.exs b/test/time_zone_database_test.exs index 6b4d4ad..c3c8d5d 100644 --- a/test/time_zone_database_test.exs +++ b/test/time_zone_database_test.exs @@ -89,6 +89,6 @@ defmodule TimeZoneDatabaseTest do end test "version" do - assert "2021a" == Tz.database_version() + assert "2021a" == Tz.iana_version() end end