An Interest In:
Web News this Week
- March 27, 2024
- March 26, 2024
- March 25, 2024
- March 24, 2024
- March 23, 2024
- March 22, 2024
- March 21, 2024
Introducing you to asdf-vm
Well, I recently discovered through a video by Fabio Akita, that there is a more practical way to manage versions of programming languages.
We work on several different projects. Some projects are new and use, for example Ruby 2.6.3. But sometimes we need to maintain projects from 3 or 4 years ago that may still be in Ruby 2.4.4 for example. It means that we need to have all of these versions installed on our machine at the same time. The same goes for Javascript or other languages. But a Linux distro's package manager only manages one version. After it updates, the old version no longer exists. So we need an outside way to manage this. Over the years, each language has built its own version manager like RVM and RBENV in Ruby, or Javascript's NVM, or Python's Virtualenv. But it is also a pain to have to remember the syntax and settings of so many different tools. And to save us came the Universal version manager, ASDF.
Managing the managers
asdf is a CLI tool that can manage multiple language runtime versions on a per-project basis. It is like gvm, nvm, rbenv & pyenv (and more) all in one! Simply install your language's plugin!
Installation and first steps
asdf
Manage multiple runtime versions with a single CLI tool, extendable via plugins - docs at asdf-vm.com
asdf is a CLI tool that can manage multiple language runtime versions on a per-project basis. It is like gvm
, nvm
, rbenv
& pyenv
(and more) all in one! Simply install your language's plugin!
Why use asdf?
- single CLI for multiple languages
- consistent commands to manage all your languages
- single global config keeping defaults in one place
- single
.tool-versions
config file per project - support for existing config files
.node-version
,.nvmrc
,.ruby-version
for easy migration - automatically switches runtime versions as you traverse your directories
- simple plugin system to add support for your language of choice
- shell completion available for common shells (Bash, Zsh, Fish)
Documentation
Please head over to the documentation site for more information!
Clone only the latest branch:
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
Then add the following line to your ~/.bashrc file.
. $HOME/.asdf/asdf.sh
and
. $HOME/.asdf/completions/asdf.bash
Restart your shell so that PATH changes take effect.
First steps
Now that asdf is properly installed, we can start playing with it. First of all, know that it works with plugins, so first of all you need to install the official asdf plugin for your language, I will use Ruby as an example.
Add a plugin
It is quite simple as you can see
asdf plugin add <name># asdf plugin add ruby
once added, you can list all language versions. Using the command below
asdf plugin list# asdf ruby listor asdf list all ruby ou asdf list-all ruby
List a language version
To install a version is as simple as
asdf install <name> latest# asdf install ruby latestorasdf install <name> latest:<version># asdf install ruby latest:17
and finally, to set the installed version.
asdf global <name> <version> [<version>...]asdf shell <name> <version> [<version>...]asdf local <name> <version> [<version>...]# asdf global ruby 2.6.4
If you need to unset, use
asdf uninstall <name> <version># asdf uninstall ruby 2.6.4asdf plugin update <name># asdf plugin update erlang
Photo by Carl Raw on Unsplash.
Original Link: https://dev.to/fariasmateuss/introducing-you-to-asdf-vm-491d
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To