Skip to content

Commit

Permalink
delete unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ityuany committed Jul 12, 2024
1 parent 1fd9fa9 commit d9e7e76
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 66 deletions.
9 changes: 1 addition & 8 deletions crates/snm_core/src/model/dispatch_manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,7 @@ impl DispatchManage {
let from_dir_path_buf = self.manager.get_runtime_dir_path_buf(&v)?;
let to_dir_path_buf = self.manager.get_runtime_dir_for_default_path_buf(&v)?;

create_symlink(&from_dir_path_buf, &to_dir_path_buf).expect(
format!(
"set_default create_symlink error from: {:?} to: {:?}",
&from_dir_path_buf.display(),
&to_dir_path_buf.display()
)
.as_str(),
);
create_symlink(&from_dir_path_buf, &to_dir_path_buf)?;

Ok(())
}
Expand Down
10 changes: 0 additions & 10 deletions crates/snm_core/src/traits/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ pub trait AtomTrait {

fn get_downloaded_file_path_buf(&self, v: &str) -> Result<PathBuf, SnmError>;

// fn get_downloaded_dir_path_buf(&self, v: &str) -> Result<PathBuf, SnmError>;

fn get_runtime_dir_path_buf(&self, v: &str) -> Result<PathBuf, SnmError>;

fn get_runtime_dir_for_default_path_buf(&self, v: &str) -> Result<PathBuf, SnmError>;
Expand All @@ -26,8 +24,6 @@ pub trait AtomTrait {
downloaded_file_path_buf: &'a PathBuf,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'a>>;

// fn get_host(&self) -> Option<String>;

fn show_list<'a>(
&'a self,
dir_tuple: &'a (Vec<String>, Option<String>),
Expand All @@ -50,12 +46,6 @@ pub trait AtomTrait {
output_dir_path_buf: &PathBuf,
) -> Result<(), SnmError>;

// fn get_strict_shim_binary_path_buf(
// &self,
// bin_name: &str,
// version: &str,
// ) -> Result<PathBuf, SnmError>;

fn download_condition(&self, version: &str) -> bool;

fn get_runtime_binary_dir_string(&self, version: &str) -> Result<String, SnmError>;
Expand Down
23 changes: 0 additions & 23 deletions crates/snm_node/src/snm_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,11 @@ impl AtomTrait for SnmNode {
self.snm_config
.get_node_bin_dir()?
.join(&version)
// .join(format!("node-v{}-{}-{}", &version, get_os(), get_arch()))
.join("bin")
.join("node")
.to_ok()
}

// fn get_strict_shim_binary_path_buf(
// &self,
// bin_name: &str,
// version: &str,
// ) -> Result<PathBuf, SnmError> {
// self.get_runtime_binary_file_path_buf(&bin_name, &version)
// }

fn download_condition(&self, version: &str) -> bool {
match self.snm_config.get_node_install_strategy() {
InstallStrategy::Ask => Confirm::new()
Expand All @@ -196,7 +187,6 @@ impl AtomTrait for SnmNode {
fn get_runtime_binary_dir_string(&self, version: &str) -> Result<String, SnmError> {
Ok(self
.get_runtime_dir_path_buf(&version)?
// .join(format!("node-v{}-{}-{}", &version, get_os(), get_arch()))
.join("bin")
.display()
.to_string())
Expand All @@ -208,7 +198,6 @@ impl AtomTrait for SnmNode {
version: &str,
) -> Result<PathBuf, SnmError> {
self.get_runtime_dir_path_buf(&version)?
// .join(format!("node-v{}-{}-{}", &version, get_os(), get_arch()))
.join("bin")
.join(bin_name)
.to_ok()
Expand All @@ -228,14 +217,6 @@ impl AtomTrait for SnmNode {
download_url
}

// fn get_downloaded_dir_path_buf(&self, v: &str) -> Result<PathBuf, SnmError> {
// self.snm_config
// .get_download_dir()?
// .join("node")
// .join(v)
// .to_ok()
// }

fn get_downloaded_file_path_buf(&self, v: &str) -> Result<PathBuf, SnmError> {
self.snm_config
.get_download_dir()?
Expand Down Expand Up @@ -307,10 +288,6 @@ impl AtomTrait for SnmNode {
})
}

// fn get_host(&self) -> Option<String> {
// None
// }

fn show_list<'a>(
&'a self,
dir_tuple: &'a (Vec<String>, Option<String>),
Expand Down
25 changes: 0 additions & 25 deletions crates/snm_package_manager/src/snm_package_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,10 @@ impl AtomTrait for SnmPackageManager {
.get_node_modules_dir()?
.join(&self.library_name)
.join(v)
// .join("package")
.join("package.json")
.to_ok()
}

// fn get_strict_shim_binary_path_buf(
// &self,
// bin_name: &str,
// version: &str,
// ) -> Result<PathBuf, SnmError> {
// self.get_runtime_binary_file_path_buf(&bin_name, &version)?
// .to_ok()
// }

fn download_condition(&self, version: &str) -> bool {
match self.snm_config.get_package_manager_install_strategy() {
InstallStrategy::Ask => {
Expand Down Expand Up @@ -88,7 +78,6 @@ impl AtomTrait for SnmPackageManager {
.get_node_modules_dir()?
.join(self.library_name.to_string())
.join(&version)
// .join("package")
.join("bin")
.display()
.to_string())
Expand All @@ -104,7 +93,6 @@ impl AtomTrait for SnmPackageManager {
.get_node_modules_dir()?
.join(self.library_name.to_string())
.join(&version);
// .join("package");

match parse_package_json(&package_json_dir_buf_path)? {
Some(mut p) if p.bin.contains_key(bin_name) => Ok(p.bin.remove(bin_name).unwrap()),
Expand Down Expand Up @@ -144,14 +132,6 @@ impl AtomTrait for SnmPackageManager {
.to_ok()
}

// fn get_downloaded_dir_path_buf(&self, v: &str) -> Result<PathBuf, SnmError> {
// self.snm_config
// .get_download_dir()?
// .join(&self.library_name)
// .join(&v)
// .to_ok()
// }

fn get_runtime_dir_path_buf(&self, v: &str) -> Result<PathBuf, SnmError> {
let library_name = if &self.library_name == "@yarnpkg/cli-dist" {
"yarn"
Expand Down Expand Up @@ -237,10 +217,6 @@ impl AtomTrait for SnmPackageManager {
})
}

// fn get_host(&self) -> Option<String> {
// todo!("get_host")
// }

fn show_list<'a>(
&'a self,
dir_tuple: &'a (Vec<String>, Option<String>),
Expand Down Expand Up @@ -322,7 +298,6 @@ impl AtomTrait for SnmPackageManager {
output_dir_path_buf: &PathBuf,
) -> Result<(), SnmError> {
decompress(&input_file_path_buf, &output_dir_path_buf)?;
// let package_dir_path_buf = output_dir_path_buf.join("package");
if let Some(package_json) = parse_package_json(&output_dir_path_buf)? {
let bin = output_dir_path_buf.join("bin");

Expand Down

0 comments on commit d9e7e76

Please sign in to comment.