Skip to content

Commit

Permalink
Update Elixir and Erlang versions (#1693)
Browse files Browse the repository at this point in the history
Elixir 1.18.0
Erlang 27.1.3
  • Loading branch information
joshk authored Dec 20, 2024
1 parent bb8bf3e commit b24b686
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nodejs 16.18.1
python 3.10.13
elixir 1.17.2-otp-27
erlang 27.0.1
elixir 1.18.0
erlang 27.1.3
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG ELIXIR_VERSION=1.17.2
ARG OTP_VERSION=27.0.1
ARG DISTRO=noble-20240605
ARG ELIXIR_VERSION=1.18.0
ARG OTP_VERSION=27.1.3
ARG DISTRO=noble-20241015
ARG NODE_VERSION=16.20.2

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-ubuntu-${DISTRO}"
Expand Down
3 changes: 1 addition & 2 deletions lib/nerves_hub/extensions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ defmodule NervesHub.Extensions do
@supported_extensions
end

@spec module(extension()) :: module() | :unsupported
@spec module(extension()) :: module()
def module(:health), do: NervesHub.Extensions.Health
def module(:geo), do: NervesHub.Extensions.Geo
def module(_key), do: :unsupported

@spec module(extension(), Version.t()) :: module() | :unsupported
def module(:health, ver) do
Expand Down
14 changes: 12 additions & 2 deletions lib/nerves_hub/fwup.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ defmodule NervesHub.Fwup do
misc: String.t(),
vcs_identifier: String.t()
}

def keys() do
blank_values =
Enum.reduce(@enforce_keys, %{}, fn key, acc ->
Map.put(acc, key, nil)
end)

struct!(Metadata, blank_values)
|> Map.from_struct()
|> Map.keys()
end
end

@doc """
Expand Down Expand Up @@ -70,8 +81,7 @@ defmodule NervesHub.Fwup do
end

defp transform_to_struct(metadata) do
keys = Map.keys(Map.from_struct(Metadata))
filtered = Map.take(metadata, keys)
filtered = Map.take(metadata, Metadata.keys())
{:ok, struct!(Metadata, filtered)}
rescue
_ -> {:error, :invalid_metadata}
Expand Down
4 changes: 2 additions & 2 deletions lib/nerves_hub_web/components/ca_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ defmodule NervesHubWeb.Components.CAHelpers do
def certificate_status(assigns) do
status =
cond do
assigns.not_after > DateTime.utc_now() ->
DateTime.compare(assigns.not_after, DateTime.utc_now()) == :gt ->
"Expired"

assigns.not_after > DateTime.shift(DateTime.utc_now(), month: -3) ->
DateTime.compare(assigns.not_after, DateTime.shift(DateTime.utc_now(), month: -3)) == :gt ->
"Expiring Soon"

true ->
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule NervesHub.MixProject do
docs: :docs
],
elixirc_paths: elixirc_paths(Mix.env()),
elixir: "~> 1.17.2",
elixir: "~> 1.18.0",
releases: [
nerves_hub: [
steps: [:assemble],
Expand Down

0 comments on commit b24b686

Please sign in to comment.