Elixir has grown significantly since its inception in 2012 and has proven to be an effective programming language in a variety of industries. From gaming to food and beverage companies to learning management systems, Elixir’s clean syntax means this language will continue to increase in popularity.
Just like any major language or framework, however, Elixir and the surrounding ecosystem is constantly evolving. Here are three simple things you can do to stay on top of changes and updates.
1.) The Mix Tooling
The first obvious thing you should look at is the tooling bundled directly into Elixir and Mix.
hex.outdated task will list your project’s current dependencies
and whether it’s possible to update them based on the Security Event Manager (SEM) version releases.
mix hex.outdated Dependency Current Latest Update possible blue_heron 0.1.1 0.1.1 blue_heron_transport_uart 0.1.1 0.1.1 blue_heron_transport_usb 0.1.0 0.1.0 jason 1.2.2 1.2.2 nerves 1.6.3 1.7.0 No nerves_pack 0.3.3 0.4.1 Yes nerves_runtime 0.11.3 0.11.3 nerves_system_rpi0 1.12.2 1.13.0 Yes nerves_system_rpi3 1.12.2 1.13.0 No phoenix_client 0.11.1 0.11.1 picam 0.4.1 0.4.1 ring_logger 0.8.1 0.8.1 shoehorn 0.6.0 0.7.0 Yes toolshed 0.2.13 0.2.14 Yes vintage_net_wizard 0.4.0 0.4.0
deps.update task can be used to attempt to resolve all dependencies
based on the information presented in the
Resolving Hex dependencies... Dependency resolution completed: Unchanged: blue_heron 0.1.1 blue_heron_transport_usb 0.1.0 circuits_uart 1.4.2 cowboy 2.8.0 cowboy_telemetry 0.3.0 cowlib 2.9.1 dns 2.1.2 elixir_make 0.6.1 ex_bin 0.4.0 gen_state_machine 2.1.0 jason 1.2.2 mdns_lite 0.6.5 mime 1.4.0 muontrap 0.6.0 nerves_runtime 0.11.3 nerves_system_br 1.12.4 nerves_system_rpi0 1.12.2 nerves_system_rpi3 1.12.2 nerves_time 0.4.2 nerves_toolchain_arm_unknown_linux_gnueabihf 1.3.2 nerves_toolchain_armv6_rpi_linux_gnueabi 1.3.2 nerves_toolchain_ctng 1.7.2 phoenix_html 2.14.2 picam 0.4.1 plug 1.11.0 plug_crypto 1.2.0 ranch 1.7.1 ring_logger 0.8.1 socket 0.3.13 system_registry 0.8.2 telemetry 0.4.2 uboot_env 0.3.0 vintage_net_direct 0.9.0 vintage_net_ethernet 0.9.0 vintage_net_wizard 0.4.0 websocket_client 1.4.2 Upgraded: nerves 1.6.3 => 1.6.5 nerves_pack 0.3.3 => 0.4.1 (minor) one_dhcpd 0.2.4 => 0.2.5 plug_cowboy 2.4.0 => 2.4.1 shoehorn 0.6.0 => 0.7.0 (minor) toolshed 0.2.13 => 0.2.14 vintage_net 0.9.1 => 0.9.2 vintage_net_wifi 0.9.0 => 0.9.1 New: nerves_ssh 0.2.1 ssh_subsystem_fwup 0.5.1 * Updating nerves (Hex package) * Updating shoehorn (Hex package) * Updating toolshed (Hex package) * Updating nerves_pack (Hex package) * Updating plug_cowboy (Hex package) * Updating vintage_net (Hex package) * Updating vintage_net_wifi (Hex package) * Getting nerves_ssh (Hex package) * Updating one_dhcpd (Hex package) * Getting ssh_subsystem_fwup (Hex package)
2.) Keeping OTP and Elixir up-to-date
What the Mix tooling doesn’t provide is a way to check for newer versions of Elixir and OTP. If you’re just learning Elixir, this can be rather confusing because there are dependency issues you need to consider before you begin developing. For this, I highly suggest using ASDF Version Manager, a helpful manager for many different projects that are traditionally difficult or just tedious to keep updated. Then follow these steps:
Install ASDF, using the official guide.
asdf, add plugins for Erlang and Elixir.
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
The trick with that last step is to ensure the versions of Elixir and Erlang you install are compatible with each other. Luckily, the Elixir team publishes special tags to help with this. Here’s an example:
First we’ll install OTP 23, which is the latest as of writing this guide:
asdf install erlang 23.1.1
To ensure we have the correct Elixir version, we need to add
-otp-23 to the end of the Elixir version we want:
asdf install elixir 1.11.2-otp-23
Now Erlang and Elixir are in sync.
3.) Keeping Track of Dependencies
The final piece of the puzzle to keeping dependencies up-to-date is not something you can get from tooling.The best way to keep track of your dependencies is to simply check them. This is especially true when the tooling can’t automatically update a dependency via its semantic versioning. In this case, you’ll have to check the projects page, usually on GitHub. Markdown files named
CHANGELOG.md usually contain information about breaking changes a package may have made. Be sure to leave a star on the project while you’re there.
Are you ready to take your skills to the next level? Learn about Membrane, Phoenix and Nerves.
Founded in 2007, Binary Noggin is a team of software engineers who serve as a trusted extension of your team, helping your company succeed through collaboration. We forge customizable solutions using Agile methodologies and our mastery of Elixir, Ruby and other open-source technologies. Share your ideas with us on Facebook and Twitter.