Mix.Deps
Common functions to work with dependencies.
Dependencies must be specified in the Mix application in the following format:
{ app :: atom, opts :: Keyword.t }
{ app :: atom, requirement :: String.t, opts :: Keyword.t }
The application name must be an atom, the version requirement must
be a string according to the specification outline in Version
and opts is a keyword lists that may include options for the underlying
SCM or options used by Mix. Each set of options is documented below.
Inside Mix, those dependencies are converted to a Mix.Dep record.
This module provides conveniences to work with those dependencies
and the dependencies are usually in two specific states: loaded and
unloaded.
When a dependency is unloaded, it means Mix only parsed its specification and made no attempt to actually load the dependency or validate its status. When the dependency is loaded, it means Mix attempted to fetch, load and validate it, the status is set in the status field.
Mix options
:app- Do not try to read the app file for this dependency:env- The environment to run the dependency on, defaults to :prod:compile- A command to compile the dependency, defaults to a mix, rebar or make command:optional- The dependency is optional and used only to specify requirements
Git options (:git)
:git- The git repository URI:github- A shortcut for specifying git repos from github, usesgit::ref- The reference to checkout (may be a branch, a commit sha or a tag):branch- The git branch to checkout:tag- The git tag to checkout:submodules- When true, initialize submodules for the repo
Path options (:path)
:path- The path for the dependency:in_umbrella- When true, sets a path dependency pointing to "../#{app}", sharing the same environment as the current application
Internal options
Those options are set internally by Mix and they can't be overridden from the Mixfile:
:dest- The destination path for the dependency:lock- The lock information retrieved from mix.lock
Summary
| available?(arg1) | Checks if a dependency is available. Available dependencies are the ones that can be loaded |
| check_lock(dep, lock) | Checks the lock for the given dependency and update its status accordingly |
| children() | Returns all children dependencies for the current project, as well as the defined apps in case of umbrella projects. The children dependencies returned by this function were not loaded yet |
| format_dep(arg1) | Formats a dependency for printing |
| format_status(dep) | Formats the status of a dependency |
| in_dependency(dep, post_config \\ [], fun) | Runs the given |
| load_paths(dep) | Returns all load paths for the given dependency. Automatically derived from source paths |
| loaded() | Returns loaded dependencies recursively as a |
| loaded_by_name(given, all_deps \\ loaded) | Receives a list of dependency names and returns loaded dependency records. Logs a message if the dependency could not be found |
| make?(arg1) | Return |
| mix?(arg1) | Return |
| ok?(arg1) | Returns true if the dependency is ok |
| out_of_date?(arg1) | Checks if a dependency is out of date, also considering its
lock status. Therefore, be sure to call |
| rebar?(arg1) | Return |
| source_paths(arg1) | Returns all source paths |
| unloaded(acc, callback) | Maps and reduces over all unloaded dependencies, one by one |
| unloaded_by_name(given, acc, callback) | Receives a list of dependency names and maps and reduces over them |
Functions
Checks if a dependency is available. Available dependencies are the ones that can be loaded.
Checks the lock for the given dependency and update its status accordingly.
Returns all children dependencies for the current project, as well as the defined apps in case of umbrella projects. The children dependencies returned by this function were not loaded yet.
Exceptions
This function raises an exception if any of the dependencies provided in the project are in the wrong format.
Runs the given fun inside the given dependency project by
changing the current working directory and loading the given
project onto the project stack.
It is expected a loaded dependency as argument.
Returns all load paths for the given dependency. Automatically derived from source paths.
Returns loaded dependencies recursively as a Mix.Dep record.
Exceptions
This function raises an exception if any of the dependencies provided in the project are in the wrong format.
Receives a list of dependency names and returns loaded dependency records. Logs a message if the dependency could not be found.
Exceptions
This function raises an exception if any of the dependencies provided in the project are in the wrong format.
Checks if a dependency is out of date, also considering its
lock status. Therefore, be sure to call check_lock before
invoking this function.
Out of date dependencies are fixed by simply running deps.get.
Returns all source paths.
Source paths are the directories that contains ebin files for a given dependency. All managers, except rebar, have only one source path.
Maps and reduces over all unloaded dependencies, one by one.
This is useful in case you want to retrieve the dependency
tree for a project but process and change them along the way.
For example, mix deps.get uses it to get all dependencies
by first fetching the parent and then updating the tree as it goes.
The callback expects the current dependency and the accumulator as arguments. The accumulator is returned as result.
Exceptions
This function raises an exception if any of the dependencies provided in the project are in the wrong format.