Skip to content

Commit

Permalink
addr review
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasir Shariff committed Nov 29, 2023
1 parent 594cd91 commit 9b5c536
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 46 deletions.
39 changes: 0 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ tokio = { version = "1", features = ["process"] }
binary-install = "0.2.0"
fs2 = "0.4"
home = "0.5.5"
regex = "1.5"

[features]
global_install = []
9 changes: 3 additions & 6 deletions crate/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use anyhow::{anyhow, Context};
use binary_install::Cache;
use fs2::FileExt;
use regex::Regex;
use tokio::process::{Child, Command};

use std::fs::File;
Expand Down Expand Up @@ -76,10 +75,8 @@ pub fn bin_path(version: &str) -> anyhow::Result<PathBuf> {
Ok(buf)
}

pub fn normalize_name<S: AsRef<str>>(input: S) -> String {
// replace occurrences of '/' with '_'
let re = Regex::new(r"/").unwrap();
re.replace_all(input.as_ref(), "_").to_string()
fn normalize_name(input: &str) -> String {
input.replace('/', "_")
}

/// Install the sandbox node given the version, which is either a commit hash or tagged version
Expand All @@ -105,7 +102,7 @@ pub fn install_with_version(version: &str) -> anyhow::Result<PathBuf> {

// Move near-sandbox binary to correct location from temp folder.
let dest = download_path(version).join("near-sandbox");
std::fs::rename(path.clone(), &dest)?;
std::fs::rename(path, &dest)?;

Ok(dest)
}
Expand Down

0 comments on commit 9b5c536

Please sign in to comment.