deli v0.1.27 Deli.Command behaviour View Source

Run commands locally or remotely.

Defines a behaviour that application commands should implement.

Provides conveniences to use these commands.

Example

# lib/mix/tasks/my_app/my_app.xyz.ex
defmodule Mix.Tasks.MyApp.XYZ do
  use Mix.Task

  def run(args) do
    MyApp.Commands.XYZ |> Deli.Command.run(args)
  end
end

# lib/my_app/commands/my_command.ex
defmodule MyApp.Commands.XYZ do
  @behaviour Deli.Command

  @impl true
  def run(args) do
    # do actual work
  end
end

# executes locally by default
$ mix my_app.xyz --arg_example=1

# runs command in all prod hosts
$ mix my_app.xyz --arg_example=1 -t prod

Link to this section Summary

Functions

Either runs a command locally (dev), or through a RPC call to the remote target env

Fetches env from target (specified or default), and runs call/3

Link to this section Functions

Link to this function

call(env, mod, args) View Source
call(env :: atom(), module(), args :: [String.t()]) :: term()

Either runs a command locally (dev), or through a RPC call to the remote target env

Link to this function

run(command, args) View Source
run(module(), [String.t()]) :: :ok

Fetches env from target (specified or default), and runs call/3

Link to this section Callbacks