Skip to content

Commit

Permalink
Use YamlElixir 2.0 (#42)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sam Broughton authored and obmarg committed Apr 9, 2018
1 parent 29fdbbd commit 1bd30f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions lib/kazan/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 1bd30f0

Please sign in to comment.