Skip to content

Commit a7179c4

Browse files
emmadesilvagithub-actions[bot]
authored andcommitted
Improve wording of changelog hydephp/develop@b448e5f
1 parent 9392826 commit a7179c4

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/Console/Commands/RebuildPageCommand.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,21 @@
2525

2626
/**
2727
* Build a single static site file.
28+
*
29+
* @deprecated This command is deprecated and will be removed in HydePHP v3.0. Use \Hyde\Framework\Actions\StaticPageBuilder::handle() instead.
2830
*/
2931
class RebuildPageCommand extends Command
3032
{
3133
/** @var string */
3234
protected $signature = 'rebuild {path : The relative file path (example: _posts/hello-world.md)}';
3335

3436
/** @var string */
35-
protected $description = 'Run the static site builder for a single file';
37+
protected $description = 'Run the static site builder for a single file [Deprecated, will be removed in v3.0]';
3638

3739
public function handle(): int
3840
{
41+
$this->printDeprecationWarning();
42+
3943
if ($this->argument('path') === Hyde::getMediaDirectory()) {
4044
return (new TransferMediaAssets())->run($this->output);
4145

@@ -47,6 +51,16 @@ public function handle(): int
4751
return $this->makeBuildTask($this->output, $this->getNormalizedPathString())->run();
4852
}
4953

54+
/**
55+
* @deprecated The `rebuild` command is deprecated and will be removed in HydePHP v3.0.
56+
*/
57+
protected function printDeprecationWarning(): void
58+
{
59+
$this->warn('The `rebuild` command is deprecated and will be removed in HydePHP v3.0.');
60+
$this->line('If you need to build a single page programmatically, use Hyde\Framework\Actions\StaticPageBuilder::handle() instead.');
61+
$this->newLine();
62+
}
63+
5064
protected function getNormalizedPathString(): string
5165
{
5266
return str_replace('\\', '/', unslash($this->argument('path')));

tests/Feature/Commands/RebuildPageCommandTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ public function testHandleIsSuccessfulWithValidPath()
2323
$this->resetSite();
2424
}
2525

26+
public function testCommandOutputsDeprecationWarning()
27+
{
28+
$this->file('_pages/test-page.md', 'foo');
29+
30+
$this->artisan('rebuild _pages/test-page.md')
31+
->expectsOutput('The `rebuild` command is deprecated and will be removed in HydePHP v3.0.')
32+
->expectsOutput('If you need to build a single page programmatically, use Hyde\Framework\Actions\StaticPageBuilder::handle() instead.')
33+
->assertExitCode(0);
34+
35+
$this->resetSite();
36+
}
37+
2638
public function testMediaFilesCanBeTransferred()
2739
{
2840
$this->directory(Hyde::path('_site/media'));

0 commit comments

Comments
 (0)