Skip to content

Commit 6fe2c24

Browse files
authored
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: * #40290 (comment) Original mdbook issue: * https://github.com/azerupi/mdBook/issues/253 mdbook PR: * https://github.com/azerupi/mdBook/pull/254
2 parents f469c4a + a517a96 commit 6fe2c24

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

src/Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/rustbook/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ license = "MIT/Apache-2.0"
88
clap = "2.19.3"
99

1010
[dependencies.mdbook]
11-
version = "0.0.19"
11+
version = "0.0.21"
1212
default-features = false

src/tools/rustbook/src/main.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ fn main() {
5353

5454
// Build command implementation
5555
fn build(args: &ArgMatches) -> Result<(), Box<Error>> {
56-
let book_dir = get_book_dir(args);
57-
let book = MDBook::new(&book_dir).read_config();
56+
let book = build_mdbook_struct(args);
5857

5958
let mut book = match args.value_of("dest-dir") {
6059
Some(dest_dir) => book.set_dest(Path::new(dest_dir)),
@@ -67,14 +66,26 @@ fn build(args: &ArgMatches) -> Result<(), Box<Error>> {
6766
}
6867

6968
fn test(args: &ArgMatches) -> Result<(), Box<Error>> {
70-
let book_dir = get_book_dir(args);
71-
let mut book = MDBook::new(&book_dir).read_config();
69+
let mut book = build_mdbook_struct(args);
7270

7371
try!(book.test());
7472

7573
Ok(())
7674
}
7775

76+
fn build_mdbook_struct(args: &ArgMatches) -> mdbook::MDBook {
77+
let book_dir = get_book_dir(args);
78+
let mut book = MDBook::new(&book_dir).read_config();
79+
80+
// By default mdbook will attempt to create non-existent files referenced
81+
// from SUMMARY.md files. This is problematic on CI where we mount the
82+
// source directory as readonly. To avoid any issues, we'll disabled
83+
// mdbook's implicit file creation feature.
84+
book.create_missing = false;
85+
86+
book
87+
}
88+
7889
fn get_book_dir(args: &ArgMatches) -> PathBuf {
7990
if let Some(dir) = args.value_of("dir") {
8091
// Check if path is relative from current dir, or absolute...

0 commit comments

Comments
 (0)