CommonX v0.5.6 ApplicationX View Source
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
Specs
applications() :: [atom()]
List all available applications excluding system ones.
This function is save to run in Mix.Task
s.
Example
Since :common_x
does not have any dependencies:
iex> ApplicationX.applications
[:common_x]
Specs
List all dependant applications excluding system ones. Does includes the given application.
This function is save to run in Mix.Task
s.
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]
Specs
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
iex> ApplicationX.main
:common_x
Specs
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
iex> config = ApplicationX.main_project
iex> config[:app]
:common_x
iex> config[:description]
"Extension of common Elixir modules."
Specs
mix_env() :: atom()
Get the current Mix environment.
Example
iex> ApplicationX.mix_env
:test
Specs
modules() :: [module()]
List all available modules excluding system ones.
This function is save to run in Mix.Task
s.
Example
Since :common_x
does not have any dependencies:
iex> ApplicationX.modules
[ApplicationX, CodeX, CommonX, EnumX, MacroX, MapX]
Specs
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.Task
s.
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)
[]