@@ -53,8 +53,7 @@ fn main() {
53
53
54
54
// Build command implementation
55
55
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) ;
58
57
59
58
let mut book = match args. value_of ( "dest-dir" ) {
60
59
Some ( dest_dir) => book. set_dest ( Path :: new ( dest_dir) ) ,
@@ -67,14 +66,26 @@ fn build(args: &ArgMatches) -> Result<(), Box<Error>> {
67
66
}
68
67
69
68
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) ;
72
70
73
71
try!( book. test ( ) ) ;
74
72
75
73
Ok ( ( ) )
76
74
}
77
75
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
+
78
89
fn get_book_dir ( args : & ArgMatches ) -> PathBuf {
79
90
if let Some ( dir) = args. value_of ( "dir" ) {
80
91
// Check if path is relative from current dir, or absolute...
0 commit comments