Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ editLink: false
| btrace | [asdf:joschi/asdf-btrace](https://github.com/joschi/asdf-btrace) |
| buf | [ubi:bufbuild/buf](https://github.com/bufbuild/buf) [asdf:truepay/asdf-buf](https://github.com/truepay/asdf-buf) |
| buildpack | [asdf:johnlayton/asdf-buildpack](https://github.com/johnlayton/asdf-buildpack) |
| bun | [core:bun](https://mise.jdx.dev/lang/bun.html) [vfox:ahai-code/vfox-bun](https://github.com/ahai-code/vfox-bun) |
| bun | [core:bun](https://mise.jdx.dev/lang/bun.html) |
| bundler | [asdf:jonathanmorley/asdf-bundler](https://github.com/jonathanmorley/asdf-bundler) |
| cabal | [asdf:sestrella/asdf-ghcup](https://github.com/sestrella/asdf-ghcup) |
Expand Down Expand Up @@ -169,6 +170,7 @@ editLink: false
| dbmate | [asdf:juusujanar/asdf-dbmate](https://github.com/juusujanar/asdf-dbmate) |
| deck | [asdf:nutellinoit/asdf-deck](https://github.com/nutellinoit/asdf-deck) |
| delta | [ubi:dandavison/delta](https://github.com/dandavison/delta) [asdf:andweeb/asdf-delta](https://github.com/andweeb/asdf-delta) |
| deno | [core:deno](https://mise.jdx.dev/lang/deno.html) [vfox:version-fox/vfox-deno](https://github.com/version-fox/vfox-deno) |
| deno | [core:deno](https://mise.jdx.dev/lang/deno.html) |
| dep | [asdf:paxosglobal/asdf-dep](https://github.com/paxosglobal/asdf-dep) |
| depot | [asdf:depot/asdf-depot](https://github.com/depot/asdf-depot) |
Expand Down Expand Up @@ -218,6 +220,7 @@ editLink: false
| envcli | [asdf:zekker6/asdf-envcli](https://github.com/zekker6/asdf-envcli) |
| envsubst | [asdf:dex4er/asdf-envsubst](https://github.com/dex4er/asdf-envsubst) |
| ephemeral-postgres | [asdf:smashedtoatoms/asdf-ephemeral-postgres](https://github.com/smashedtoatoms/asdf-ephemeral-postgres) |
| erlang | [core:erlang](https://mise.jdx.dev/lang/erlang.html) [asdf:asdf-vm/asdf-erlang](https://github.com/asdf-vm/asdf-erlang) [vfox:version-fox/vfox-erlang](https://github.com/version-fox/vfox-erlang) |
| erlang | [core:erlang](https://mise.jdx.dev/lang/erlang.html) |
| esc | [asdf:fxsalazar/asdf-esc](https://github.com/fxsalazar/asdf-esc) |
| esy | [asdf:asdf-community/asdf-esy](https://github.com/asdf-community/asdf-esy) |
Expand Down Expand Up @@ -271,6 +274,7 @@ editLink: false
| glen | [asdf:bradym/asdf-glen](https://github.com/bradym/asdf-glen) |
| glooctl | [asdf:halilkaya/asdf-glooctl](https://github.com/halilkaya/asdf-glooctl) |
| glow | [asdf:mise-plugins/asdf-glow](https://github.com/mise-plugins/asdf-glow) |
| go | [core:go](https://mise.jdx.dev/lang/go.html) [vfox:version-fox/vfox-golang](https://github.com/version-fox/vfox-golang) |
| go | [core:go](https://mise.jdx.dev/lang/go.html) |
| go-containerregistry | [asdf:dex4er/asdf-go-containerregistry](https://github.com/dex4er/asdf-go-containerregistry) |
| go-getter | [asdf:ryodocx/asdf-go-getter](https://github.com/ryodocx/asdf-go-getter) |
Expand Down Expand Up @@ -348,6 +352,7 @@ editLink: false
| io | [asdf:mracos/asdf-io](https://github.com/mracos/asdf-io) |
| istioctl | [asdf:virtualstaticvoid/asdf-istioctl](https://github.com/virtualstaticvoid/asdf-istioctl) |
| janet | [asdf:Jakski/asdf-janet](https://github.com/Jakski/asdf-janet) |
| java | [core:java](https://mise.jdx.dev/lang/java.html) [vfox:version-fox/vfox-java](https://github.com/version-fox/vfox-java) |
| java | [core:java](https://mise.jdx.dev/lang/java.html) |
| jb | [asdf:beardix/asdf-jb](https://github.com/beardix/asdf-jb) |
| jbang | [asdf:jbangdev/jbang-asdf](https://github.com/jbangdev/jbang-asdf) |
Expand Down Expand Up @@ -511,6 +516,7 @@ editLink: false
| nfpm | [ubi:goreleaser/nfpm](https://github.com/goreleaser/nfpm) [asdf:ORCID/asdf-nfpm](https://github.com/ORCID/asdf-nfpm) |
| nim | [asdf:asdf-community/asdf-nim](https://github.com/asdf-community/asdf-nim) |
| ninja | [asdf:asdf-community/asdf-ninja](https://github.com/asdf-community/asdf-ninja) |
| node | [core:node](https://mise.jdx.dev/lang/node.html) [vfox:version-fox/vfox-nodejs](https://github.com/version-fox/vfox-nodejs) |
| node | [core:node](https://mise.jdx.dev/lang/node.html) |
| nomad | [asdf:asdf-community/asdf-hashicorp](https://github.com/asdf-community/asdf-hashicorp) |
| nomad-pack | [asdf:asdf-community/asdf-hashicorp](https://github.com/asdf-community/asdf-hashicorp) |
Expand Down Expand Up @@ -586,6 +592,7 @@ editLink: false
| purerl | [asdf:GoNZooo/asdf-purerl](https://github.com/GoNZooo/asdf-purerl) |
| purescript | [asdf:jrrom/asdf-purescript](https://github.com/jrrom/asdf-purescript) |
| purty | [asdf:nsaunders/asdf-purty](https://github.com/nsaunders/asdf-purty) |
| python | [core:python](https://mise.jdx.dev/lang/python.html) [vfox:version-fox/vfox-python](https://github.com/version-fox/vfox-python) |
| python | [core:python](https://mise.jdx.dev/lang/python.html) |
| qdns | [asdf:moritz-makandra/asdf-plugin-qdns](https://github.com/moritz-makandra/asdf-plugin-qdns) |
| quarkus | [asdf:asdf-community/asdf-quarkus](https://github.com/asdf-community/asdf-quarkus) |
Expand Down Expand Up @@ -616,6 +623,7 @@ editLink: false
| rlwrap | [asdf:asdf-community/asdf-rlwrap](https://github.com/asdf-community/asdf-rlwrap) |
| rome | [asdf:kichiemon/asdf-rome](https://github.com/kichiemon/asdf-rome) |
| rstash | [asdf:carlduevel/asdf-rstash](https://github.com/carlduevel/asdf-rstash) |
| ruby | [core:ruby](https://mise.jdx.dev/lang/ruby.html) [vfox:yanecc/vfox-ruby](https://github.com/yanecc/vfox-ruby) |
| ruby | [core:ruby](https://mise.jdx.dev/lang/ruby.html) |
| ruff | [ubi:astral-sh/ruff](https://github.com/astral-sh/ruff) [asdf:simhem/asdf-ruff](https://github.com/simhem/asdf-ruff) |
| rust | [asdf:code-lever/asdf-rust](https://github.com/code-lever/asdf-rust) |
Expand Down Expand Up @@ -814,6 +822,7 @@ editLink: false
| zbctl | [asdf:camunda-community-hub/asdf-zbctl](https://github.com/camunda-community-hub/asdf-zbctl) |
| zellij | [ubi:zellij-org/zellij](https://github.com/zellij-org/zellij) [asdf:chessmango/asdf-zellij](https://github.com/chessmango/asdf-zellij) |
| zephyr | [asdf:nsaunders/asdf-zephyr](https://github.com/nsaunders/asdf-zephyr) |
| zig | [core:zig](https://mise.jdx.dev/lang/zig.html) [asdf:cheetah/asdf-zig](https://github.com/cheetah/asdf-zig) [vfox:version-fox/vfox-zig](https://github.com/version-fox/vfox-zig) |
| zig | [core:zig](https://mise.jdx.dev/lang/zig.html) |
| zigmod | [asdf:mise-plugins/asdf-zigmod](https://github.com/mise-plugins/asdf-zigmod) |
| zola | [ubi:getzola/zola](https://github.com/getzola/zola) [asdf:salasrod/asdf-zola](https://github.com/salasrod/asdf-zola) |
Expand Down
15 changes: 5 additions & 10 deletions e2e/cli/test_link
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/usr/bin/env bash

# Systematically installed by run_test
rm "$MISE_DATA_DIR/plugins/dummy"
mise install tiny@1.0.1 tiny@3.1.0
mkdir -p tmp/tiny
mise link tiny@9.8.7 tmp/tiny

mise plugins ln "$ROOT"/test/data/plugins/dummy
assert_contains "mise plugins" "dummy"
assert_contains "mise ls tiny" "tiny 9.8.7 (symlink)"

assert_fail "mise plugins link $ROOT/test/data/plugins/dummy"
mise plugins link -f "$ROOT"/test/data/plugins/dummy
assert_contains "mise plugins" "dummy"

mise plugins rm dummy
assert_not_contains "mise plugins" "dummy"
mise uninstall tiny@9.8.7
File renamed without changes.
4 changes: 4 additions & 0 deletions e2e/plugins/test_plugin_update
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

mise plugin install tiny https://github.com/mise-plugins/rtx-tiny.git
mise plugins update tiny
10 changes: 10 additions & 0 deletions e2e/tools/test_runtime_symlinks
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

mise i dummy@1.0.1 dummy@1.0.2 dummy@1.10.0 dummy@2.0.0 dummy@2.1.0
assert "ls -l $MISE_DATA_DIR/installs/dummy | grep '\->' | awk '{print \$(NF-2),\$(NF)}'" "1 ./1.10.0
1.0 ./1.0.2
1.10 ./1.10.0
2 ./2.1.0
2.0 ./2.0.0
2.1 ./2.1.0
latest ./2.1.0"
1 change: 1 addition & 0 deletions registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ newrelic-cli = ["ubi:newrelic/newrelic-cli[exe=newrelic]", "asdf:NeoHsu/asdf-new
nfpm = ["ubi:goreleaser/nfpm", "asdf:ORCID/asdf-nfpm"]
nim = ["asdf:asdf-community/asdf-nim"]
ninja = ["asdf:asdf-community/asdf-ninja"]
node = ["core:node", "vfox:version-fox/vfox-nodejs"]
nomad = ["asdf:asdf-community/asdf-hashicorp"]
nomad-pack = ["asdf:asdf-community/asdf-hashicorp"]
notation = ["asdf:bodgit/asdf-notation"]
Expand Down
7 changes: 4 additions & 3 deletions src/backend/aqua.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::aqua::aqua_registry::{AquaPackage, AquaPackageType, AQUA_REGISTRY};
use crate::backend::{Backend, BackendType};
use crate::backend::backend_type::BackendType;
use crate::backend::Backend;
use crate::cache::{CacheManager, CacheManagerBuilder};
use crate::cli::args::BackendArg;
use crate::cli::version::{ARCH, OS};
Expand Down Expand Up @@ -27,7 +28,7 @@ impl Backend for AquaBackend {
BackendType::Aqua
}

fn fa(&self) -> &BackendArg {
fn ba(&self) -> &BackendArg {
&self.ba
}

Expand Down Expand Up @@ -123,7 +124,7 @@ impl Backend for AquaBackend {

impl AquaBackend {
pub fn from_arg(ba: BackendArg) -> Self {
let mut id = ba.full.strip_prefix("aqua:").unwrap_or(&ba.full);
let mut id = ba.tool_name.as_str();
if !id.contains("/") {
id = REGISTRY
.get(id)
Expand Down
53 changes: 20 additions & 33 deletions src/backend/asdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ use std::fmt::{Debug, Formatter};
use std::fs;
use std::hash::{Hash, Hasher};
use std::path::{Path, PathBuf};
use std::sync::Arc;

use color_eyre::eyre::{eyre, Result, WrapErr};
use console::style;

use crate::backend::backend_type::BackendType;
use crate::backend::external_plugin_cache::ExternalPluginCache;
use crate::backend::{ABackend, Backend, BackendList};
use crate::backend::Backend;
use crate::cache::{CacheManager, CacheManagerBuilder};
use crate::cli::args::BackendArg;
use crate::config::{Config, SETTINGS};
use crate::env_diff::{EnvDiff, EnvDiffOperation};
use crate::git::Git;
use crate::hash::hash_to_str;
use crate::install_context::InstallContext;
use crate::plugins::asdf_plugin::AsdfPlugin;
Expand All @@ -23,7 +22,7 @@ use crate::plugins::Script::{Download, ExecEnv, Install, ParseLegacyFile};
use crate::plugins::{Plugin, PluginType, Script, ScriptManager};
use crate::toolset::{ToolRequest, ToolVersion, Toolset};
use crate::ui::progress_report::SingleReport;
use crate::{dirs, env, file, plugins};
use crate::{env, file};

/// This represents a plugin installed to ~/.local/share/mise/plugins
pub struct AsdfBackend {
Expand All @@ -42,12 +41,8 @@ pub struct AsdfBackend {

impl AsdfBackend {
pub fn from_arg(ba: BackendArg) -> Self {
let name = ba
.full
.strip_prefix("asdf:")
.unwrap_or(&ba.full)
.to_string();
let plugin_path = dirs::PLUGINS.join(&name);
let name = ba.tool_name.clone();
let plugin_path = ba.plugin_path.clone();
let mut toml_path = plugin_path.join("mise.plugin.toml");
if plugin_path.join("rtx.plugin.toml").exists() {
toml_path = plugin_path.join("rtx.plugin.toml");
Expand Down Expand Up @@ -80,7 +75,13 @@ impl AsdfBackend {
.with_fresh_file(plugin_path.join("bin/list-legacy-filenames"))
.build(),
plugin_path,
plugin: Box::new(AsdfPlugin::new(name.clone())),
plugin: Box::new(AsdfPlugin::new(
ba.plugin_path
.file_name()
.unwrap()
.to_string_lossy()
.to_string(),
)),
repo_url: None,
toml,
name,
Expand All @@ -91,19 +92,6 @@ impl AsdfBackend {
&*self.plugin
}

pub fn list() -> Result<BackendList> {
Ok(plugins::INSTALLED_PLUGINS
.iter()
// if metadata.lua exists it's a vfox plugin (hopefully)
.filter(|(_, pt)| matches!(pt, PluginType::Asdf))
.map(|(d, _)| {
Arc::new(Self::from_arg(
d.file_name().unwrap().to_string_lossy().into(),
)) as ABackend
})
.collect())
}

fn fetch_cached_legacy_file(&self, legacy_file: &Path) -> Result<Option<String>> {
let fp = self.legacy_cache_file_path(legacy_file);
if !fp.exists() || fp.metadata()?.modified()? < legacy_file.metadata()?.modified()? {
Expand Down Expand Up @@ -244,16 +232,20 @@ impl Hash for AsdfBackend {
}

impl Backend for AsdfBackend {
fn fa(&self) -> &BackendArg {
fn ba(&self) -> &BackendArg {
&self.ba
}

fn get_plugin_type(&self) -> PluginType {
PluginType::Asdf
fn get_type(&self) -> BackendType {
BackendType::Asdf
}

fn get_plugin_type(&self) -> Option<PluginType> {
Some(PluginType::Asdf)
}

fn get_dependencies(&self, tvr: &ToolRequest) -> Result<Vec<BackendArg>> {
let out = match tvr.backend().name.as_str() {
let out = match tvr.ba().tool_name.as_str() {
"poetry" | "pipenv" | "pipx" => vec!["python"],
"elixir" => vec!["erlang"],
_ => vec![],
Expand Down Expand Up @@ -288,11 +280,6 @@ impl Backend for AsdfBackend {
.cloned()
}

fn get_remote_url(&self) -> Option<String> {
let git = Git::new(&self.plugin_path);
git.get_remote_url().or_else(|| self.repo_url.clone())
}

fn get_aliases(&self) -> Result<BTreeMap<String, String>> {
if let Some(data) = &self.toml.list_aliases.data {
return Ok(self.plugin.parse_aliases(data).into_iter().collect());
Expand Down
83 changes: 0 additions & 83 deletions src/backend/backend_meta.rs

This file was deleted.

55 changes: 55 additions & 0 deletions src/backend/backend_type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
use std::fmt::{Display, Formatter};

#[derive(
Debug,
PartialEq,
Eq,
Hash,
Clone,
Copy,
strum::EnumString,
strum::EnumIter,
strum::AsRefStr,
Ord,
PartialOrd,
)]
#[strum(serialize_all = "snake_case")]
pub enum BackendType {
Aqua,
Asdf,
Cargo,
Core,
Go,
Npm,
Pipx,
Spm,
Ubi,
Vfox,
Unknown,
}

impl Display for BackendType {
fn fmt(&self, formatter: &mut Formatter) -> std::fmt::Result {
write!(formatter, "{}", format!("{:?}", self).to_lowercase())
}
}

impl BackendType {
pub fn guess(s: &str) -> BackendType {
let s = s.split(':').next().unwrap_or(s);
let s = s.split('-').next().unwrap_or(s);
match s {
"aqua" => BackendType::Aqua,
"asdf" => BackendType::Asdf,
"cargo" => BackendType::Cargo,
"core" => BackendType::Core,
"go" => BackendType::Go,
"npm" => BackendType::Npm,
"pipx" => BackendType::Pipx,
"spm" => BackendType::Spm,
"ubi" => BackendType::Ubi,
"vfox" => BackendType::Vfox,
_ => BackendType::Unknown,
}
}
}
Loading