-
-
Notifications
You must be signed in to change notification settings - Fork 962
fix(auto-install): support installing non-active backend versions #6484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Test that not_found_auto_install works when a tool is already configured but not installed | ||
| # Reproduces https://github.com/jdx/mise/discussions/6482#discussioncomment-14552091 | ||
|
|
||
| # Test 1: hook-not-found auto-install | ||
| # Set up: Install tiny@3.1.0 globally | ||
| mise use -g tiny@3.1.0 | ||
| assert "mise current tiny" "3.1.0" | ||
|
|
||
| # Create a project that requires a different version (tiny@3.0.0) | ||
| cat >mise.toml <<EOF | ||
| [tools] | ||
| tiny = "3.0.0" | ||
| EOF | ||
|
|
||
| # Uninstall the required version to simulate it being missing | ||
| mise uninstall tiny@3.0.0 || true | ||
|
|
||
| # Verify it's not installed | ||
| assert_fail "mise ls tiny --installed | grep 3.0.0" | ||
|
|
||
| # Simulate the hook-not-found behavior: rtx-tiny is requested but not installed | ||
| # This should auto-install tiny@3.0.0 (note: tiny plugin provides rtx-tiny binary) | ||
| mise hook-not-found rtx-tiny && mise current tiny | grep -q "3.0.0" | ||
| assert_contains "mise ls tiny --installed" "3.0.0" | ||
|
|
||
| # Clean up for next test | ||
| rm -f mise.toml | ||
| mise uninstall tiny@3.0.0 | ||
|
|
||
| # Test 2: shim auto-install | ||
| # Set up: Install tiny@3.1.0 globally, configure tiny@3.0.0 locally (not installed) | ||
| cat >mise.toml <<EOF | ||
| [tools] | ||
| tiny = "3.0.0" | ||
| EOF | ||
|
|
||
| # Verify it's not installed | ||
| assert_fail "mise ls tiny --installed | grep 3.0.0" | ||
|
|
||
| # Add shims to PATH and run the shimmed binary | ||
| # This should auto-install tiny@3.0.0 via the shim | ||
| export PATH="$MISE_DATA_DIR/shims:$PATH" | ||
| rtx-tiny && mise current tiny | grep -q "3.0.0" | ||
| assert_contains "mise ls tiny --installed" "3.0.0" | ||
|
|
||
| # Clean up | ||
| rm -f mise.toml | ||
| mise use -g --rm tiny | ||
| mise uninstall tiny --all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
list_installed_versionscall is made for every iteration of the loop, but it's called outside the loop. However, the loop iterates over all backends and callslist_versions_by_plugin()which could be expensive. Consider caching the result or restructuring to avoid redundant lookups if this method is called frequently.