View Source Jellyfish.Releases.Appup (Jellyfish v0.2.5)
Generate appup files for hot upgrades
Copied and/or modified from https://github.com/bitwalker/distillery/blob/master/lib/distillery/releases/appups.ex
Summary
Types
An OTP application name.
The contents of a generated .appup file: {new_version, upgrades, downgrades}.
An appup version, as expected by the .appup format: either a version
string as a charlist, or a regular expression as a binary. The regex must
match the entire version string for an application, or it is rejected.
The purge mode used for a :update instruction.
Modules that must be loaded/updated before the module being instructed.
The instructions to run, per source version, when downgrading.
A single upgrade/downgrade instruction, as defined by the Erlang appup format.
A filesystem path to a release or build artifact directory.
The instructions to run, per source version, when upgrading.
A version string, such as "0.0.1".
Functions
Generate a .appup for the given application, start version, and upgrade version.
Types
@type app() :: atom()
An OTP application name.
@type appup() :: {appup_ver(), upgrade_instructions(), downgrade_instructions()}
The contents of a generated .appup file: {new_version, upgrades, downgrades}.
An appup version, as expected by the .appup format: either a version
string as a charlist, or a regular expression as a binary. The regex must
match the entire version string for an application, or it is rejected.
@type change() :: :soft | {:advanced, [term()]}
The purge mode used for a :update instruction.
@type dep_mods() :: [module()]
Modules that must be loaded/updated before the module being instructed.
@type downgrade_instructions() :: [{appup_ver(), instruction()}]
The instructions to run, per source version, when downgrading.
@type instruction() :: {:add_module, module()} | {:delete_module, module()} | {:update, module(), :supervisor | change()} | {:update, module(), change(), dep_mods()} | {:load_module, module()} | {:load_module, module(), dep_mods()} | {:apply, {module(), atom(), [term()]}} | {:add_application, atom()} | {:remove_application, atom()} | {:restart_application, atom()} | :restart_new_emulator | :restart_emulator
A single upgrade/downgrade instruction, as defined by the Erlang appup format.
@type path_str() :: String.t()
A filesystem path to a release or build artifact directory.
@type upgrade_instructions() :: [{appup_ver(), instruction()}]
The instructions to run, per source version, when upgrading.
@type version_str() :: String.t()
A version string, such as "0.0.1".
Functions
@spec make(app(), version_str(), version_str(), path_str(), path_str()) :: {:ok, appup()} | {:error, term()}
Generate a .appup for the given application, start version, and upgrade version.
Parameters
- application: the application name as an atom
- v1: the previous version, such as "0.0.1"
- v2: the new version, such as "0.0.2"
- v1_path: the path to the v1 artifacts (rel/<app>/lib/<app>-0.0.1)
- v2_path: the path to the v2 artifacts (_build/prod/lib/<app>)