ReleaseManager.Plugin behaviour

This module provide a simple way to add additional steps to the release task.

You can define your own plugins using the sample definition below. Note that the module namespace must be nested under ReleaseManager.Plugin.*.

defmodule ReleaseManager.Plugin.Hello do
  use ReleaseManager.Plugin

  def before_release(%Config{} = config) do
    info "This is executed just prior to compiling the release"
  end

  def after_release(%Config{} = config) do
    info "This is executed just after compiling 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:

before_release/1 and after_release/1 are required callbacks, and will each be passed a Config struct, containing the configuration for the release task. You can choose to return the config 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 the final release task. The required callback after_cleanup/1 is passed the command line arguments. The return value is not used.

All plugins are executed just prior, and just after compiling the release, as the name of the callbacks reflect. The before_release/1 callback is called after some internal tasks, such as generating the sys.config and others.

Summary

load_all()

Loads all plugins in all code paths

load_plugins(paths)

Loads all plugins in the given paths

Functions

load_all()

Specs:

  • load_all :: [] | [atom]

Loads all plugins in all code paths.

load_plugins(paths)

Specs:

  • load_plugins([binary]) :: [] | [atom]

Loads all plugins in the given paths.

Callbacks

after_release/1

Specs:

before_release/1

Specs:

A plugin needs to implement before_release/1, and after_release/1 both of which receive a %ReleaseManager.Config struct