Adify v0.1.0 Adify.Environment.Operation

Represents the data related to an environment operation. An environment operation is when a tool is attempted to be installed or uninstalled.

Link to this section Summary

Link to this section Types

Link to this type

t()
t() :: %Adify.Environment.Operation{
  confirmation: term(),
  ended_at: term(),
  os: term(),
  output: term(),
  selected_installation_strategy: term(),
  started_at: term(),
  state: term(),
  tool: term()
}

Link to this section Functions

Link to this function

changeset(struct, params)

Link to this function

run(operation, ask_for_confirmation \\ true)
run(Adify.Environment.Operation.t(), boolean()) ::
  {:ok, term()} | {:error, term()}

Attempts to install tool

Examples:

iex> {:ok, tool} =
...>   Adify.YAML.parse_and_cast("./test/support/tools/valid/201907051629/tool.yaml")
iex> os_command = tool.os_commands
...>  |> Enum.find(& &1.os == "arch_linux")
iex> strategy = os_command.installation_strategies |> Enum.find(& &1.default)
iex> operation = %Adify.Environment.Operation{
...>   state: "new",
...>   os: "arch_linux",
...>   tool: tool,
...>   selected_installation_strategy: strategy
...> }
iex> {:ok, env} = Adify.Environment.Operation.run(operation, false)
iex> env.state == "completed"
true