File tree Expand file tree Collapse file tree
tools/upgrade-version/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,24 +11,23 @@ use std::path::PathBuf;
1111
1212fn process_license_file ( upgrade_version : & str ) {
1313 let path = "LICENSE.txt" ;
14- let contents = fs:: read_to_string ( path) . unwrap ( ) ;
14+ let file = fs:: read_to_string ( path) . unwrap ( ) ;
1515
1616 let version_re = Regex :: new ( r"(?m)^(Licensed Work:\s+SpacetimeDB )([\d\.]+)$" ) . unwrap ( ) ;
17- let date_re = Regex :: new ( r"(?m)^Change Date:\s+\d{4}-\d{2}-\d{2}$" ) . unwrap ( ) ;
18-
19- let updated = version_re. replace_all ( & contents, |caps : & regex:: Captures | {
17+ let file = version_re. replace_all ( & file, |caps : & regex:: Captures | {
2018 format ! ( "{}{}" , & caps[ 1 ] , upgrade_version)
2119 } ) ;
2220
21+ let date_re = Regex :: new ( r"(?m)^Change Date:\s+\d{4}-\d{2}-\d{2}$" ) . unwrap ( ) ;
2322 let new_date = Local :: now ( )
2423 . with_year ( Local :: now ( ) . year ( ) + 5 )
2524 . unwrap ( )
2625 . format ( "Change Date: %Y-%m-%d" )
2726 . to_string ( ) ;
2827
29- let final_text = date_re. replace_all ( & updated , new_date. as_str ( ) ) ;
28+ let file = date_re. replace_all ( & file , new_date. as_str ( ) ) ;
3029
31- fs:: write ( path, final_text . as_ref ( ) ) . unwrap ( ) ;
30+ fs:: write ( path, & * file ) . unwrap ( ) ;
3231}
3332
3433fn edit_toml ( path : impl AsRef < Path > , f : impl FnOnce ( & mut toml_edit:: DocumentMut ) ) -> anyhow:: Result < ( ) > {
You can’t perform that action at this time.
0 commit comments