Suppose a `foo` plugin is installed and provides a `bar` executable.
The following hooks will be executed when set in `.asdfrc`:
```shell
post_asdf_install_foo = echo installed foo version ${1}
post_asdf_reshim_foo = echo reshimmed foo version ${1}
pre_foo_bar = echo about to execute command bar from foo with args: ${@}
post_foo_bar = echo just executed command bar from foo with args: ${@}
```
Features
* New shim version meta-data allows shims to not depend on a particular plugin
nor on its relative executable path (#431)
Upgrading requires shim re-generation and should happen automatically
by `asdf-exec`:
`rm -rf ~/.asdf/shims/` followed by `asdf reshim`
* Added lots of tests for shim execution.
We now make sure that shim execution obeys plugins hooks like
`list-bin-paths` and `exec-path`.
* Shim exec is now performed by a new `bin/private/asdf-tool-exec` that might
be faster for most common use case: (versions on local .tool-versions file)
but fallbacks to slower `get_preset_version_for` which takes legacy formats
into account.
* Shim exec recommends which plugins or versions to set when command is
not found.
Fixed Bugs
* Allow many plugins to provide shims with same executable name (#431)
Previous implementation exits abruptly when no version is installed for
a plugin. This prevented the list command from listing the versions for
some other plugins.
This commit allows list command to continue executing even when no
version is installed for some plugins.
Example, plugin a with 1.0, b with none, and c with 2.0.
Previous implementation:
```
$ asdf list
a
1.0
b
No versions installed
```
After commit changes:
```
$ asdf list
a
1.0
b
No versions installed
c
2.0
```
When checking if a plugin is installed (to display a flag) it is not
necessary to loop through all installed plugins, since we already have
a name we can check directly.
Also expand test case to test this code path too.
It seems to have been lost in 88d47bbd69.
Probably by accident?
I also pulled the literal bits into the format string. It looks more
readable to me that way. I'm happy to remove that if it's not desired.
Many plugins were having this problem where they rely on accessing
GitHub's API for listing versions from some repo releases. But not
setting an Authorization token for `curl`, causes the test to fail.
We now detect that if the plugin `list-all` looks like accessing
`api.github.com` and if so, we also try to guess if the Authroization
header will be set. If not, we fail the test and head the plugin author
to some documentation on how to add it.
Hope this reduces the number of failures due to GitHub API rate
limiting on travis.
The subshell sources the isolated asdf environment, making the asdf
command available. In some plugin tests we were having failures do
to the asdf bin not set on PATH.