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:
- The ReleaseManager.Config struct is aliased for you to just Config
debug/1
,info/1
,warn/1
,notice/1
, anderror/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↑
load_all() | Loads all plugins in all code paths |
load_plugins(paths) | Loads all plugins in the given |
Functions
Specs:
- load_all :: [] | [atom]
Loads all plugins in all code paths.
Specs:
- load_plugins([binary]) :: [] | [atom]
Loads all plugins in the given paths
.
Callbacks
Specs:
- after_release(ReleaseManager.Config.t) :: any
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