Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versions -> v1.2.3 (vs v.1.2.3); Cargo fmt #91

Merged
merged 1 commit into from
Oct 4, 2024
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
19 changes: 10 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use crate::installers::installer::Installer;
use crate::installers::pip::Pip;
use crate::installers::shell::Shell;
use crate::installers::single_binary_zip::SingleBinaryZip;
use crate::installers::symlink::Symlink;
use crate::installers::tarball::Tarball;
use crate::installers::zip::Zip;
use crate::installers::symlink::Symlink;

pub enum AppType {
SingleBinaryZip,
Expand All @@ -21,7 +21,7 @@ pub enum AppType {
Conda,
Pip,
Zip,
Symlink
Symlink,
}

pub struct App {
Expand Down Expand Up @@ -166,7 +166,7 @@ impl App {
};
Ok(())
})
.with_context(|| format!("While installing {} v.{}", &self.name, &self.version))?;
.with_context(|| format!("While installing {} v{}", &self.name, &self.version))?;

Ok(())
}
Expand Down Expand Up @@ -275,7 +275,7 @@ mod tests {
.expect("Failed to construct App");
assert_eq!(
single_binary_zip_app.installer.describe(),
"single binary zip installer for single_binary_zip_app v.1.10.1"
"single binary zip installer for single_binary_zip_app v1.10.1"
);
}

Expand All @@ -286,7 +286,7 @@ mod tests {
App::new(&"tarball_app".to_string(), &config).expect("Failed to construct App");
assert_eq!(
tarball_app.installer.describe(),
"tarball installer for tarball_app v.0.7.0"
"tarball installer for tarball_app v0.7.0"
);
}

Expand All @@ -297,7 +297,7 @@ mod tests {
App::new(&"shell_app".to_string(), &config).expect("Failed to construct App");
assert_eq!(
shell_app.installer.describe(),
"shell installer for shell_app v.4.11.0"
"shell installer for shell_app v4.11.0"
);
}

Expand Down Expand Up @@ -328,16 +328,17 @@ mod tests {
let file_app = App::new(&"file_app".to_string(), &config).expect("Failed to construct App");
assert_eq!(
file_app.installer.describe(),
"file installer for file_app v.6.6.0"
"file installer for file_app v6.6.0"
);
}
#[test]
fn symlink_test() {
let config = get_test_config();
let file_app = App::new(&"symlink_app".to_string(), &config).expect("Failed to construct App");
let file_app =
App::new(&"symlink_app".to_string(), &config).expect("Failed to construct App");
assert_eq!(
file_app.installer.describe(),
"symlink installer for symlink_app v.5.6.7"
"symlink installer for symlink_app v5.6.7"
);
}
}
2 changes: 1 addition & 1 deletion src/installers/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ impl Installer for File {
}

fn describe(&self) -> String {
format!("file installer for {} v.{}", self.name, self.version)
format!("file installer for {} v{}", self.name, self.version)
}
}
2 changes: 1 addition & 1 deletion src/installers/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ impl Installer for Shell {
}

fn describe(&self) -> String {
format!("shell installer for {} v.{}", self.name, self.version)
format!("shell installer for {} v{}", self.name, self.version)
}
}
2 changes: 1 addition & 1 deletion src/installers/single_binary_zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Installer for SingleBinaryZip {

fn describe(&self) -> String {
format!(
"single binary zip installer for {} v.{}",
"single binary zip installer for {} v{}",
self.name, self.version
)
}
Expand Down
15 changes: 11 additions & 4 deletions src/installers/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Symlink {
Ok(Symlink {
name: name.clone(),
version: version.to_string(),
path: path.to_owned()
path: path.to_owned(),
})
}
}
Expand All @@ -35,14 +35,21 @@ impl Installer for Symlink {
std::fs::create_dir_all(to_dir)?;

if !self.path.exists() {
return Err(anyhow!("Destination symlink {} doesn't exist", self.path.display()))
return Err(anyhow!(
"Destination symlink {} doesn't exist",
self.path.display()
));
}

let file = to_dir.join(&self.name);
std::os::unix::fs::symlink(&self.path, &file).context(anyhow!("Unable to symlink {} to {}", self.path.display(), file.display()))
std::os::unix::fs::symlink(&self.path, &file).context(anyhow!(
"Unable to symlink {} to {}",
self.path.display(),
file.display()
))
}

fn describe(&self) -> String {
format!("symlink installer for {} v.{}", self.name, self.version)
format!("symlink installer for {} v{}", self.name, self.version)
}
}
2 changes: 1 addition & 1 deletion src/installers/tarball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ impl Installer for Tarball {
}

fn describe(&self) -> String {
format!("tarball installer for {} v.{}", self.name, self.version)
format!("tarball installer for {} v{}", self.name, self.version)
}
}
2 changes: 1 addition & 1 deletion src/installers/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ impl Installer for Zip {
}

fn describe(&self) -> String {
format!("zip installer for {} v.{}", self.name, self.version)
format!("zip installer for {} v{}", self.name, self.version)
}
}
Loading