asdf-vm / asdf-vm/asdf

`asdf install` should install even when missing a plugin listed in `.tool-versions`

Open
#1,254 5 comments 12 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
25.6k
Forks
941
Avg merge
9h 24m
Merged PRs (30d)
3

Description

### Is your feature request related to a problem? Please describe

I experienced a problem where the [order of installation of two plugins matters](https://github.com/jonathanmorley/asdf-bundler/issues/6#issuecomment-1098031139). In trying to reproduce this problem, by repeatedly adding/removing plugins and installing again, I noticed that because we are using `legacy_version_file = yes` in our `~/.asdfrc`, `$ asdf install` does not error out if you are missing a plugin whose version is defined in a legacy version file.

example environment:
```
$ cat .tool-versions
pnpm 7.1.5
bundler 2.3.5
$ cat .ruby-version
2.7.5
```
(the `.ruby-version` file being the legacy file for `asdf-ruby`)

If I fail to install any of the plugins in `.tool-versions`:
```
$ asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
$ asdf plugin add bundler https://github.com/jonathanmorley/asdf-bundler.git
$ asdf install
pnpm plugin is not installed
```

But if I fail to install the ruby plugin:
```
$ asdf plugin add bundler https://github.com/jonathanmorley/asdf-bundler.git
$ asdf plugin add pnpm https://github.com/jonathanmorley/asdf-pnpm
$ asdf install

```

I expected the behavior to be consistent in these two scenarios.

### Describe the proposed solution

Looks like asdf checks for missing plugins here:
https://github.com/asdf-vm/asdf/blob/b94ac1d6c8f19b4142d0a6f52f63397e12b2d954/lib/functions/installs.bash#L93-L107
So that code may be extended to look for legacy version files?

However, I write this as a feature request because, while debugging my problems with asdf bundler I found it very convenient for asdf to skip installing when I was missing plugins. I could simply type `$ asdf install` when I was done adding (or re-adding) plugins.

Some of my coworkers would also rather use `gem install` than asdf to manage their `bundler` version. The current situation is that they need to keep typing `$ asdf install ` for every plugin, which is pretty annoying.

With this in mind, I to propose that `$ asdf install` should be more lenient and stop requiring *every* plugin to be installed. Perhaps we could print a warning to alert you that you are missing a plugin instead of stopping you.

It makes a lot of sense to me, at least, to `cd` into a project directory and run `$ asdf install` if I know I already have the necessary plugins.

Perhaps the `.tool-versions` could be extended to allow us to specify required/optional plugins manually?

### Describe similar `asdf` features and why they are not sufficient

I'm not aware of any similiar features which would solve this.

### Describe other workarounds you've considered

I could add a legacy file parser to the `asdf-bundler` and move our version specification out of `.tool-versions` in order to make it an optional tool for my coworkers.

Contributor guide

Open the contributing guide

Research direction

Start with lib/functions/installs.bash around the missing-plugin check at lines 93-107, then trace how legacy version files are discovered and handled. Reproduce the two `asdf install` scenarios from the issue and determine the intended warning or skip behavior for missing plugins, including whether optional plugins need explicit syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.