Elixir at practice

As you can know from my previous blog posts (Using elixir to write ybot plugins, Example of usage elixir with and Started to dive into elixir-lang) some times ago i started to learn and use Elixir language. I'm using elixir not very much time, but already have some feels about it. Practical part of usage of elixir is - Weber. It is a MVC web framework for Elixir, and yesterday i released Weber-0.0.1: In this post i will try to describe my feels about Elixir.

Mix


First of all about mix tool. Mix is a first Elixir's tool with which we meet in practice when started to use the elixir.
Mix is a build tool that provides tasks for creating, compiling, testing (and soon deploying) Elixir projects. Mix is inspired by the Leiningen build tool for Clojure and was written by one of its contributors.
We can create new Elixir project with: mix new project_name Build it with: mix compile Handle dependencies: mix deps.get && mix deps.compile And the main mix's feature as i think is a support of custum tasks. Mix task is just a Elixir module with mixed Mix.Task and run function. For example i'm using custom mix task in Weber for creating new project template:

OTP


As Elixir is built on top of Erlang virtual machine, we can easily to build OTP application with Elixir. Root supervisor: And simple gen_server: compile and start it with: iex -S mix

Testing


There is ExUnit! It is a unit test framework that ships with Elixir. Let see in routing functions from the Weber: And now we can write unit tests for it with ExUnit:

Libraries


Although Elixir is now young language, it has good set of libraries: and etc... Or you of course can use any erlang libraries. Just include it to your mix.exs file as: and execute mix deps.get

Links


In the end of this post i want to say many thanks to the Elixir community which helped me all this day, you're great!

Comments