diff --git a/README.md b/README.md index 9bc263b0..db4f6b91 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.con > * **OS X**: Install these via homebrew `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** @@ -48,18 +49,19 @@ mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.con 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. -| Language | Repository | -|-----------|-------------| -| Elixir | [asdf-vm/asdf-elixir](https://github.com/asdf-vm/asdf-elixir) -| Erlang | [asdf-vm/asdf-erlang](https://github.com/asdf-vm/asdf-erlang) -| Go | [kennyp/asdf-golang](https://github.com/kennyp/asdf-golang) -| Lua | [Stratus3D/asdf-lua](https://github.com/Stratus3D/asdf-lua) -| OpenResty | [smashedtoatoms/asdf-openresty](https://github.com/smashedtoatoms/asdf-openresty) -| Node.js | [asdf-vm/asdf-nodejs](https://github.com/asdf-vm/asdf-nodejs) -| Postgres | [smashedtoatoms/asdf-postgres](https://github.com/smashedtoatoms/asdf-postgres) -| Redis | [smashedtoatoms/asdf-redis](https://github.com/smashedtoatoms/asdf-redis) -| Riak | [smashedtoatoms/asdf-riak](https://github.com/smashedtoatoms/asdf-riak) -| Ruby | [asdf-vm/asdf-ruby](https://github.com/asdf-vm/asdf-ruby) +| 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) ##### Add a plugin diff --git a/asdf.sh b/asdf.sh index 08825443..3e001df4 100644 --- a/asdf.sh +++ b/asdf.sh @@ -11,6 +11,6 @@ export PATH="${asdf_dir}/bin:${asdf_dir}/shims:$PATH" if [ -n "$ZSH_VERSION" ]; then fpath=(${asdf_dir}/completions $fpath) - autoload -U compinit - compinit + autoload -U bashcompinit + bashcompinit fi diff --git a/docs/creating-plugins.md b/docs/creating-plugins.md index ea43b165..fece8b32 100644 --- a/docs/creating-plugins.md +++ b/docs/creating-plugins.md @@ -68,13 +68,14 @@ This must be used wisely. For now AFAIK, it's only being used in the Elixir plug You can use it as follows ```sh -asdf plugin-test +asdf plugin-test [test-command] ``` -So for example to test the Elixir plugin, we would run +The two first arguments are required. A command can also be passed to check it runs correctly. +For example to test the NodeJS plugin, we could run ```sh -asdf plugin-test elixir https://github.com/asdf-vm/asdf-elixir.git +asdf plugin-test nodejs https://github.com/asdf-vm/asdf-nodejs.git 'node --version' ``` We strongly recommend you test your plugin on TravisCI, to make sure it works @@ -84,7 +85,7 @@ Here is a sample `.travis.yml` file, customize it to your needs ```yaml language: c -script: asdf plugin-test elixir https://github.com/asdf-vm/asdf-elixir.git +script: asdf plugin-test nodejs https://github.com/asdf-vm/asdf-nodejs.git 'node --version' before_script: - git clone https://github.com/asdf-vm/asdf.git asdf - . asdf/asdf.sh diff --git a/lib/commands/plugin-test.sh b/lib/commands/plugin-test.sh index 07bd1f47..86af4029 100644 --- a/lib/commands/plugin-test.sh +++ b/lib/commands/plugin-test.sh @@ -6,9 +6,11 @@ fail_test() { plugin_test_command() { export ASDF_DIR=$(mktemp -dt asdf.XXXX) + git clone https://github.com/asdf-vm/asdf.git $ASDF_DIR local plugin_name=$1 local plugin_url=$2 + local plugin_command="${@:3}" if [ -z "$plugin_name" -o -z "$plugin_url" ]; then fail_test "please provide a plugin name and url" @@ -33,11 +35,32 @@ plugin_test_command() { fail_test "list-all did not return any version" fi - (asdf install $plugin_name ${versions[0]}) + latest_version=${versions[${#versions[@]} - 1]} + + (asdf install $plugin_name $latest_version) if [ $? -ne 0 ]; then fail_test "install exited with an error" fi + cd $ASDF_DIR + (asdf local $plugin_name $latest_version) + if [ $? -ne 0 ]; then + fail_test "install did not add the requested version" + fi + + (asdf reshim $plugin_name) + if [ $? -ne 0 ]; then + fail_test "could not reshim plugin" + fi + + if [ -n "$plugin_command" ]; then + (PATH="$ASDF_DIR/bin":"$ASDF_DIR/shims":$PATH eval "$plugin_command") + exit_code=$? + if [ $exit_code -ne 0 ]; then + fail_test "$plugin_command failed with exit code $?" + fi + fi + rm -rf $ASDF_DIR }