command - mix
manpage
執行
$ man ~/.asdf/installs/elixir/1.2.2/man/mix.1
顯示
MIX(1) BSD General Commands Manual MIX(1)
NAME
mix — The software project management tool
SYNOPSIS
mix [TASK] [project_name]
elixir [OPTIONS] -S mix [TASK] [project_name]
DESCRIPTION
mix is intended for both organizing code into projects and their maintenance. For the latter the tool offers some
advanced features like dependency management, packaging, preparing documentation, testing and so on.
Have a look at the SYNOPSIS section and the second way of running mix it offers. The point is that the tool is
none other than the Elixir script, therefore it can be invoked via elixir(1) in the same way as any other script.
It's useful when you want to run mix with particular options.
DEFINITIONS
All the mix functionality is represented by a set of tasks. A task is a piece of code written in Elixir and
intended for solving a particular problem. Like programs, many tasks accept input parameters and/or support
options which slightly modify their behaviour, but others do not. There are two types of tasks: those that are
available after installation this or that archive (local tasks) and those that are offered by mix (built-in
tasks). The run task will be executed by default if none other has been specified.
In spite of the fact that the greater part of mix is tasks, the man page doesn't contain the help information
related to each of them because mix is self-descriptive. Thus, using the help task, you can get both the full
list of local/built-in tasks and the information related to a particular task.
An archive, in terms of Erlang, is the ZIP file with the .ez extension which contains a precompiled Erlang appli‐
cation with all its dependencies[1].
An application is an entity that helps to combine sets of components into a single unit to simplify their reusing
in other systems[2].
ENVIRONMENT
MIX_ARCHIVE
Allows specifying the directory into which the archives should be installed (see mix help
archive.install). The ~/.mix/archives directory is used for this purpose by default.
MIX_DEBUG
When set, outputs debug information about each task before running it.
MIX_ENV
Allows specifying which environment should be used. The dev environment is used by default if none other
has been specified.
Sometimes you have to use a particular set of configuration parameter values or perform particular steps
when you compile or run a project (or in some other cases). The mix environments allow grouping values
of configuration parameters and steps to switch between them by specifying the necessary environment via
MIX_ENV.
MIX_EXS
Allows changing the full path to the mix.exs file (see FILES section). The most obvious use case is to
have more than one copy of mix.exs in a project, but it's worth noting that MIX_EXS should be used only
if the mix environments (see above) are not enough to solve the problem.
MIX_HOME
Stores configuration files and scripts shared by multiple mix implementations.
See the Mix.Utils.mix_home/0 function.
MIX_PATH
Allows expanding the code path. If the MIX_PATH environment variable has a value which consists of multi‐
ple paths, they must be colon-separated (for Unix-like operating systems) or semicolon-separated (for
Windows).
As has already been mentioned above, there are two types of tasks: local and built-in. These tasks are
always visible for mix because the directories, in which they are located, are a part of code path. If a
task belongs to neither the one type nor the other, MIX_PATH helps you say to mix where it should search
the task.
Use the :code.get_path/0 function to get the list of paths which are a part of the code path by default
and the Mix.Utils.mix_paths/0 function to get the list of paths specified in the MIX_PATH value.
MIX_QUIET
When set, does not print information messages to the terminal.
FILES
mix.exs
Contains the most significant information related to the project, such as its name, version, list of
dependencies and so on. As a rule, the file is named mix.exs and located at the top of the project's
source tree, but you can change the full path to it using the MIX_EXS environment variable (see the
ENVIRONMENT section).
mix.lock
Allows locking down the project dependencies with a proper version range before performing any updates.
It is useful when you know that your project is incompatible with newer versions of certain dependencies.
The file is located at the top of the project's source tree as well as mix.exs (see above).
REFERENCES
[1] http://www.erlang.org/doc/man/code.html#id103620
[2] http://www.erlang.org/doc/design_principles/applications.html
SEE ALSO
elixir(1), elixirc(1), iex(1)
AUTHOR
This manual page contributed by Evgeny Golyshev.
INTERNET RESOURCES
Main website: http://elixir-lang.org
Documentation: http://elixir-lang.org/docs.html
General Mailing List: https://groups.google.com/group/elixir-lang-talk
Development Mailing List: https://groups.google.com/group/elixir-lang-core
BSD May 27, 2015 BSD
help
執行
$ mix -h
或是執行
$ mix --help
顯示
mix # Runs the default task (current: "mix run")
mix app.start # Starts all registered apps
mix archive # Lists all archives
mix archive.build # Archives this project into a .ez file
mix archive.install # Installs an archive locally
mix archive.uninstall # Uninstalls archives
mix clean # Deletes generated application files
mix cmd # Executes the given command
mix compile # Compiles source files
mix deps # Lists dependencies and their status
mix deps.clean # Deletes the given dependencies' files
mix deps.compile # Compiles dependencies
mix deps.get # Gets all out of date dependencies
mix deps.unlock # Unlocks the given dependencies
mix deps.update # Updates the given dependencies
mix do # Executes the tasks separated by comma
mix escript.build # Builds an escript for the project
mix help # Prints help information for tasks
mix hex # Prints Hex help information
mix hex.build # Builds a new package version locally
mix hex.config # Reads or updates Hex config
mix hex.docs # Publishes docs for package
mix hex.info # Prints Hex information
mix hex.key # Hex API key tasks
mix hex.outdated # Shows outdated Hex deps for the current project
mix hex.owner # Hex package ownership tasks
mix hex.publish # Publishes a new package version
mix hex.registry # Hex registry tasks
mix hex.search # Searches for package names
mix hex.user # Hex user tasks
mix loadconfig # Loads and persists the given configuration
mix local # Lists local tasks
mix local.hex # Installs Hex locally
mix local.phoenix # Updates Phoenix locally
mix local.public_keys # Manages public keys
mix local.rebar # Installs rebar locally
mix new # Creates a new Elixir project
mix phoenix.new # Creates a new Phoenix v1.1.4 application
mix profile.fprof # Profiles the given file or expression with fprof
mix run # Runs the given file or expression
mix test # Runs a project's tests
iex -S mix # Starts IEx and run the default task
source code
執行
$ cat ~/.asdf/installs/elixir/1.2.2/bin/mix
顯示
#!/usr/bin/env elixir
Mix.start
Mix.CLI.main