exrm v1.0.8 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_package(%Config{} = config) 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 ReleaseManager.Config struct is aliased for you to just Config
  • 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_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

Functions

Loads all plugins in all code paths

Callbacks

A plugin needs to implement before_release/1, and after_release/1 both of which receive a %ReleaseManager.Config struct, as well as after_cleanup/1, which receives the arguments given for the command as a list of strings

Functions

load_all()

Specs

load_all :: [] | [atom]

Loads all plugins in all code paths.

Callbacks

after_cleanup(list)

Specs

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

Specs

after_package(ReleaseManager.Config.t) :: any
after_release(arg0)

Specs

after_release(ReleaseManager.Config.t) :: any
before_release(arg0)

Specs

before_release(ReleaseManager.Config.t) :: any

A plugin needs to implement before_release/1, and after_release/1 both of which receive a %ReleaseManager.Config struct, as well as after_cleanup/1, which receives the arguments given for the command as a list of strings.