2014-12-18 12:08:02 -07:00
# asdf
### _extendable version manager_
2014-09-29 09:51:09 -07:00
2016-03-15 21:22:07 -07:00
Supported languages include Ruby, Node.js, Elixir and more. Supporting a new language is as simple as [this plugin API ](https://github.com/asdf-vm/asdf/blob/master/docs/creating-plugins.md ).
2014-11-30 06:46:11 -07:00
2015-05-11 10:36:25 -07:00
## SETUP
2014-11-30 06:46:11 -07:00
2014-11-30 20:32:14 -07:00
Copy-paste the following into command line:
2014-11-30 06:46:11 -07:00
2015-05-11 10:33:05 -07:00
```bash
2016-10-22 11:55:58 -07:00
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.2.0
2015-05-10 09:51:33 -07:00
2015-05-11 10:33:05 -07:00
```
Depending on your OS, run the following
```bash
2015-05-10 09:51:33 -07:00
# For Ubuntu or other linux distros
2015-06-16 17:45:34 -07:00
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
2016-03-10 03:18:29 -07:00
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
2015-05-10 09:51:33 -07:00
# OR for Max OSX
2015-06-16 17:45:34 -07:00
echo '. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
2016-03-10 03:18:29 -07:00
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
2014-11-30 06:46:11 -07:00
```
2015-05-18 22:08:42 -07:00
If you use zsh or any other shell, replace `.bashrc` with the config file for the respective shell.
2016-04-18 00:33:14 -07:00
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
```
2015-05-18 22:08:42 -07:00
> For most plugins, it is good if you have installed the following packages OR their equivalent on you OS
2016-01-03 22:55:26 -07:00
> * **OS X**: Install these via homebrew `automake autoconf openssl libyaml readline libxslt libtool unixodbc`
2015-05-19 01:52:55 -07:00
> * **Ubuntu**: `automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev`
2016-06-16 14:14:05 -07:00
> * **Fedora**: `automake autoconf readline-devel ncurses-devel openssl-devel libyaml-devel libxslt-devel libffi-devel libtool unixODBC-devel`
2014-11-30 06:46:11 -07:00
2015-05-10 09:51:33 -07:00
**That's all ~! You are ready to use asdf**
2014-11-30 20:32:14 -07:00
2015-05-11 10:36:25 -07:00
-----------------------
2014-11-30 20:32:14 -07:00
2015-11-04 11:48:44 -07:00
2015-05-11 10:36:25 -07:00
## USAGE
2015-05-17 18:25:35 -07:00
### Manage plugins
2014-11-30 20:32:14 -07:00
2016-03-15 21:28:04 -07:00
Plugins are how asdf understands how to handle different packages. Below is a list of plugins for languages. There is a [super-simple API ](https://github.com/asdf-vm/asdf/blob/master/docs/creating-plugins.md ) for supporting more languages.
2015-11-04 11:48:44 -07:00
2016-06-12 01:10:59 -07:00
| Language | Repository | CI Status
|-----------|-------------|----------
| Elixir | [asdf-vm/asdf-elixir ](https://github.com/asdf-vm/asdf-elixir ) | [![Build Status ](https://travis-ci.org/asdf-vm/asdf-elixir.svg?branch=master )](https://travis-ci.org/asdf-vm/asdf-elixir)
| Erlang | [asdf-vm/asdf-erlang ](https://github.com/asdf-vm/asdf-erlang ) | [![Build Status ](https://travis-ci.org/asdf-vm/asdf-erlang.svg?branch=master )](https://travis-ci.org/asdf-vm/asdf-erlang)
| Go | [kennyp/asdf-golang ](https://github.com/kennyp/asdf-golang ) | [![Build Status ](https://travis-ci.org/kennyp/asdf-golang.svg?branch=master )](https://travis-ci.org/kennyp/asdf-golang)
| Lua | [Stratus3D/asdf-lua ](https://github.com/Stratus3D/asdf-lua ) | [![Build Status ](https://travis-ci.org/Stratus3D/asdf-lua.svg?branch=master )](https://travis-ci.org/Stratus3D/asdf-lua)
| OpenResty | [smashedtoatoms/asdf-openresty ](https://github.com/smashedtoatoms/asdf-openresty ) | [![Build Status ](https://travis-ci.org/smashedtoatoms/asdf-openresty.svg?branch=master )](https://travis-ci.org/smashedtoatoms/asdf-openresty)
| Node.js | [asdf-vm/asdf-nodejs ](https://github.com/asdf-vm/asdf-nodejs ) | [![Build Status ](https://travis-ci.org/asdf-vm/asdf-nodejs.svg?branch=master )](https://travis-ci.org/asdf-vm/asdf-nodejs)
| Postgres | [smashedtoatoms/asdf-postgres ](https://github.com/smashedtoatoms/asdf-postgres ) | [![Build Status ](https://travis-ci.org/smashedtoatoms/asdf-postgres.svg?branch=master )](https://travis-ci.org/smashedtoatoms/asdf-postgres)
| Python | [tuvistavie/asdf-python ](https://github.com/tuvistavie/asdf-python ) | [![Build Status ](https://travis-ci.org/tuvistavie/asdf-python.svg?branch=master )](https://travis-ci.org/tuvistavie/asdf-python)
| Redis | [smashedtoatoms/asdf-redis ](https://github.com/smashedtoatoms/asdf-redis ) | [![Build Status ](https://travis-ci.org/smashedtoatoms/asdf-redis.svg?branch=master )](https://travis-ci.org/smashedtoatoms/asdf-redis)
| Riak | [smashedtoatoms/asdf-riak ](https://github.com/smashedtoatoms/asdf-riak ) | [![Build Status ](https://travis-ci.org/smashedtoatoms/asdf-riak.svg?branch=master )](https://travis-ci.org/smashedtoatoms/asdf-riak)
| Ruby | [asdf-vm/asdf-ruby ](https://github.com/asdf-vm/asdf-ruby ) | [![Build Status ](https://travis-ci.org/asdf-vm/asdf-ruby.svg?branch=master )](https://travis-ci.org/asdf-vm/asdf-ruby)
2014-11-30 06:46:11 -07:00
2015-05-17 18:25:35 -07:00
##### Add a plugin
2014-11-30 20:32:14 -07:00
```bash
2015-05-17 18:25:35 -07:00
asdf plugin-add < name > < git-url >
2016-03-15 21:22:07 -07:00
# asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
2014-11-30 06:46:11 -07:00
```
2014-11-30 20:32:14 -07:00
2015-06-14 05:27:32 -07:00
##### List installed plugins
```bash
asdf plugin-list
# asdf plugin-list
```
2015-05-17 18:25:35 -07:00
##### Remove a plugin
2014-11-30 20:32:14 -07:00
```bash
2015-05-17 18:25:35 -07:00
asdf plugin-remove < name >
# asdf plugin-remove erlang
2014-11-30 06:46:11 -07:00
```
2015-05-17 18:25:35 -07:00
##### Update plugins
2014-11-30 06:46:11 -07:00
2014-11-30 20:32:14 -07:00
```bash
2015-05-17 18:25:35 -07:00
asdf plugin-update --all
2014-11-30 06:46:11 -07:00
```
If you want to update a specific package, just say so.
2014-11-30 20:32:14 -07:00
```bash
2015-05-17 18:25:35 -07:00
asdf plugin-update < name >
# asdf plugin-update erlang
2014-11-30 06:46:11 -07:00
```
2015-05-17 18:25:35 -07:00
### Manage versions
2014-11-30 06:46:11 -07:00
2014-11-30 20:32:14 -07:00
```bash
2015-05-11 10:33:05 -07:00
asdf install < name > < version >
# asdf install erlang 17.3
2014-11-30 06:46:11 -07:00
2016-07-24 08:47:17 -07:00
asdf current < name >
# asdf current erlang
# 17.3 (set by /Users/kim/.tool-versions)
2015-05-27 00:20:23 -07:00
2015-05-11 10:33:05 -07:00
asdf uninstall < name > < version >
# asdf uninstall erlang 17.3
2014-11-30 06:46:11 -07:00
```
2015-05-21 21:44:53 -07:00
*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.
2015-05-11 10:36:25 -07:00
##### Lists installed versions
2014-11-30 06:46:11 -07:00
2014-11-30 20:32:14 -07:00
```bash
2015-05-11 10:33:05 -07:00
asdf list < name >
# asdf list erlang
2014-11-30 06:46:11 -07:00
```
2015-05-11 10:36:25 -07:00
##### List all available versions
2014-11-30 06:46:11 -07:00
2014-11-30 20:32:14 -07:00
```bash
2015-05-11 10:33:05 -07:00
asdf list-all < name >
# asdf list-all erlang
2014-11-30 06:46:11 -07:00
```
2016-04-24 08:11:33 -07:00
#### View current version
```bash
2016-07-23 05:46:02 -07:00
asdf current < name >
# asdf current erlang
# 17.3 (set by /Users/kim/.tool-versions)
2016-04-24 08:11:33 -07:00
```
#### Set current version
```bash
asdf global < name > < version >
asdf local < name > < version >
asdf global elixir 1.2.4
```
2016-05-13 19:18:55 -07:00
`global` writes the version to `$HOME/.tool-versions` .
`local` writes the version to `$PWD/.tool-versions` , creating it if needed.
2016-04-24 08:11:33 -07:00
2015-05-17 18:25:35 -07:00
## The `.tool-versions` file
2014-11-30 06:46:11 -07:00
2015-05-21 21:24:37 -07:00
Add a `.tool-versions` file to your project dir and versions of those tools will be used.
2015-05-21 21:34:41 -07:00
**Global defaults can be set in the file `$HOME/.tool-versions` **
2015-05-21 21:36:45 -07:00
This is what a `.tool-versions` file looks like:
2014-10-19 09:18:48 -07:00
```
2015-05-21 21:34:41 -07:00
ruby 2.2.0
nodejs 0.12.3
2014-10-19 09:18:48 -07:00
```
2015-05-21 21:34:41 -07:00
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.
2015-05-21 21:24:37 -07:00
2015-11-17 05:35:17 -07:00
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.
2016-04-24 08:11:33 -07:00
You can view/modify the file by hand or use `asdf local` and `asdf global` to manage it.
2016-08-13 11:27:27 -07:00
## 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).
2014-11-30 06:46:11 -07:00
## Credits
2014-10-19 09:18:48 -07:00
2014-12-20 07:05:56 -07:00
Me ([@HashNuke](http://github.com/HashNuke)), High-fever, cold, cough.
2014-10-19 09:18:48 -07:00
2016-03-15 21:59:50 -07:00
Copyright 2014 to the end of time ([MIT License](https://github.com/asdf-vm/asdf/blob/master/LICENSE))
2014-12-20 07:05:56 -07:00
2016-05-12 21:06:14 -07:00
### Maintainers
- [@HashNuke ](http://github.com/HashNuke )
- [@tuvistavie ](http://github.com/tuvistavie )
2016-05-17 18:46:13 -07:00
- [@Stratus3D ](https://github.com/Stratus3D )
2016-05-12 21:06:14 -07:00
2014-12-20 07:05:56 -07:00
-------
2016-03-15 21:22:07 -07:00
Read the [ballad ](https://github.com/asdf-vm/asdf/blob/master/ballad-of-asdf.md ).