diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-04-27 19:59:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-27 19:59:17 -0400 |
| commit | 6fe2c24be0ec916abeb4875e424d82531706e812 (patch) | |
| tree | 315b8c196726e7ec729bd38d578e7e2b2cd6df97 /src/tools | |
| parent | f469c4a611c7984fece1aa38845c6cb0e580a933 (diff) | |
| parent | a517a961868dbd069ed7804a54e5bd7cb1d3f1e6 (diff) | |
| download | rust-6fe2c24be0ec916abeb4875e424d82531706e812.tar.gz rust-6fe2c24be0ec916abeb4875e424d82531706e812.zip | |
Rollup merge of #41572 - frewsxcv:bump-mdbook, r=steveklabnik
Bump mdbook dep to pick up new 'create missing' toggle feature. This will avoid obscure Travis CI error messages: * https://github.com/rust-lang/rust/pull/40290#issuecomment-294137045 Original mdbook issue: * https://github.com/azerupi/mdBook/issues/253 mdbook PR: * https://github.com/azerupi/mdBook/pull/254
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/rustbook/Cargo.toml | 2 | ||||
| -rw-r--r-- | src/tools/rustbook/src/main.rs | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index e3209330672..2d5d163d403 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -8,5 +8,5 @@ license = "MIT/Apache-2.0" clap = "2.19.3" [dependencies.mdbook] -version = "0.0.19" +version = "0.0.21" default-features = false diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index b77baed5326..33326de9c1c 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -53,8 +53,7 @@ fn main() { // Build command implementation fn build(args: &ArgMatches) -> Result<(), Box<Error>> { - let book_dir = get_book_dir(args); - let book = MDBook::new(&book_dir).read_config(); + let book = build_mdbook_struct(args); let mut book = match args.value_of("dest-dir") { Some(dest_dir) => book.set_dest(Path::new(dest_dir)), @@ -67,14 +66,26 @@ fn build(args: &ArgMatches) -> Result<(), Box<Error>> { } fn test(args: &ArgMatches) -> Result<(), Box<Error>> { - let book_dir = get_book_dir(args); - let mut book = MDBook::new(&book_dir).read_config(); + let mut book = build_mdbook_struct(args); try!(book.test()); Ok(()) } +fn build_mdbook_struct(args: &ArgMatches) -> mdbook::MDBook { + let book_dir = get_book_dir(args); + let mut book = MDBook::new(&book_dir).read_config(); + + // By default mdbook will attempt to create non-existent files referenced + // from SUMMARY.md files. This is problematic on CI where we mount the + // source directory as readonly. To avoid any issues, we'll disabled + // mdbook's implicit file creation feature. + book.create_missing = false; + + book +} + fn get_book_dir(args: &ArgMatches) -> PathBuf { if let Some(dir) = args.value_of("dir") { // Check if path is relative from current dir, or absolute... |
