# Module reltool_util

- Description
- Function Index
- Function Details

### reltool Utility Functions

All the functions here are probably considered unorthodox, but are useful for runtime usage of applications and releases.

Copyright © 2013-2020 Michael Truog

Version: 2.0.1 Nov 26 2020 15:09:40 ------------------------------------------------------------------------

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### reltool Utility Functions

All the functions here are probably considered unorthodox, but are useful for runtime usage of applications and releases.

## Function Index

application_env/1 | #### Get the application's env settings. Only get the env settings from the application's .app file.
application_loaded/1 | #### Check if an application is currently loaded. .
application_modules/1 | #### Retrieve a list of application modules. .
application_modules/2 | #### Retrieve a list of application modules with filter options. Options can contain {behavior, ModuleName} to list all the modules that use a specific behaviour (the information will not be present if the beam file was stripped).
application_purged/1 | #### Purge a loaded application's modules and unload the application. The application is stopped if it is running, but its dependencies are ignored.
application_purged/2 | #### Purge a loaded application's modules and unload the application with a specific timeout. The application is stopped if it is running, but its dependencies are ignored.
application_remove/1 | #### Stop and purge the modules of an application and all of its dependencies. Only application dependencies that are not required for other applications are removed.
application_remove/2 | #### Stop and purge the modules of an application and all of its dependencies with a timeout. Only application dependencies that are not required for other applications are removed.
application_remove/3 | #### Stop and purge the modules of an application and all of its dependencies with a timeout and a list of applications to ignore. Only application dependencies that are not required for other applications are removed.
application_running/1 | #### Check if an application is currently running. .
application_running/2 | #### Check if an application is currently running with a timeout. .
application_start/1 | #### Start all the dependent applications manually. .
application_start/2 | #### Start all the dependent applications manually with a specific configuration. .
application_start/3 | #### Start all the dependent applications manually with a specific configuration and timeout. .
application_stop/1 | #### Stop an application and its dependencies. Only stop dependencies that are not required for other applications.
application_stop/2 | #### Stop an application and its dependencies with a list of applications to ignore. Only stop dependencies that are not required for other applications.
applications_remove/3 | #### Stop and purge the modules of all applications and their dependencies with a timeout and a list of applications to ignore. Only application dependencies that are not required for other applications are removed.
applications_start/1 | #### Start all the dependent applications manually. .
applications_start/2 | #### Start all the dependent applications manually. .
boot_remove/1 | #### Stop everything specified within a boot file. A boot file is used when first starting the Erlang VM.
boot_remove/2 | #### Stop everything specified within a boot file with a timeout. A boot file is used when first starting the Erlang VM.
boot_remove/3 | #### Stop everything specified within a boot file with a timeout and a list of applications to ignore. A boot file is used when first starting the Erlang VM.
boot_start/1 | #### Start everything specified within a boot file. A boot file is used when first starting the Erlang VM.
config_load/1 | #### Load a config file from a release. All applications with configuration values are loaded if they are not already loaded.
ensure_application_loaded/1 | #### Make sure an application is loaded. .
ensure_application_started/1 | #### Make sure an application is started. .
ensure_application_stopped/1 | #### Make sure an application is stopped. .
is_deprecated/3 | #### Check if a module function is marked as deprecated. The value false will always be returned if the beam file was stripped.
is_module_loaded/1 | #### Wait to check if a module is loaded. .
is_module_loaded/2 | #### Wait to check if a module is loaded. Return a new timeout value with the elapsed time subtracted.
module_behaviours/1 | #### List the behaviours used by a module. The information will not be present if the beam file was stripped.
module_exports/1 | #### List the exported functions of a module. .
module_load/1 | #### Load a module. .
module_loaded/1 | #### Make sure a module is loaded. If the module is not loaded, attempt to load it.
module_purged/1 | #### Make sure a module is purged. If the module is not loaded, ignore it.
module_purged/2 | #### Make sure a module is purged with a timeout. If the module is not loaded, ignore it.
module_reload/1 | #### Reload a module. .
module_unload/1 | #### Unload a module. .
module_version/1 | #### Provide the current version of the module. A list is returned with an entry for each use of the -vsn attribute in the order within the module file for the currently loaded version (the result is consistent with beam_lib:version/1).
modules_purged/2 | #### Make sure modules are purged with a timeout. If a module is not loaded, ignore it.
modules_reload/1 | #### Reload a list of modules. .
script_remove/1 | #### Stop everything specified within a script file. A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM.
script_remove/2 | #### Stop everything specified within a script file with a timeout. A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM.
script_remove/3 | #### Stop everything specified within a script file with a timeout and a list of applications to ignore. A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM.
script_start/1 | #### Start everything specified within a script file. A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM.

