Compare commits

..

5 Commits

Author SHA1 Message Date
Michael Bryan
2a5409db20 (cargo-release) version 0.0.28 2017-12-09 21:23:44 +11:00
Michael Bryan
dc89a82329 Merge pull request #506 from Michael-F-Bryan/quickfix
Added a quick fix so if the config isn't found we use a default
2017-12-09 21:18:34 +11:00
Michael Bryan
42ff5a895c Added a test to make sure book.toml isn't required 2017-12-09 20:46:39 +11:00
Michael Bryan
8ee795045a Added a quick fix so if the config isn't found we use a default 2017-12-09 20:36:23 +11:00
Michael Bryan
f22835f7bc (cargo-release) start next development iteration 0.0.28-alpha.0 2017-12-07 21:40:45 +11:00
3 changed files with 19 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "mdbook"
version = "0.0.27"
version = "0.0.28"
authors = ["Mathieu David <mathieudavid@mathieudavid.org>"]
description = "create books from markdown files (like Gitbook)"
documentation = "http://rust-lang-nursery.github.io/mdBook/index.html"

View File

@@ -299,8 +299,13 @@ impl MDBook {
pub fn read_config(mut self) -> Result<Self> {
let config_path = self.root.join("book.toml");
debug!("[*] Loading the config from {}", config_path.display());
self.config = Config::from_disk(&config_path)?;
if config_path.exists() {
debug!("[*] Loading the config from {}", config_path.display());
self.config = Config::from_disk(&config_path)?;
} else {
self.config = Config::default();
}
Ok(self)
}

View File

@@ -51,3 +51,14 @@ fn run_mdbook_init_with_custom_book_and_src_locations() {
assert!(target.exists(), "{} should have been created by `mdbook init`", file);
}
}
#[test]
fn book_toml_isnt_required() {
let temp = TempDir::new("mdbook").unwrap();
let mut md = MDBook::new(temp.path());
md.init().unwrap();
assert!(!temp.path().join("book.toml").exists());
md.read_config().unwrap().build().unwrap();
}