From 1bd30f04ba90866301969d36097952cd11edfc45 Mon Sep 17 00:00:00 2001 From: Sam Broughton Date: Mon, 9 Apr 2018 18:51:12 +0100 Subject: [PATCH] Use YamlElixir 2.0 (#42) YamlElixir 2.0 is functionally identical to 1.3, except for the breaking API change which was initially introduced in 1.4. Updating the version constraint to 2.0 allows us to remove the 1.3/1.4 negotiation hack. --- lib/kazan/server.ex | 14 +------------- mix.exs | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/kazan/server.ex b/lib/kazan/server.ex index b33f6ec..cb9c07a 100644 --- a/lib/kazan/server.ex +++ b/lib/kazan/server.ex @@ -34,19 +34,7 @@ defmodule Kazan.Server do """ @spec from_kubeconfig(String.t(), Keyword.t()) :: t def from_kubeconfig(config_file, options \\ []) do - # YamlElixir made a breaking change in a minor version, so we need to make - # sure we call the appropriate function for the version installed. - # Can hopefully get rid of this at some point. - Code.ensure_loaded(YamlElixir) - - func = - if Kernel.function_exported?(YamlElixir, :read_from_file!, 1) do - :read_from_file! - else - :read_from_file - end - - data = apply(YamlElixir, func, [config_file]) + data = YamlElixir.read_from_file!(config_file) basepath = config_file |> Path.absname() |> Path.dirname() diff --git a/mix.exs b/mix.exs index 125e79c..16ad924 100644 --- a/mix.exs +++ b/mix.exs @@ -41,7 +41,7 @@ defmodule Kazan.Mixfile do defp deps do [{:poison, "~> 2.0 or ~> 3.0"}, {:httpoison, "~> 0.10 or ~> 1.0"}, - {:yaml_elixir, "~> 1.3"}, + {:yaml_elixir, "~> 2.0"}, # Dev dependencies {:ex_doc, "~> 0.14", only: :dev},