## Function Details

### application_env/1

`application_env(Application::atom()) -> {ok, [{atom(), any()}]} | {error, any()}`

#### Get the application's env settings.

Only get the env settings from the application's .app file.

### application_loaded/1

`application_loaded(Application::atom()) -> {ok, {atom(), string()}} | {error, {not_found, atom()}}`

#### Check if an application is currently loaded.

### application_modules/1

`application_modules(Application::atom()) -> {ok, [atom()]} | {error, {modules_missing, atom()}}`

#### Retrieve a list of application modules.

### application_modules/2

`application_modules(Application::atom(), Options::[{atom(), any()}]) -> {ok, [atom()]} | {error, {modules_missing, atom()}}`

#### Retrieve a list of application modules with filter options.

Options can contain {behavior, ModuleName} to list all the modules that use a specific behaviour (the information will not be present if the beam file was stripped).

### application_purged/1

`application_purged(Application::atom()) -> ok | {error, any()}`

#### Purge a loaded application's modules and unload the application.

The application is stopped if it is running, but its dependencies are ignored.

### application_purged/2

`application_purged(Application::atom(), Timeout::pos_integer() | infinity) -> ok | {error, any()}`

#### Purge a loaded application's modules and unload the application with a specific timeout.

The application is stopped if it is running, but its dependencies are ignored.

### application_remove/1

`application_remove(Application::atom()) -> ok | {error, any()}`

#### Stop and purge the modules of an application and all of its dependencies.

Only application dependencies that are not required for other applications are removed.

### application_remove/2

`application_remove(Application::atom(), Timeout::pos_integer() | infinity) -> ok | {error, any()}`

#### Stop and purge the modules of an application and all of its dependencies with a timeout.

Only application dependencies that are not required for other applications are removed.

### application_remove/3

`application_remove(Application::atom(), Timeout::pos_integer() | infinity, Ignore::[atom()]) -> ok | {error, any()}`

#### Stop and purge the modules of an application and all of its dependencies with a timeout and a list of applications to ignore.

Only application dependencies that are not required for other applications are removed.

### application_running/1

`application_running(Application::atom()) -> {ok, {atom(), string()}} | {error, application_controller_timeout | {not_found, atom()}}`

#### Check if an application is currently running.

### application_running/2

`application_running(Application::atom(), Timeout::pos_integer() | infinity) -> {ok, {atom(), string()}} | {error, application_controller_timeout | {not_found, atom()}}`

#### Check if an application is currently running with a timeout.

### application_start/1

`application_start(Application::atom()) -> ok | {error, any()}`

#### Start all the dependent applications manually.

### application_start/2

`application_start(Application::atom(), Env::[{atom(), any()}]) -> ok | {error, any()}`

#### Start all the dependent applications manually with a specific configuration.

### application_start/3

`application_start(Application::atom(), Env::[{atom(), any()}], Timeout::pos_integer() | infinity) -> ok | {error, any()}`

#### Start all the dependent applications manually with a specific configuration and timeout.

### application_stop/1

