@@ -2,11 +2,11 @@ use std::error::Error;
2
2
use std:: path:: { Path , PathBuf } ;
3
3
use yaml_rust:: { Yaml , YamlEmitter , YamlLoader } ;
4
4
5
- /// List of directories containing files to expand. The first tuple element is the source
6
- /// directory , while the second tuple element is the destination directory .
5
+ /// List of files to expand. The first tuple element is the source
6
+ /// file , while the second tuple element is the destination file .
7
7
#[ rustfmt:: skip]
8
8
static TO_EXPAND : & [ ( & str , & str ) ] = & [
9
- ( "src/ci/github-actions" , ".github/workflows" ) ,
9
+ ( "src/ci/github-actions/ci.yml " , ".github/workflows/ci.yml " ) ,
10
10
] ;
11
11
12
12
/// Name of a special key that will be removed from all the maps in expanded configuration files.
@@ -62,27 +62,20 @@ impl App {
62
62
fn run ( & self ) -> Result < ( ) , Box < dyn Error > > {
63
63
for ( source, dest) in TO_EXPAND {
64
64
let source = self . base . join ( source) ;
65
- let dest = self . base . join ( dest) ;
66
- for entry in std:: fs:: read_dir ( & source) ? {
67
- let path = entry?. path ( ) ;
68
- if !path. is_file ( ) || path. extension ( ) . and_then ( |e| e. to_str ( ) ) != Some ( "yml" ) {
69
- continue ;
70
- }
71
-
72
- let dest_path = dest. join ( path. file_name ( ) . unwrap ( ) ) ;
73
- self . expand ( & path, & dest_path) . with_context ( || match self . mode {
74
- Mode :: Generate => format ! (
75
- "failed to expand {} into {}" ,
76
- self . path( & path) ,
77
- self . path( & dest_path)
78
- ) ,
79
- Mode :: Check => format ! (
80
- "{} is not up to date; please run \
65
+ let dest_path = self . base . join ( dest) ;
66
+
67
+ self . expand ( & source, & dest_path) . with_context ( || match self . mode {
68
+ Mode :: Generate => format ! (
69
+ "failed to expand {} into {}" ,
70
+ self . path( & source) ,
71
+ self . path( & dest_path)
72
+ ) ,
73
+ Mode :: Check => format ! (
74
+ "{} is not up to date; please run \
81
75
`x.py run src/tools/expand-yaml-anchors`.",
82
- self . path( & dest_path)
83
- ) ,
84
- } ) ?;
85
- }
76
+ self . path( & dest_path)
77
+ ) ,
78
+ } ) ?;
86
79
}
87
80
Ok ( ( ) )
88
81
}
0 commit comments