Skip to content
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
1 change: 1 addition & 0 deletions .changepacks/changepack_log_2zpAg1mt6UJkXYIaDgFBc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"changes":{"crates/vespertide-config/Cargo.toml":"Patch","crates/vespertide-cli/Cargo.toml":"Patch","crates/vespertide-macro/Cargo.toml":"Patch","crates/vespertide-loader/Cargo.toml":"Patch","crates/vespertide/Cargo.toml":"Patch","crates/vespertide-query/Cargo.toml":"Patch","crates/vespertide-exporter/Cargo.toml":"Patch","crates/vespertide-core/Cargo.toml":"Patch","crates/vespertide-planner/Cargo.toml":"Patch","crates/vespertide-naming/Cargo.toml":"Patch"},"note":"Add vespertide postfix","date":"2026-01-06T18:05:49.242282600Z"}
12 changes: 6 additions & 6 deletions crates/vespertide-cli/src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn cmd_new(name: String, format: Option<FileFormat>) -> Result<()> {
};

let schema_url = schema_url_for(format);
let path = dir.join(format!("{name}.{ext}"));
let path = dir.join(format!("{name}.vespertide.{ext}"));
if path.exists() {
bail!("model file already exists: {}", path.display());
}
Expand Down Expand Up @@ -134,7 +134,7 @@ mod tests {
cmd_new("users".into(), None).unwrap();

let cfg = VespertideConfig::default();
let path = cfg.models_dir().join("users.json");
let path = cfg.models_dir().join("users.vespertide.json");
assert!(path.exists());

let text = fs::read_to_string(path).unwrap();
Expand All @@ -159,7 +159,7 @@ mod tests {
model_format: FileFormat::Yaml,
..VespertideConfig::default()
};
let path = cfg.models_dir().join("orders.yaml");
let path = cfg.models_dir().join("orders.vespertide.yaml");
assert!(path.exists());

let text = fs::read_to_string(path).unwrap();
Expand All @@ -185,7 +185,7 @@ mod tests {
model_format: FileFormat::Yml,
..VespertideConfig::default()
};
let path = cfg.models_dir().join("products.yml");
let path = cfg.models_dir().join("products.vespertide.yml");
assert!(path.exists());

let text = fs::read_to_string(path).unwrap();
Expand All @@ -206,12 +206,12 @@ mod tests {

let cfg = VespertideConfig::default();
std::fs::create_dir_all(cfg.models_dir()).unwrap();
let path = cfg.models_dir().join("users.json");
let path = cfg.models_dir().join("users.vespertide.json");
std::fs::write(&path, "{}").unwrap();

let err = cmd_new("users".into(), None).unwrap_err();
let msg = err.to_string();
assert!(msg.contains("model file already exists"));
assert!(msg.contains("users.json"));
assert!(msg.contains("users.vespertide.json"));
}
}
10 changes: 5 additions & 5 deletions crates/vespertide-cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn migration_filename_with_format_and_pattern(
FileFormat::Yml => "yml",
};

format!("{name}.{ext}")
format!("{name}.vespertide.{ext}")
}

fn sanitize_comment(comment: Option<&str>) -> String {
Expand Down Expand Up @@ -260,11 +260,11 @@ mod tests {
Some("Hello! World"),
FileFormat::Yml,
"%04v_%m",
"0005_hello__world.yml"
"0005_hello__world.vespertide.yml"
)]
#[case(3, None, FileFormat::Json, "%0v__", "0003.json")] // width 0 falls back to default version and trailing separators are trimmed
#[case(12, None, FileFormat::Json, "%v", "0012.json")]
#[case(7, None, FileFormat::Json, "%m", "0007.json")] // uses default when comment only and empty
#[case(3, None, FileFormat::Json, "%0v__", "0003.vespertide.json")] // width 0 falls back to default version and trailing separators are trimmed
#[case(12, None, FileFormat::Json, "%v", "0012.vespertide.json")]
#[case(7, None, FileFormat::Json, "%m", "0007.vespertide.json")] // uses default when comment only and empty
fn migration_filename_with_format_and_pattern_tests(
#[case] version: u32,
#[case] comment: Option<&str>,
Expand Down