`application_stop(Application::atom()) -> ok | {error, any()}`

#### Stop an application and its dependencies.

Only stop dependencies that are not required for other applications.

### application_stop/2

`application_stop(Application::atom(), Ignore::[atom()]) -> ok | {error, any()}`

#### Stop an application and its dependencies with a list of applications to ignore.

Only stop dependencies that are not required for other applications.

### applications_remove/3

`applications_remove(Applications::[atom()], Timeout::pos_integer() | infinity, Ignore::[atom()]) -> ok | {error, any()}`

#### Stop and purge the modules of all applications and their dependencies with a timeout and a list of applications to ignore.

Only application dependencies that are not required for other applications are removed.

### applications_start/1

`applications_start(Applications::[atom() | {atom(), list()}, ...]) -> ok | {error, any()}`

#### Start all the dependent applications manually.

### applications_start/2

`applications_start(Applications::[atom() | {atom(), list()}, ...], Timeout::pos_integer() | infinity) -> ok | {error, any()}`

#### Start all the dependent applications manually.

### boot_remove/1

`boot_remove(FilePath::string()) -> ok | {error, any()}`

#### Stop everything specified within a boot file.

A boot file is used when first starting the Erlang VM. This function checks all applications to determine applications which can be safely removed (assuming the application dependencies are correct). The applications will then be stopped and their modules will be purged. Normally, only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The boot file is expected to be within a release directory created by reltool.

### boot_remove/2

`boot_remove(FilePath::string(), Timeout::pos_integer() | infinity) -> ok | {error, any()}`

#### Stop everything specified within a boot file with a timeout.

A boot file is used when first starting the Erlang VM. This function checks all applications to determine applications which can be safely removed (assuming the application dependencies are correct). The applications will then be stopped and their modules will be purged. Normally, only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The boot file is expected to be within a release directory created by reltool.

### boot_remove/3

`boot_remove(FilePath::string(), Timeout::pos_integer() | infinity, Ignore::[atom()]) -> ok | {error, any()}`

#### Stop everything specified within a boot file with a timeout and a list of applications to ignore.

A boot file is used when first starting the Erlang VM. This function checks all applications to determine applications which can be safely removed (assuming the application dependencies are correct). The applications will then be stopped and their modules will be purged. Normally, only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The boot file is expected to be within a release directory created by reltool.

### boot_start/1

`boot_start(FilePath::string()) -> {ok, [atom()]} | {error, any()}`

#### Start everything specified within a boot file.

A boot file is used when first starting the Erlang VM. This function checks all applications to determine if they are already running with the expected versions. All modules are checked to make sure they have been loaded, if they are expected to have been loaded. Normally, only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The boot file is expected to be within a release directory created by reltool.

### config_load/1

`config_load(FilePath::string()) -> {ok, [atom()]} | {error, any()}`

#### Load a config file from a release.

All applications with configuration values are loaded if they are not already loaded.

### ensure_application_loaded/1

`ensure_application_loaded(Application::atom()) -> ok | {error, any()}`

#### Make sure an application is loaded.

### ensure_application_started/1

`ensure_application_started(Application::atom()) -> ok | {error, any()}`

#### Make sure an application is started.

### ensure_application_stopped/1

`ensure_application_stopped(Application::atom()) -> ok | {error, any()}`

#### Make sure an application is stopped.

### is_deprecated/3

`is_deprecated(Module::module(), Function::atom(), Arity::non_neg_integer()) -> boolean()`

#### Check if a module function is marked as deprecated.

The value false will always be returned if the beam file was stripped.

### is_module_loaded/1

`is_module_loaded(Module::atom()) -> ok | {error, timeout}`

#### Wait to check if a module is loaded.

### is_module_loaded/2

`is_module_loaded(Module::atom(), Timeout::non_neg_integer()) -> {ok, non_neg_integer()} | {error, timeout}`

#### Wait to check if a module is loaded.

