Mix.NervesHubCLI.Utils (nerves_hub_cli v0.11.1) View Source

Link to this section Summary

Functions

Return the path to the generated firmware bundle

Read the firmware metadata from the specified firmware bundle

Takes the integer serial representation of a certificate serial number and converts it to a hex string with : separators to match typical output from OpenSSL

Print the API endpoint that's being used to communicate with the NervesHub server

Split up a string of comma-separated tags

Turn map keys into strings

Link to this section Functions

Link to this function

fetch_metadata_item(metadata, key)

View Source

Specs

fetch_metadata_item(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, :not_found}

Specs

firmware() :: Path.t()

Return the path to the generated firmware bundle

Link to this function

get_metadata_item(metadata, key, default \\ nil)

View Source

Specs

get_metadata_item(String.t(), String.t(), any()) :: String.t() | nil

Specs

metadata(Path.t()) :: {:error, any()} | {:ok, map()}

Read the firmware metadata from the specified firmware bundle

Specs

org(keyword()) :: String.t()

Specs

product(keyword()) :: String.t()
Link to this function

serial_as_hex(serial_int)

View Source

Specs

serial_as_hex(binary() | integer()) :: binary()

Takes the integer serial representation of a certificate serial number and converts it to a hex string with : separators to match typical output from OpenSSL

Specs

show_api_endpoint() :: :ok

Print the API endpoint that's being used to communicate with the NervesHub server

Specs

split_tag_string(String.t()) :: [String.t()]

Split up a string of comma-separated tags

Invalid tags raise.

iex> Mix.NervesHubCLI.Utils.split_tag_string("a, b, c") ["a", "b", "c"]

iex> Mix.NervesHubCLI.Utils.split_tag_string("a space tag, b, c") ** (RuntimeError) Tag 'a space tag' should not contain white space

iex> Mix.NervesHubCLI.Utils.split_tag_string("\"tag_in_quotes\"") ** (RuntimeError) Tag '"tag_in_quotes"' should not contain quotes

Specs

stringify(map()) :: map()

Turn map keys into strings