Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more
Go to file
Brennan Fee ba1b181b58 Fixing unit tests for 'asdf list'
Now that we put spacing in front of the version #'s the tests need to
reflect that.
2018-06-01 10:15:40 -05:00
.github Add github issue and pull request templates. 2017-08-08 11:25:21 -04:00
bin Implement plugin hook to customize executable path 2018-04-25 22:18:34 -04:00
completions Fix lint error SC1102 2018-01-23 10:21:16 -05:00
docs Implement plugin hook to customize executable path 2018-04-25 22:18:34 -04:00
lib Fix for #330 - "asdf list" spacing 2018-05-31 11:45:20 -05:00
test Fixing unit tests for 'asdf list' 2018-06-01 10:15:40 -05:00
.gitignore Add plugin-list-all command 2017-08-25 11:29:23 +09:00
.travis.yml Add TravisCI instructions for osx setup of shellcheck 2017-09-04 10:09:48 -04:00
asdf.fish more terse solution for previous commit 2018-03-29 12:41:05 -05:00
asdf.sh add colon between asdf segment and PATH 2018-03-09 01:02:08 +11:00
ballad-of-asdf.md fix ballad formatting 2017-06-10 10:06:48 -04:00
CHANGELOG.md Remove -dev tag from 0.5.0 version in changelog. 2018-05-28 15:14:52 -04:00
CONTRIBUTING.md Fix creating-plugins link 2017-09-28 14:32:37 +03:00
defaults Add support for config file. 2016-04-24 22:39:24 +09:00
help.txt Merge pull request #273 from jthegedus/show-url-current-v 2018-01-31 02:00:08 +09:00
LICENSE Add license file. Thanks to @mosic for reporting 2016-03-16 10:27:58 +05:30
lint.sh Remove shebangs from lib files and pass bash dialect to shellcheck 2017-10-01 11:34:35 -04:00
README.md Step for restart shell 2018-05-30 11:37:41 -07:00
release.sh Add check for duplicate issue numbers in the changelog to the release.sh script. 2018-03-12 15:45:02 -04:00
Vagrantfile Add a Vagrantfile to test on ubuntu 2015-05-19 11:00:40 +05:30
VERSION Update version to 0.5.0 2018-05-28 15:15:03 -04:00

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.5.0

Depending on your OS and shell, run the following:

  • Bash on Ubuntu (and other Linux distros):

    echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
    echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
    
  • Bash on macOS:

    echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
    echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
    
  • Zsh:

    If you are using a framework, such as oh-my-zsh, use these lines. (Be sure that if you make future changes to .zshrc these lines remain below the line where you source your framework.)

    echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
    echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
    

    If you are not using a framework, or if on starting your shell you get an error message like 'command not found: compinit', then add this line before the ones above.

    autoload -Uz compinit && compinit
    
  • Fish:

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

Restart your shell so that PATH changes take effect. (Opening a new terminal tab will usually do it.)

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

  • macOS: 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.

You can find a list of all asdf plugins in the plugins repository.

There is a super-simple API for supporting more languages.

Add a plugin
asdf plugin-add <name>
# asdf plugin-add erlang

If the plugin you want to install is not part of the plugins repository, you can add it using its repository URL:

asdf plugin-add <name> <git-url>
# asdf plugin-add elm https://github.com/vic/asdf-elm
List installed plugins
asdf plugin-list
# asdf plugin-list
# java
# nodejs
asdf plugin-list --urls
# asdf plugin-list
# java            https://github.com/skotchpine/asdf-java.git
# nodejs          https://github.com/asdf-vm/asdf-nodejs.git
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
# asdf current
# erlang 17.3 (set by /Users/kim/.tool-versions)
# nodejs 6.11.5 (set by /Users/kim/cool-node-project/.tool-versions)

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.
  • system - this keyword causes asdf to passthrough to the version of the tool on the system that is not managed by asdf.

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).

Environment Variables

  • ASDF_CONFIG_FILE - Defaults to ~/.asdfrc as described above. Can be set to any location.
  • ASDF_DEFAULT_TOOL_VERSIONS_FILENAME - The name of the file storing the tool names and versions. Defaults to .tool-versions. Can be any valid file name.

Uninstall

Uninstalling asdf is easy.

Docker images

The asdf-alpine and asdf-ubuntu projects are an ongoing effort to provide Dockerized images of some asdf tools. You can use these docker images as base for your development servers, or for running your production apps.

Development

To develop the project, you can simply git clone the master branch. If you want to try out your changes without making change to your installed asdf, you can set the $ASDF_DIR variable to the path where you cloned the repository, and temporarily prepend the bin and shims directory of the directory to your path.

We use bats for testing, so make sure bats test/ passes after you made your changes.

Contributing

See CONTRIBUTING.md for the contribution guidelines.

Credits

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

Copyright 2014 to the end of time (MIT License)

Maintainers


Read the ballad.