Return a new timeout value with the elapsed time subtracted.

### module_behaviours/1

`module_behaviours(Module::module()) -> [module()]`

#### List the behaviours used by a module.

The information will not be present if the beam file was stripped.

### module_exports/1

`module_exports(Module::atom()) -> [{atom(), pos_integer()}]`

#### List the exported functions of a module.

### module_load/1

`module_load(Module::atom()) -> ok | {error, badfile | nofile | not_purged | on_load_failure | sticky_directory}`

#### Load a module.

### module_loaded/1

`module_loaded(Module::atom()) -> ok | {error, badfile | nofile | not_purged | on_load_failure | sticky_directory}`

#### Make sure a module is loaded.

If the module is not loaded, attempt to load it.

### module_purged/1

`module_purged(Module::atom()) -> ok | {error, timeout}`

#### Make sure a module is purged.

If the module is not loaded, ignore it.

### module_purged/2

`module_purged(Module::atom(), Timeout::non_neg_integer() | infinity) -> ok | {error, timeout}`

#### Make sure a module is purged with a timeout.

If the module is not loaded, ignore it.

### module_reload/1

`module_reload(Module::atom()) -> ok | {error, badfile | nofile | not_purged | on_load_failure | sticky_directory}`

#### Reload a module.

### module_unload/1

`module_unload(Module::atom()) -> ok | {error, not_loaded | not_unloaded}`

#### Unload a module.

### module_version/1

`module_version(Module::atom()) -> [any()]`

#### Provide the current version of the module.

A list is returned with an entry for each use of the -vsn attribute in the order within the module file for the currently loaded version (the result is consistent with beam_lib:version/1). The information will not be present if the beam file was stripped.

### modules_purged/2

`modules_purged(Modules::[atom()], Timeout::non_neg_integer() | infinity) -> ok | {error, timeout}`

#### Make sure modules are purged with a timeout.

If a module is not loaded, ignore it.

### modules_reload/1

`modules_reload(Modules::[atom(), ...]) -> ok | {error, any()}`

#### Reload a list of modules.

### script_remove/1

`script_remove(FilePath::string()) -> ok | {error, any()}`

#### Stop everything specified within a script file.

A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM. This function checks all applications to determine applications which can be safely removed (assuming the application dependencies are correct). The applications will then be stopped and their modules will be purged. Normally, the script is only used in the binary boot file format and only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The script file is expected to be within a release directory created by reltool.

### script_remove/2

`script_remove(FilePath::string(), Timeout::pos_integer() | infinity) -> ok | {error, any()}`

#### Stop everything specified within a script file with a timeout.

A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM. This function checks all applications to determine applications which can be safely removed (assuming the application dependencies are correct). The applications will then be stopped and their modules will be purged. Normally, the script is only used in the binary boot file format and only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The script file is expected to be within a release directory created by reltool.

### script_remove/3

`script_remove(FilePath::string(), Timeout::pos_integer() | infinity, Ignore::[atom()]) -> ok | {error, any()}`

#### Stop everything specified within a script file with a timeout and a list of applications to ignore.

A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM. This function checks all applications to determine applications which can be safely removed (assuming the application dependencies are correct). The applications will then be stopped and their modules will be purged. Normally, the script is only used in the binary boot file format and only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The script file is expected to be within a release directory created by reltool.

### script_start/1

`script_start(FilePath::string()) -> {ok, [atom()]} | {error, any()}`

#### Start everything specified within a script file.

A script file is the input used when creating a boot file, which is the file used when first starting the Erlang VM. This function checks all applications to determine if they are already running with the expected versions. All modules are checked to make sure they have been loaded, if they are expected to have been loaded. Normally, the script is only used in the binary boot file format and only a single boot file is used during the lifetime of the Erlang VM (so it is unclear if using this function is bad or just unorthodox). The script file is expected to be within a release directory created by reltool.

Generated by EDoc