rename subscriptions/rs as file/read.rs

This commit is contained in:
Paul Campbell 2023-07-29 19:23:03 +01:00
parent 5931014636
commit 87a53f8426
4 changed files with 8 additions and 5 deletions

4
src/file/mod.rs Normal file
View file

@ -0,0 +1,4 @@
mod env;
pub mod read;
pub use env::FileEnv;

View file

@ -27,7 +27,7 @@ mod tests {
//given //given
let (dir, file_name) = create_text_file( let (dir, file_name) = create_text_file(
"subscriptions.txt", "subscriptions.txt",
include_bytes!("../test/data/subscriptions.txt"), include_bytes!("../../test/data/subscriptions.txt"),
)?; )?;
let file_env = FileEnv::default(); let file_env = FileEnv::default();
@ -45,7 +45,7 @@ mod tests {
//given //given
let (dir, file_name) = create_text_file( let (dir, file_name) = create_text_file(
"subscriptions.txt", "subscriptions.txt",
include_bytes!("../test/data/subscriptions-blank-line.txt"), include_bytes!("../../test/data/subscriptions-blank-line.txt"),
)?; )?;
let file_env = FileEnv::default(); let file_env = FileEnv::default();
@ -63,7 +63,7 @@ mod tests {
//given //given
let (dir, file_name) = create_text_file( let (dir, file_name) = create_text_file(
"subscriptions.txt", "subscriptions.txt",
include_bytes!("../test/data/subscriptions-comment.txt"), include_bytes!("../../test/data/subscriptions-comment.txt"),
)?; )?;
let file_env = FileEnv::default(); let file_env = FileEnv::default();

View file

@ -4,7 +4,6 @@ pub mod fetch;
pub mod file; pub mod file;
pub mod history; pub mod history;
pub mod prelude; pub mod prelude;
mod subscriptions;
#[cfg(test)] #[cfg(test)]
mod test_utils; mod test_utils;
@ -23,7 +22,7 @@ pub struct Env {
} }
pub fn run(subscriptions: &str, history: &str, site: &str, e: Env) -> Result<()> { pub fn run(subscriptions: &str, history: &str, site: &str, e: Env) -> Result<()> {
for channel_name in subscriptions::lines_from(subscriptions, &e.file)? { for channel_name in file::read::lines_from(subscriptions, &e.file)? {
println!("Channel: {}", channel_name); println!("Channel: {}", channel_name);
let feed_url = (e.feed.find)(site, &channel_name, &e.fetch.get)?; let feed_url = (e.feed.find)(site, &channel_name, &e.fetch.get)?;
for entry in (e.feed.get)(&feed_url)?.entries() { for entry in (e.feed.get)(&feed_url)?.entries() {