My favourite version management tool
If you’ve ever worked with Ruby, Python, Node.js, or a variety of other programming languages and environments, one thing you may have learned is that managing different versions can be a royal pain.
If you’re just working on a single project that hasn’t been around for very
long, this isn’t an issue and everything is probably going great. Once you work
on a few different projects, have other people work on your project, or want to
upgrade your project to use the latest and greatest version of
Managing this on your own system is relatively easy, but then you have to replicate that exact same setup on other developer’s machines, or even on a remote server that you’re deploying to. So how do you do it?
Popular solutions
If you’re a Ruby developer, you have probably heard of rvm, rbenv, or chruby. These projects exist solely to help you manage your Ruby environment. They help you to install and switch between different versions of Ruby at ease - and they’re great at it!
For the Node.js developers in the room (if we were in a room), you may well have come across nvm, which also does the job of managing multiple Node.js versions very, very well.
Elixir has a couple of version managers as well, the popular ones being exenv and kiex.
The similarity between exenv and rbenv is not by coincidence, and they both require a similarly named package in order to actually build and install your language versions (ruby-build and elixir-build).
All these tools are great, and they do their job well. But that’s quite a few different tools to have to keep track of, update, and configure.
Introducing asdf
Until recently I was managing my Ruby versions using rbenv, my Node.js versions using nvm, and my Elixir versions using exenv. That was, until I found asdf.
asdf is the extensible version manager. The idea is to have a single version manager, with a common set of commands, and through plugins, allow you to manage a variety of different programming language versions. Currently, the plugins for asdf include:
- Elixir
- Erlang
- Lua
- Node.js
- Ruby
This means that you only need to have one version manager installed and configured on your system.
One of the major benefits of using asdf becomes apparent when you come to
deploy your application. With a single tool for managing versions, once you’ve
set up asdf on your server, a simple asdf install
in your project directory
will ensure that the server has the correct versions installed. You can make
this part of your deploy process and you don’t have to worry about it any
longer.
If you’re a web developer, asdf can be even more useful for you. Personally, I mainly work with Ruby or Elixir for the server-side aspect of my projects, but I use Node.js to manage static assets (CSS and JavaScript). That means I always need to manage the Ruby/Elixir version as well as the Node.js version. asdf has solved this issue for me, and hopefully for you as well.
Final notes
You’ll notice I haven’t provided any instructions for getting asdf set up and installed. That’s because the project readme is excellent, and includes everything you need to know.
Give it a try, especially if you don’t already have a version manager installed.