@@ -32,6 +32,7 @@ pub struct Configuration {
3232 pub ignored_definitions : HashMap < String , HashSet < PathBuf > > ,
3333 pub autoload_roots : HashMap < PathBuf , String > ,
3434 pub inflections_path : PathBuf ,
35+ pub readme_template_path : PathBuf ,
3536 pub custom_associations : Vec < String > ,
3637 pub stdin_file_path : Option < PathBuf > ,
3738 // Note that it'd probably be better to use the logger library, `tracing` (see logger.rs)
@@ -139,6 +140,12 @@ pub(crate) fn from_raw(
139140 . unwrap_or ( PathBuf :: from ( "config/initializers/inflections.rb" ) ) ,
140141 ) ;
141142
143+ let readme_template_path = absolute_root. join (
144+ raw_config
145+ . readme_template_path
146+ . unwrap_or ( PathBuf :: from ( "README_TEMPLATE.md" ) ) ,
147+ ) ;
148+
142149 let custom_associations = raw_config
143150 . custom_associations
144151 . iter ( )
@@ -162,6 +169,7 @@ pub(crate) fn from_raw(
162169 ignored_definitions,
163170 autoload_roots,
164171 inflections_path,
172+ readme_template_path,
165173 custom_associations,
166174 stdin_file_path : None ,
167175 print_files : false ,
@@ -370,7 +378,11 @@ mod tests {
370378
371379 assert_eq ! ( expected_packs, actual. pack_set. packs) ;
372380
373- assert ! ( !actual. cache_enabled)
381+ assert ! ( !actual. cache_enabled) ;
382+
383+ let expected_readme_template_path =
384+ absolute_root. join ( "README_TEMPLATE.md" ) ;
385+ assert_eq ! ( actual. readme_template_path, expected_readme_template_path) ;
374386 }
375387
376388 #[ test]
@@ -456,4 +468,16 @@ mod tests {
456468
457469 assert_eq ! ( actual_associations, expected_paths) ;
458470 }
471+
472+ #[ test]
473+ fn with_readme_template_path ( ) {
474+ let absolute_root =
475+ PathBuf :: from ( "tests/fixtures/app_with_custom_readme" ) ;
476+ let actual = configuration:: get ( & absolute_root) . unwrap ( ) ;
477+
478+ let actual_readme_template_path = actual. readme_template_path ;
479+ let expected_readme_template_path =
480+ absolute_root. join ( "config/packs/README_EXAMPLE.md" ) ;
481+ assert_eq ! ( actual_readme_template_path, expected_readme_template_path) ;
482+ }
459483}
0 commit comments