distillery v0.7.1 Mix.Releases.Plugin behaviour

This module provides a simple way to add additional processing to phases of the release assembly and archival.

You can define your own plugins using the sample definition below. Note that

defmodule MyApp.PluginDemo do
  use Mix.Releases.Plugin

  def before_assembly(%Release{} = release) do
    info "This is executed just prior to assembling the release"
  end

  def after_assembly(%Release{} = release) do
    info "This is executed just after assembling, and just prior to packaging the release"
  end

  def after_package(%Release{} = release) do
    info "This is executed just after packaging the release"
  end

  def after_cleanup(_args) do
    info "This is executed just after running cleanup"
  end
end

A couple things are imported or aliased for you. Those things are:

  • The Mix.Releases.Release struct is aliased for you to just Release
  • debug/1, info/1, warn/1, notice/1, and error/1 are imported for you. These should be used to do any output for the user.

before_assembly/1 and after_assembly/1 will each be passed a Release struct, containing the configuration for the release task, after the environment configuration has been merged into it. You can choose to return the struct modified or unmodified, or not at all. In the former case, any modifications you made will be passed on to the remaining plugins and then used during assembly/archival. The required callback after_cleanup/1 is passed the command line arguments. The return value is not used.

Summary

Functions

Runs after_assembly with all plugins

Runs after_cleanup with all plugins

Runs after_package with all plugins

Runs before_assembly with all plugins

Runs before_package with all plugins

Loads all plugins in all code paths

Types

predicate :: (term -> boolean)

Functions

after_assembly(release)

Specs

after_assembly(Mix.Releases.Release.t) ::
  {:ok, Mix.Releases.Release.t} |
  {:error, term}

Runs after_assembly with all plugins.

after_cleanup(args)

Specs

after_cleanup([String.t]) :: :ok | {:error, term}

Runs after_cleanup with all plugins.

after_package(release)

Specs

after_package(Mix.Releases.Release.t) ::
  {:ok, Mix.Releases.Release.t} |
  {:error, term}

Runs after_package with all plugins.

before_assembly(release)

Specs

before_assembly(Mix.Releases.Release.t) ::
  {:ok, Mix.Releases.Release.t} |
  {:error, term}

Runs before_assembly with all plugins.

before_package(release)

Specs

before_package(Mix.Releases.Release.t) ::
  {:ok, Mix.Releases.Release.t} |
  {:error, term}

Runs before_package with all plugins.

call(list, callback, state, predicate)
load_all()

Specs

load_all :: [] | [atom]

Loads all plugins in all code paths.

run(callback, state)

Specs

run(atom, term) ::
  :ok |
  {:error, {:plugin_failed, term}}
run(list, callback, state)

Callbacks

after_assembly(arg0)

Specs

after_assembly(Mix.Releases.Release.t) :: any
after_cleanup(list)

Specs

after_cleanup([String.t]) :: any
after_package(arg0)

Specs

after_package(Mix.Releases.Release.t) :: any
before_assembly(arg0)

Specs

before_assembly(Mix.Releases.Release.t) :: any