asdf是一个不错的多开发虚拟环境搭建工具(玩Ruby的时候无意发现的)。Ruby常用的虚拟环境工具有RVM
和Rbenv
。但是现在的开发都会包含python和nodejs之类的多语言开发环境。这个工具虽然不如Docker强大,但是也足够个人开发者在常规的desktop或laptop上使用去管理这些语言。
首先需要curl
,git
和 aria2
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
在~/.bashrc
添加:
. $HOME/.asdf/asdf.sh
完整的需要添加:
. $HOME/.asdf/completions/asdf.bash
参考官网
以下是他提供的插件:
asdf plugin-add clojure https://github.com/vic/asdf-clojure.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
asdf plugin-add python https://github.com/tuvistavie/asdf-python.git
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
# Imports Node.js release team's OpenPGP keys to main keyring
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
更新插件:
asdf plugin-update --all
安装Ruby:
asdf list-all ruby
asdf install ruby 3.1.3
它下载没有提示,但是提供了:
To follow progress, use 'tail -f /tmp/ruby-build.20221209155213.2253.log' or pass --verbose
Downloading ruby-3.1.3.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.3.tar.gz
^Cerror: failed to download ruby-3.1.3.tar.gz
BUILD FAILED (EndeavourOS rolling using ruby-build 20221206)