Completely removed the `create_missing` option from MDBook
This commit is contained in:
parent
f993677626
commit
527fc5cf79
|
@ -118,7 +118,8 @@ impl MDBook {
|
||||||
pub fn write_file<P: AsRef<Path>>(&self, filename: P, content: &[u8]) -> Result<()> {
|
pub fn write_file<P: AsRef<Path>>(&self, filename: P, content: &[u8]) -> Result<()> {
|
||||||
let path = self.get_destination().join(filename);
|
let path = self.get_destination().join(filename);
|
||||||
|
|
||||||
utils::fs::create_file(&path)?.write_all(content)
|
utils::fs::create_file(&path)?
|
||||||
|
.write_all(content)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +150,8 @@ impl MDBook {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test(&mut self, library_paths: Vec<&str>) -> Result<()> {
|
pub fn test(&mut self, library_paths: Vec<&str>) -> Result<()> {
|
||||||
let library_args: Vec<&str> = (0..library_paths.len()).map(|_| "-L")
|
let library_args: Vec<&str> = (0..library_paths.len())
|
||||||
|
.map(|_| "-L")
|
||||||
.zip(library_paths.into_iter())
|
.zip(library_paths.into_iter())
|
||||||
.flat_map(|x| vec![x.0, x.1])
|
.flat_map(|x| vec![x.0, x.1])
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -158,7 +160,8 @@ impl MDBook {
|
||||||
if let BookItem::Chapter(ref ch) = *item {
|
if let BookItem::Chapter(ref ch) = *item {
|
||||||
if !ch.path.as_os_str().is_empty() {
|
if !ch.path.as_os_str().is_empty() {
|
||||||
let path = self.get_source().join(&ch.path);
|
let path = self.get_source().join(&ch.path);
|
||||||
let base = path.parent().ok_or_else(|| String::from("Invalid bookitem path!"))?;
|
let base = path.parent()
|
||||||
|
.ok_or_else(|| String::from("Invalid bookitem path!"))?;
|
||||||
let content = utils::fs::file_to_string(&path)?;
|
let content = utils::fs::file_to_string(&path)?;
|
||||||
// Parse and expand links
|
// Parse and expand links
|
||||||
let content = preprocess::links::replace_all(&content, base)?;
|
let content = preprocess::links::replace_all(&content, base)?;
|
||||||
|
@ -169,7 +172,8 @@ impl MDBook {
|
||||||
let mut tmpf = utils::fs::create_file(&path)?;
|
let mut tmpf = utils::fs::create_file(&path)?;
|
||||||
tmpf.write_all(content.as_bytes())?;
|
tmpf.write_all(content.as_bytes())?;
|
||||||
|
|
||||||
let output = Command::new("rustdoc").arg(&path)
|
let output = Command::new("rustdoc")
|
||||||
|
.arg(&path)
|
||||||
.arg("--test")
|
.arg("--test")
|
||||||
.args(&library_args)
|
.args(&library_args)
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
Loading…
Reference in New Issue