View Source ApplicationX (CommonX v0.5.9)

Application module extended functions.

Link to this section Summary

Functions

List all available applications excluding system ones.

List all dependant applications excluding system ones. Does includes the given application.

The atom of the current main application.

The mix configuration of the current main application.

Get the current Mix environment.

List all available modules excluding system ones.

List all available modules for the given app[s] and dependencies of those apps. This excludes system modules.

Link to this section Functions

@spec applications() :: [atom()]

List all available applications excluding system ones.

This function is save to run in Mix.Tasks.

example

Example

Since :common_x does not have any dependencies:

iex> ApplicationX.applications
[:common_x]
@spec applications(atom() | [atom()]) :: [atom()]

List all dependant applications excluding system ones. Does includes the given application.

This function is save to run in Mix.Tasks.

example

Example

Since :common_x does not have any dependencies:

iex> ApplicationX.applications(:common_x)
[:common_x]

Duplicates are ignored and only returned once:

iex> ApplicationX.applications([:common_x, :common_x])
[:common_x]

Unknown applications are safe, but returned:

iex> ApplicationX.applications(:fake)
[:fake]
@spec main() :: atom()

The atom of the current main application.

For example take an application called :my_app, which includes the :my_dep dependencies, which has :common_x as dependency.

So:

:my_app
 ...
 :my_dep
     ...
     :common_x

In that scenario calling ApplicationX.main will return :my_app both for code in :my_app and :my_dep.

examples

Examples

iex> ApplicationX.main
:common_x
@spec main_project() :: Keyword.t()

The mix configuration of the current main application.

For example take an application called :my_app, which includes the :my_dep dependencies, which has :common_x as dependency.

So:

:my_app
 ...
 :my_dep
     ...
     :common_x

In that scenario calling ApplicationX.main will return the mix config of :my_app both for code in :my_app and :my_dep.

examples

Examples

iex> config = ApplicationX.main_project
iex> config[:app]
:common_x
iex> config[:description]
"Extension of common Elixir modules."
@spec mix_env() :: atom()

Get the current Mix environment.

example

Example

iex> ApplicationX.mix_env
:test
@spec modules() :: [module()]

List all available modules excluding system ones.

This function is save to run in Mix.Tasks.

example

Example

Since :common_x does not have any dependencies:

iex> ApplicationX.modules
[ApplicationX, CodeX, CommonX, EnumX, MacroX, MapX]
@spec modules(atom() | [atom()]) :: [module()]

List all available modules for the given app[s] and dependencies of those apps. This excludes system modules.

This function is save to run in Mix.Tasks.

example

Example

Normally system modules are excluded, but can be added by manually passing the respective system application:

iex> ApplicationX.modules(:logger)
[Logger, Logger.App, Logger.BackendSupervisor, Logger.Backends.Console,
  Logger.Config, Logger.Counter, Logger.Filter, Logger.Formatter, Logger.Handler,
  Logger.Translator, Logger.Utils, Logger.Watcher]

Duplicate applications are ignored:

iex> ApplicationX.modules([:logger, :logger])
[Logger, Logger.App, Logger.BackendSupervisor, Logger.Backends.Console,
  Logger.Config, Logger.Counter, Logger.Filter, Logger.Formatter, Logger.Handler,
  Logger.Translator, Logger.Utils, Logger.Watcher]

Unknown applications are safe to pass:

iex> ApplicationX.modules(:fake)
[]