ReleaseManager.Utils

This module provides helper functions for the mix release and mix release.clean tasks.

Summary

Exits with exit status 1

Change user permissions for a target file or directory

Print an informational message without color

Print an error message in red

Get the local paths of the current Elixir libraries

Get the most recent release prior to the current one

Get a list of tuples representing the previous releases:

Print an informational message in green

Load the current project’s configuration

Merges two sets of Elixir/Erlang terms, where the terms come in the form of lists of tuples. For example, such as is found in the relx.config file

Call the _elixir mix binary with the given arguments

Print a notice in yellow

Get the priv path of the exrm dependency

Reads a file as Erlang terms

Get the rel path of the current project

Get the path to a file located in the rel directory of the current project. You can pass either a file name, or a list of directories to a file, like:

Get the rel/files path of the current project

Get the path to a file located in the rel/files directory of the current project. You can pass either a file name, or a list of directories to a file, like:

Get the priv/rel/files path of the exrm dependency

Get the path to a file located in priv/rel/files of the exrm dependency

Get the priv/rel path of the exrm dependency

Get the path to a file located in priv/rel of the exrm dependency

Sort a list of versions, latest one first. Tries to use semver version compare, but can fall back to regular string compare

Convert a string to Erlang terms

Print a warning message in yellow

Perform some actions within the context of a specific mix environment

Writes an Elixir/Erlang term to the provided path

Writes a collection of Elixir/Erlang terms to the provided path

Functions

abort!()

Exits with exit status 1

chmod(target, mode)

Change user permissions for a target file or directory

debug(message)

Print an informational message without color

error(message)

Print an error message in red

get_elixir_lib_paths()

Get the local paths of the current Elixir libraries

get_last_release(project)

Get the most recent release prior to the current one

get_releases(project)

Get a list of tuples representing the previous releases:

Examples

get_releases #=> [{"test", "0.0.1"}, {"test", "0.0.2"}]
info(message)

Print an informational message in green

load_config(env)

Load the current project’s configuration

merge(old, new)

Merges two sets of Elixir/Erlang terms, where the terms come in the form of lists of tuples. For example, such as is found in the relx.config file

mix(command, env)

Call the _elixir mix binary with the given arguments

mix(command, env, atom)
notice(message)

Print a notice in yellow

priv_path()

Get the priv path of the exrm dependency

read_terms(path)

Reads a file as Erlang terms

rel_dest_path()

Get the rel path of the current project.

rel_dest_path(files)

Get the path to a file located in the rel directory of the current project. You can pass either a file name, or a list of directories to a file, like:

iex> ReleaseManager.Utils.rel_dest_path "relx.config"
"path/to/project/rel/relx.config"

iex> ReleaseManager.Utils.rel_dest_path ["<project>", "lib", "<project>.appup"]
"path/to/project/rel/<project>/lib/<project>.appup"
rel_file_dest_path()

Get the rel/files path of the current project.

rel_file_dest_path(files)

Get the path to a file located in the rel/files directory of the current project. You can pass either a file name, or a list of directories to a file, like:

iex> ReleaseManager.Utils.rel_file_dest_path "sys.config"
"path/to/project/rel/files/sys.config"

iex> ReleaseManager.Utils.rel_dest_path ["some", "path", "file.txt"]
"path/to/project/rel/files/some/path/file.txt"
rel_file_source_path()

Get the priv/rel/files path of the exrm dependency

rel_file_source_path(file)

Get the path to a file located in priv/rel/files of the exrm dependency

rel_source_path()

Get the priv/rel path of the exrm dependency

rel_source_path(file)

Get the path to a file located in priv/rel of the exrm dependency

relx(name, version, verbosity, upgrade?, dev_mode?)

Execute relx

sort_versions(versions)

Sort a list of versions, latest one first. Tries to use semver version compare, but can fall back to regular string compare.

string_to_terms(str)

Convert a string to Erlang terms

warn(message)

Print a warning message in yellow

with_env(env, fun)

Perform some actions within the context of a specific mix environment

write_term(path, term)

Writes an Elixir/Erlang term to the provided path

write_terms(path, terms)

Writes a collection of Elixir/Erlang terms to the provided path