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:
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 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:
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
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:
Although Elixir is now young language, it has good set of libraries:
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!
In this post i will try to describe my feels about Elixir.Weber-0.0.1 - MVC web framework for #Elixir https://t.co/AFCXYkswAH @ElixirLang
— 0xAX (@0xAX) September 15, 2013
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:
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:
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:
- exjson - JSON parser and genarator in Elixir.
- ecto - A database wrapper and language integrated query for Elixir
- httpotion - The HTTP client for Elixir
- amrita - A polite, well mannered and thoroughly upstanding testing framework for Elixir
- elixir-socket - Socket wrapping for Elixir.
- genx - Elixir-style library for most important OTP functionality
- elixir-datastructures - Datastructures for Elixir.
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