Skip to content

Commit

Permalink
Don't require canonicalize when getting project name, version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
andriygm committed Oct 7, 2024
1 parent 17618cf commit 01eff29
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spackle"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
repository = "https://github.com/a2-ai/spackle"
description = "A frictionless project templating tool."
Expand Down
2 changes: 1 addition & 1 deletion src/core/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ mod tests {
".",
&HashMap::from([
("field_1".to_string(), "echo".to_string()),
("field_2".to_string(), "out1".to_string()),
("field_2".to_string(), "project".to_string()),
]),
&HashMap::new(),
None,
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ impl std::error::Error for GenerateError {
pub fn get_project_name(out_dir: &Path) -> String {
let path = match out_dir.canonicalize() {
Ok(path) => path,
Err(_) => "project".into(),
// If the path cannot be canonicalized (e.g. not created yet), we can ignore
Err(_) => out_dir.to_path_buf(),
};

path.file_stem()
.unwrap_or_default()
.unwrap_or("project".as_ref())
.to_string_lossy()
.to_string()
}
Expand Down

0 comments on commit 01eff29

Please sign in to comment.