* feat: Displays a warning when the plugin from the tools-version does not exist
When calling the install command, it tried to look for versions for all
the plugins available and installed them. With this change, it will attempt to
find versions for all the installed plugins and plugins defined in the
`.tool-versions`.
Fixes https://github.com/asdf-vm/asdf/issues/574
* feat: Changes the algorithm to detect not installed plugins
This patch changes the algorithm. It preserves the original logic for
the plugin resolution, but at the same time, reports entries with plugins not
available.
* fix: Addresses the pull request comments.
- Changes the comparison to be strict rather than partial.
- Prints a list of missing plugins.
- Exists if at least one plugin is not present.
- Adds unit tests.
Process substitution isn't specified by POSIX and makes shims break when called by a script that `export POSIXLY_CORRECT=1` (like gitflow [here](https://github.com/nvie/gitflow/blob/develop/git-flow#L78)).
Here we replace `grep -f <(cmd1) <(cmd2)` with `cmd2 | grep -F "$(cmd1)"` so that we can provide a string instead of a file descriptor and get the same result as before.
(Note: We also check if the result of `cmd1` is empty before running `grep` to get the same behavior as with `-f`. This also prevent crashes if null results are piped to `xargs` and fits nicely with the `with_shim_executable` function that already check the result of `$selected_version` before going on).
Fixes: #581
`asdf install <name>` installs that single tool at the version specified
in `.tool-versions`. If there is no `.tool-versions` or if that tool is
not in it, an error message is shown and `asdf` exits `1`.
Implements #759
Rename custom scripts for `plugin-add` and `plugin-remove` phases in plugins to make clear when they are executed:
`plugin-add` -> `post-plugin-add`
`plugin-remove` -> `pre-plugin-remove`
If asdf-vm was installed with a package manager and the user doesn't
have the necessary permissions to update it with `asdf update`, asdf-vm
emits an informational message and exits with exit code 1.
This makes it hard to programmatically detect whether the update failed
or wasn't even attempted because it's not possible.
With this change, asdf-vm would exit with the exit code 42 if updates are
disabled instead of exit code 1, which signals an error during update.
Refs r-darwish/topgrade#367
Previously, the shims directory was only excluded for system versions,
which meant that `asdf exec` would fall back to a shim if the install
didn't have the desired binary. If the shims are up to date this isn't a
problem since we check the metadata, but it causes issues if those are
out of sync for whatever reason.
I've checked all the uses of this function and I'm not seeing anywhere
we should need the old behavior.
It's possible for plugins to define new asdf commands. This way plugins can extend asdf capabilities or expose utilities related to their managed tool.
For example, a `foo` plugin might expose the command `asdf foo bar` by providing an executable file at `bin/bar`.
If `bin/bar` is a file but has no executable bit set, then its considered a source-able bash script, and will be sourced
with all the functions in `$ASDF_DIR/lib/utils.sh` already loaded.
A good example of this feature is the `nodejs` plugin, where people must import the release team keyring before
installing a nodejs version. People can execute the following command without having to know where exactly is the plugin located.
- remove test for install command edge case from parsing tool-versions (no longer relevant)
- add test for install command honoring legacy version files
- clean up test names to differentiate between installing a single version vs all dependencies
The current behavior in shims is to check if there's an existing shim for
which the shim we're currently checking is a prefix. For example, if the shim
has
# asdf-plugin: erlang 21.2.6
Then adding a shim for `erlang 21.2` will fail.
This updates the `grep` check to match the end of the line as well so we
always get a full version check.
Fixes#517