deli v0.1.28 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
# runs command in all prod hosts that match ~r/01/
$ mix my_app.xyz --arg_example=1 -t prod -h 01
Link to this section Summary
Link to this section Functions
Link to this function
call(env, mod, args)
View Source
call(env, mod, args)
View Source
call(Deli.env(), module(), OptionParser.argv()) :: :ok
call(Deli.env(), module(), OptionParser.argv()) :: :ok
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(command, args)
View Source
run(module(), OptionParser.argv()) :: :ok
run(module(), OptionParser.argv()) :: :ok
Fetches env from target (specified or default), and runs call/3
Link to this section Callbacks
Link to this callback
run(arg0)
View Source
run(arg0)
View Source
run(OptionParser.argv()) :: :ok
run(OptionParser.argv()) :: :ok