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

Git options (:git)

Path options (:path)

Internal options

Those options are set internally by Mix and they can't be overridden from the Mixfile:

Source

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 fun inside the given dependency project by changing the current working directory and loading the given project onto the project stack

load_paths(dep)

Returns all load paths for the given dependency. Automatically derived from source paths

loaded()

Returns loaded dependencies recursively as a Mix.Dep record

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 true if dependency is a make project

mix?(arg1)

Return true if dependency is a mix project

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 check_lock before invoking this function

rebar?(arg1)

Return true if dependency is a rebar project

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

available?(arg1)

Checks if a dependency is available. Available dependencies are the ones that can be loaded.

Source
check_lock(dep, lock)

Checks the lock for the given dependency and update its status accordingly.

Source
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.

Exceptions

This function raises an exception if any of the dependencies provided in the project are in the wrong format.

Source
format_dep(arg1)

Formats a dependency for printing.

Source
format_status(dep)

Formats the status of a dependency.

Source
in_dependency(dep, post_config \\ [], fun)

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.

Source
load_paths(dep)

Returns all load paths for the given dependency. Automatically derived from source paths.

Source
loaded()

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.

Source
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.

Exceptions

This function raises an exception if any of the dependencies provided in the project are in the wrong format.

Source
make?(arg1)

Return true if dependency is a make project.

Source
mix?(arg1)

Return true if dependency is a mix project.

Source
ok?(arg1)

Returns true if the dependency is ok.

Source
out_of_date?(arg1)

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.

Source
rebar?(arg1)

Return true if dependency is a rebar project.

Source
source_paths(arg1)

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.

Source
unloaded(acc, callback)

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.

Source
unloaded_by_name(given, acc, callback)

Receives a list of dependency names and maps and reduces over them.

Exceptions

This function raises an exception if any of the dependencies provided in the project are in the wrong format.

Source