Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more
Go to file
2017-04-19 20:37:03 -07:00
bin Make sure update function is loaded. 2017-03-17 13:07:30 -04:00
completions Add bash completion for the update command. 2017-03-17 21:48:11 -04:00
docs Add note on the recommended way to manually sort versions. 2016-12-14 11:04:31 -05:00
lib code review feedback: fix all shellcheck warnings. 2017-04-19 20:37:03 -07:00
test Add tests for the update command. Use sed instead of tail -r to get the 2017-03-17 21:19:46 -04:00
.gitignore Use a git repository for installing plugins. 2017-03-26 16:44:22 -07:00
.travis.yml Add support for config file. 2016-04-24 22:39:24 +09:00
asdf.fish Add fish support. 2016-04-18 16:33:14 +09:00
asdf.sh Properly address shellcheck warnings ignored in #156 2017-03-07 16:20:04 +01:00
ballad-of-asdf.md Review and update 2015-05-22 10:11:10 +05:30
CHANGELOG.md Add grep fix to changelog. 2017-03-07 13:36:58 -05:00
defaults Add support for config file. 2016-04-24 22:39:24 +09:00
help.txt Use a git repository for installing plugins. 2017-03-26 16:44:22 -07:00
LICENSE Add license file. Thanks to @mosic for reporting 2016-03-16 10:27:58 +05:30
README.md Update README.md 2017-03-11 00:36:52 -03:00
Vagrantfile Add a Vagrantfile to test on ubuntu 2015-05-19 11:00:40 +05:30

asdf Build Status

extendable version manager

Supported languages include Ruby, Node.js, Elixir and more. Supporting a new language is as simple as this plugin API.

SETUP

Copy-paste the following into command line:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.2.1

Depending on your OS, run the following

# For Ubuntu or other linux distros
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

# OR for Mac OSX
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile

If you use zsh or any other shell, replace .bashrc with the config file for the respective shell.

For fish, you can use the following:

echo 'source ~/.asdf/asdf.fish' >> ~/.config/fish/config.fish
mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions

For most plugins, it is good if you have installed the following packages OR their equivalent on your OS

  • OS X: Install these via homebrew coreutils automake autoconf openssl libyaml readline libxslt libtool unixodbc
  • Ubuntu: automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev
  • Fedora: automake autoconf readline-devel ncurses-devel openssl-devel libyaml-devel libxslt-devel libffi-devel libtool unixODBC-devel

That's all ~! You are ready to use asdf


USAGE

Manage plugins

Plugins are how asdf understands how to handle different packages. Below is a list of plugins for languages. There is a super-simple API for supporting more languages.

Language Repository CI Status
Clojure vic/asdf-clojure Build Status
Crystal marciogm/asdf-crystal Build Status
D (DMD) sylph01/asdf-dmd Build Status
Elixir asdf-vm/asdf-elixir Build Status
Elm vic/asdf-elm Build Status
Erlang asdf-vm/asdf-erlang Build Status
Go kennyp/asdf-golang Build Status
Haskell vic/asdf-haskell Build Status
Idris vic/asdf-idris Build Status
Julia rkyleg/asdf-julia Build Status
LFE vic/asdf-lfe Build Status
Link (system tools) vic/asdf-link Build Status
Lua Stratus3D/asdf-lua Build Status
LuaJIT smashedtoatoms/asdf-luaJIT Build Status
MongoDB sylph01/asdf-mongodb Build Status
Node.js asdf-vm/asdf-nodejs Build Status
OpenResty smashedtoatoms/asdf-openresty Build Status
Packer gozer/asdf-packer Build Status
PHP odarriba/asdf-php Build Status
Postgres smashedtoatoms/asdf-postgres Build Status
Python tuvistavie/asdf-python Build Status
Redis smashedtoatoms/asdf-redis Build Status
Riak smashedtoatoms/asdf-riak Build Status
Ruby asdf-vm/asdf-ruby Build Status
Rust code-lever/asdf-rust Build Status
SBT lerencao/asdf-sbt Build Status
Scala mtatheonly/asdf-scala Build Status
Swift fcrespo82/asdf-swift Build Status
Terraform neerfri/asdf-terraform Build Status
Add a plugin
asdf plugin-add <name> <git-url>
# asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
List installed plugins
asdf plugin-list
# asdf plugin-list
Remove a plugin
asdf plugin-remove <name>
# asdf plugin-remove erlang
Update plugins
asdf plugin-update --all

If you want to update a specific package, just say so.

asdf plugin-update <name>
# asdf plugin-update erlang

Manage versions

asdf install <name> <version>
# asdf install erlang 17.3

asdf current <name>
# asdf current erlang
# 17.3 (set by /Users/kim/.tool-versions)

asdf uninstall <name> <version>
# asdf uninstall erlang 17.3

If a plugin supports downloading & compiling from source, you can also do this ref:foo (replace foo with the branch/tag/commit). You'll have to use the same name when uninstalling too.

Lists installed versions
asdf list <name>
# asdf list erlang
List all available versions
asdf list-all <name>
# asdf list-all erlang

View current version

asdf current <name>
# asdf current erlang
# 17.3 (set by /Users/kim/.tool-versions)

Set current version

asdf global <name> <version>
asdf local <name> <version>
asdf global elixir 1.2.4

global writes the version to $HOME/.tool-versions.

local writes the version to $PWD/.tool-versions, creating it if needed.

Alternatively, if you want to set a version only for the current shell session or for executing just a command under a particular tool version, you can set an environment variable like ASDF_${TOOL}_VERSION.

The following example runs tests on an Elixir project with version 1.4.0. The version format is the same supported by the .tool-versions file.

ASDF_ELIXIR_VERSION=1.4.0 mix test

The .tool-versions file

Add a .tool-versions file to your project dir and versions of those tools will be used. Global defaults can be set in the file $HOME/.tool-versions

This is what a .tool-versions file looks like:

ruby 2.2.0
nodejs 0.12.3

The versions can be in the following format:

  • 0.12.3 - an actual version. Plugins that support downloading binaries, will download binaries.
  • ref:v1.0.2-a or ref:39cb398vb39 - tag/commit/branch to download from github and compile
  • path:/src/elixir - a path to custom compiled version of a tool to use. For use by language developers and such.

To install all the tools defined in a .tool-versions file run the asdf install command with no other arguments in the directory containing the .tool-versions file.

You can view/modify the file by hand or use asdf local and asdf global to manage it.

The $HOME/.asdfrc config file

Add a .asdfrc file to your home directory and asdf will use the settings specified in the file. The file should be formatted like this:

legacy_version_file = yes

Settings

  • legacy_version_file - defaults to no. If set to yes it will cause plugins that support this feature to read the version files used by other version managers (e.g. .ruby-version in the case of Ruby's rbenv).

Credits

Me (@HashNuke), High-fever, cold, cough.

Copyright 2014 to the end of time (MIT License)

Maintainers


Read the ballad.