From 3ea825c338d8872240365595bb8c506ff0325c03 Mon Sep 17 00:00:00 2001 From: ityuany <519495771@qq.com> Date: Wed, 17 Jul 2024 16:33:00 +0800 Subject: [PATCH] remove download_condition fn --- crates/snm_core/src/traits/atom.rs | 11 --------- crates/snm_node/src/snm_node.rs | 17 -------------- .../src/snm_package_manager.rs | 23 ------------------- 3 files changed, 51 deletions(-) diff --git a/crates/snm_core/src/traits/atom.rs b/crates/snm_core/src/traits/atom.rs index ec60b176..2ad7aeb1 100644 --- a/crates/snm_core/src/traits/atom.rs +++ b/crates/snm_core/src/traits/atom.rs @@ -30,8 +30,6 @@ pub trait AtomTrait { output_dir_path_buf: &PathBuf, ) -> Result<(), SnmError>; - fn download_condition(&self, version: &str) -> bool; - fn get_runtime_binary_dir_string(&self, version: &str) -> Result; fn get_anchor_file_path_buf(&self, v: &str) -> Result; @@ -73,13 +71,4 @@ pub trait AtomTrait { Ok((dir_name_vec, default_dir)) } - - fn get_default_version(&self) -> Result, SnmError> { - if self.get_snm_config().get_strict() { - return Ok(None); - } else { - let (_, default_v) = self.read_runtime_dir_name_vec()?; - Ok(default_v) - } - } } diff --git a/crates/snm_node/src/snm_node.rs b/crates/snm_node/src/snm_node.rs index c53a9cb5..d9a55bba 100644 --- a/crates/snm_node/src/snm_node.rs +++ b/crates/snm_node/src/snm_node.rs @@ -480,23 +480,6 @@ impl AtomTrait for SnmNode { .to_ok() } - fn download_condition(&self, version: &str) -> bool { - match self.snm_config.get_node_install_strategy() { - InstallStrategy::Ask => Confirm::new() - .with_prompt(format!( - "🤔 {} is not installed, do you want to install it ?", - &version - )) - .interact() - .expect("download_condition Confirm error"), - InstallStrategy::Panic => { - let msg = format!("Unsupported version: {}", version); - panic!("{msg}"); - } - InstallStrategy::Auto => true, - } - } - fn get_runtime_binary_dir_string(&self, version: &str) -> Result { Ok(self .get_runtime_dir_path_buf(&version)? diff --git a/crates/snm_package_manager/src/snm_package_manager.rs b/crates/snm_package_manager/src/snm_package_manager.rs index 2eae82da..34b06549 100644 --- a/crates/snm_package_manager/src/snm_package_manager.rs +++ b/crates/snm_package_manager/src/snm_package_manager.rs @@ -44,29 +44,6 @@ impl AtomTrait for SnmPackageManager { .to_ok() } - fn download_condition(&self, version: &str) -> bool { - match self.snm_config.get_package_manager_install_strategy() { - InstallStrategy::Ask => { - return Confirm::new() - .with_prompt(format!( - "🤔 {} is not installed, do you want to install it ?", - &version - )) - .interact() - .expect("download Confirm error") - } - InstallStrategy::Panic => { - let msg = format!( - "UnsupportedPackageManager {} {}", - self.library_name.to_string(), - version.to_string() - ); - panic!("{msg}"); - } - InstallStrategy::Auto => true, - } - } - fn get_runtime_binary_dir_string(&self, version: &str) -> Result { Ok(self .snm_config