Set source_file on jobs when created from a job file
This commit is contained in:
parent
fef475c8ad
commit
d2866c3f37
|
@ -16,6 +16,7 @@ pub struct Job {
|
||||||
pub last_run: Option<Instant>,
|
pub last_run: Option<Instant>,
|
||||||
pub output_file: Option<PathBuf>,
|
pub output_file: Option<PathBuf>,
|
||||||
pub channel: Option<rss::Channel>,
|
pub channel: Option<rss::Channel>,
|
||||||
|
pub source_file: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Job {
|
impl Job {
|
||||||
|
@ -28,6 +29,7 @@ impl Job {
|
||||||
last_run: None,
|
last_run: None,
|
||||||
output_file: None,
|
output_file: None,
|
||||||
channel: None,
|
channel: None,
|
||||||
|
source_file: None,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +108,7 @@ impl Job {
|
||||||
if job.output_file.is_none() {
|
if job.output_file.is_none() {
|
||||||
job.set_default_output_file(conf);
|
job.set_default_output_file(conf);
|
||||||
}
|
}
|
||||||
|
job.source_file = Some(PathBuf::from(path));
|
||||||
return Ok(job);
|
return Ok(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +211,7 @@ selector = section.listing:nth-child(2) > ul:nth-child(1) > li:nth-child(3) > he
|
||||||
assert_eq!(job.output_file.unwrap().to_str().unwrap(), "results.d/http:--example.com-test.rss");
|
assert_eq!(job.output_file.unwrap().to_str().unwrap(), "results.d/http:--example.com-test.rss");
|
||||||
assert_eq!(job.every.as_secs(), 7200);
|
assert_eq!(job.every.as_secs(), 7200);
|
||||||
assert_eq!(job.selector, "section.listing:nth-child(2) > ul:nth-child(1) > li:nth-child(3) > header:nth-child(3) > h2:nth-child(1) > a:nth-child(1)");
|
assert_eq!(job.selector, "section.listing:nth-child(2) > ul:nth-child(1) > li:nth-child(3) > header:nth-child(3) > h2:nth-child(1) > a:nth-child(1)");
|
||||||
|
assert_eq!(job.source_file.unwrap().to_str(), tf.path().to_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue