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
1 change: 0 additions & 1 deletion src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@ impl Ord for dyn Backend {
}
}

#[cfg(test)]
pub fn reset() {
*TOOLS.lock().unwrap() = None;
}
3 changes: 2 additions & 1 deletion src/cli/uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rayon::prelude::*;
use crate::backend::Backend;
use crate::cli::args::ToolArg;
use crate::config::Config;
use crate::toolset::{ToolRequest, ToolSource, ToolVersion, ToolsetBuilder};
use crate::toolset::{install_state, ToolRequest, ToolSource, ToolVersion, ToolsetBuilder};
use crate::ui::multi_progress_report::MultiProgressReport;
use crate::{dirs, file, lockfile, runtime_symlinks, shims};

Expand Down Expand Up @@ -66,6 +66,7 @@ impl Uninstall {
}
}

install_state::reset();
file::touch_dir(&dirs::DATA)?;
lockfile::update_lockfiles(&[]).wrap_err("failed to update lockfiles")?;
let ts = ToolsetBuilder::new().build(&config)?;
Expand Down
5 changes: 4 additions & 1 deletion src/cli/upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::cli::args::ToolArg;
use crate::config::{config_file, Config};
use crate::file::display_path;
use crate::toolset::{InstallOptions, OutdatedInfo, ResolveOptions, ToolVersion, ToolsetBuilder};
use crate::toolset::{
install_state, InstallOptions, OutdatedInfo, ResolveOptions, ToolVersion, ToolsetBuilder,
};
use crate::ui::multi_progress_report::MultiProgressReport;
use crate::ui::progress_report::SingleReport;
use crate::{lockfile, runtime_symlinks, shims, ui};
Expand Down Expand Up @@ -155,6 +157,7 @@ impl Upgrade {
self.uninstall_old_version(&o.tool_version, pr.as_ref())?;
}

install_state::reset();
lockfile::update_lockfiles(&versions).wrap_err("failed to update lockfiles")?;
let ts = ToolsetBuilder::new().with_args(&self.tool).build(config)?;
shims::reshim(&ts, false).wrap_err("failed to reshim")?;
Expand Down
1 change: 1 addition & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ impl Config {
}

pub fn rebuild_shims_and_runtime_symlinks(&self) -> Result<()> {
install_state::reset();
let ts = crate::toolset::ToolsetBuilder::new().build(self)?;
crate::shims::reshim(&ts, false)?;
crate::runtime_symlinks::rebuild(self)?;
Expand Down
3 changes: 2 additions & 1 deletion src/toolset/install_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::backend::backend_type::BackendType;
use crate::file::display_path;
use crate::plugins::PluginType;
use crate::registry::REGISTRY;
use crate::{dirs, file, runtime_symlinks};
use crate::{backend, dirs, file, runtime_symlinks};
use eyre::{Ok, Result};
use heck::ToKebabCase;
use itertools::Itertools;
Expand Down Expand Up @@ -229,4 +229,5 @@ static EMPTY_VEC: Vec<&'static str> = vec![];
pub fn reset() {
*INSTALL_STATE_PLUGINS.lock().unwrap() = None;
*INSTALL_STATE_TOOLS.lock().unwrap() = None;
backend::reset();
}