Skip to content

Commit

Permalink
remove download_condition fn
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 17, 2024
1 parent b050515 commit 3ea825c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 51 deletions.
11 changes: 0 additions & 11 deletions crates/snm_core/src/traits/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, SnmError>;

fn get_anchor_file_path_buf(&self, v: &str) -> Result<PathBuf, SnmError>;
Expand Down Expand Up @@ -73,13 +71,4 @@ pub trait AtomTrait {

Ok((dir_name_vec, default_dir))
}

fn get_default_version(&self) -> Result<Option<String>, SnmError> {
if self.get_snm_config().get_strict() {
return Ok(None);
} else {
let (_, default_v) = self.read_runtime_dir_name_vec()?;
Ok(default_v)
}
}
}
17 changes: 0 additions & 17 deletions crates/snm_node/src/snm_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, SnmError> {
Ok(self
.get_runtime_dir_path_buf(&version)?
Expand Down
23 changes: 0 additions & 23 deletions crates/snm_package_manager/src/snm_package_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, SnmError> {
Ok(self
.snm_config
Expand Down

0 comments on commit 3ea825c

Please sign in to comment.