File tree 5 files changed +14
-18
lines changed
5 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,6 @@ public function run(): void
20
20
21
21
public function then (): void
22
22
{
23
- $ this ->writeln (sprintf ("\n > Created <info>%s</info> in %s " ,
24
- RssFeedService::getDefaultOutputFilename (),
25
- $ this ->getExecutionTime ()
26
- ));
23
+ $ this ->createdSiteFile ('_site/ ' .RssFeedService::getDefaultOutputFilename ())->withExecutionTime ();
27
24
}
28
25
}
Original file line number Diff line number Diff line change @@ -31,15 +31,7 @@ public function run(): void
31
31
32
32
public function then (): void
33
33
{
34
- $ this ->writeln (sprintf ("\n > Created <info>%s</info> in %s " ,
35
- $ this ->normalizePath (DocumentationSearchService::$ filePath ),
36
- $ this ->getExecutionTime ()
37
- ));
38
- }
39
-
40
- protected function normalizePath (string $ path ): string
41
- {
42
- return str_replace ('\\' , '/ ' , $ path );
34
+ $ this ->createdSiteFile (DocumentationSearchService::$ filePath )->withExecutionTime ();
43
35
}
44
36
45
37
/** @internal Estimated processing time per file in ms */
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ public function run(): void
20
20
21
21
public function then (): void
22
22
{
23
- $ this ->writeln (sprintf ("\n > Created <info>sitemap.xml</info> in %s " ,
24
- $ this ->getExecutionTime ()
25
- ));
23
+ $ this ->createdSiteFile ('_site/sitemap.xml ' )->withExecutionTime ();
26
24
}
27
25
}
Original file line number Diff line number Diff line change @@ -69,10 +69,19 @@ public function writeln(string $message): void
69
69
$ this ->output ?->writeln($ message );
70
70
}
71
71
72
- public function createdSiteFile (string $ path ): void
72
+ public function createdSiteFile (string $ path ): static
73
73
{
74
74
$ this ->write (sprintf ("\n > Created <info>%s</info> " ,
75
75
str_replace ('\\' , '/ ' , Hyde::pathToRelative ($ path ))
76
76
));
77
+
78
+ return $ this ;
79
+ }
80
+
81
+ public function withExecutionTime (): static
82
+ {
83
+ $ this ->write (" in {$ this ->getExecutionTime ()}" );
84
+
85
+ return $ this ;
77
86
}
78
87
}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public function test_build_command_can_run_post_build_tasks()
28
28
29
29
$ this ->artisan ('build ' )
30
30
->expectsOutputToContain ('Generating sitemap ' )
31
- ->expectsOutputToContain ('Created sitemap.xml ' )
31
+ ->expectsOutputToContain ('Created _site/ sitemap.xml ' )
32
32
->assertExitCode (0 );
33
33
34
34
File::cleanDirectory (Hyde::path ('_site ' ));
You can’t perform that action at this time.
0 commit comments