Skip to content

Commit

Permalink
fix: tempfile and tokio-test are categorized as dependencies (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurosakishigure authored Dec 16, 2024
1 parent 6879cab commit ef90244
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ inquire = "0.7.5"
rss = "2.0.11"
scraper = "0.22.0"
serde = { version = "1.0.216", features = ["derive"] }
tempfile = "3.14.0"
thiserror = "2.0.6"
tokio = { version = "1.42.0", features = ["fs", "io-util", "macros", "rt-multi-thread"] }
tokio-test = "0.4.4"
toml = "0.8.19"
url = { version = "2.5.4", features = ["serde"] }

[dev-dependencies]
tokio-test = "0.4.4"
tempfile = "3.14.0"
21 changes: 10 additions & 11 deletions src/arg/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,16 @@ pub async fn builder(config_path: &PathBuf) -> Result<Channel, Errors> {
}

println!("- create: {}", rss.output.to_string_lossy());
let mut rss_file = {
if rss.output == PathBuf::from("[temp]") {
File::from_std(tempfile::tempfile()?)
} else {
File::create(&rss.output).await?
}
};
let channel = channel_builder(rss, items);
rss_file.write_all(channel.to_string().as_ref()).await?;

Ok(channel)
if rss.output.as_os_str().is_empty() {
Ok(channel_builder(rss, items))
} else {
let mut rss_file = File::create(&rss.output).await?;
let channel = channel_builder(rss, items);

rss_file.write_all(channel.to_string().as_ref()).await?;

Ok(channel)
}
} else {
eprintln!("- {}", config_path.to_string_lossy());

Expand Down
2 changes: 1 addition & 1 deletion tests/katharsis.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ site_url = "https://nextjs.org"
image = "favicon.png"
copyright = "© 2024 Vercel Inc"
language = "en"
output = "[temp]"
output = ""

[article]
title = "h1"
Expand Down

0 comments on commit ef90244

Please sign in to comment.