Linux Format

The mix tool

-

The Elixir tool for creating and maintainin­g projects is called mix. Each Elixir project created by mix, including projects that use Phoenix, contains a file named mix.exs that is used for configurin­g your project. The mix.exs file is divided into three parts, named “project”, “applicatio­n” and “deps”, that are also valid Elixir functions. The “project” part is where you put all project-related informatio­n such as project name and version. The “applicatio­n” part is for putting informatio­n that is used for describing the applicatio­n you are developing. The “deps” part contains the most important informatio­n because it is where the dependenci­es of the project are listed – the mix tool will either download all dependenci­es based on the informatio­n found in the “deps” function or give you the details you need to get them yourself. Usually, you will not have to deal with the mix.exs file when developing Phoenix projects because the mix tool does all the work for you.

The mix clean command erases the generated applicatio­n files and allows you to start with a fresh project. The mix compile command compiles your Elixir project. The mix run command executes your project, whereas the

mix test command executes the tests of the project – by default, mix generates some dummy tests that are difficult to fail; should you wish to have real tests, you will have to write your own.

There are plenty more; the mix --help command will show you all supported mix commands. Should you wish to get informatio­n about a specific command, you can simply execute mix help <command_name>.

Please note that it is highly recommende­d to create your Phoenix projects using the mix tool.

You can find more informatio­n about mix at http://bit.ly/2bmix.

Newspapers in English

Newspapers from Australia