-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #550 from hydephp/develop
v0.40.0-beta
- Loading branch information
Showing
15 changed files
with
475 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Actions\PostBuildTasks; | ||
|
||
use Hyde\Framework\Contracts\AbstractBuildTask; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class GenerateSitemap extends AbstractBuildTask | ||
{ | ||
public static string $description = 'Generating sitemap'; | ||
|
||
public function run(): void | ||
{ | ||
Artisan::call('build:sitemap'); | ||
} | ||
|
||
public function then(): void | ||
{ | ||
$this->writeln("\n".' > Created <info>sitemap.xml</info> in '.$this->getExecutionTime()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Contracts; | ||
|
||
use Illuminate\Console\Concerns\InteractsWithIO; | ||
use Illuminate\Console\OutputStyle; | ||
|
||
/** | ||
* @experimental This feature was recently added and may be changed without notice. | ||
* | ||
* @since 0.40.0 | ||
*/ | ||
abstract class AbstractBuildTask implements BuildTaskContract | ||
{ | ||
use InteractsWithIO; | ||
|
||
protected static string $description = 'Generic build task'; | ||
|
||
protected float $timeStart; | ||
|
||
public function __construct(?OutputStyle $output = null) | ||
{ | ||
$this->output = $output; | ||
$this->timeStart = microtime(true); | ||
} | ||
|
||
public function handle(): void | ||
{ | ||
$this->write('<comment>'.$this->getDescription().'...</comment> '); | ||
|
||
$this->run(); | ||
$this->then(); | ||
|
||
$this->write("\n"); | ||
} | ||
|
||
abstract public function run(): void; | ||
|
||
public function then(): void | ||
{ | ||
$this->writeln('<fg=gray>Done in '.$this->getExecutionTime().'</>'); | ||
} | ||
|
||
public function getDescription(): string | ||
{ | ||
return static::$description; | ||
} | ||
|
||
public function getExecutionTime(): string | ||
{ | ||
return number_format((microtime(true) - $this->timeStart) * 1000, 2).'ms'; | ||
} | ||
|
||
public function write(string $message): void | ||
{ | ||
$this->output?->write($message); | ||
} | ||
|
||
public function writeln(string $message): void | ||
{ | ||
$this->output?->writeln($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Contracts; | ||
|
||
use Illuminate\Console\OutputStyle; | ||
|
||
/** | ||
* @experimental This feature was recently added and may be changed without notice. | ||
* | ||
* @since 0.40.0 | ||
*/ | ||
interface BuildTaskContract | ||
{ | ||
public function __construct(?OutputStyle $output = null); | ||
|
||
public function run(): void; | ||
|
||
public function then(): void; | ||
|
||
public function handle(): void; | ||
|
||
public function getDescription(): string; | ||
|
||
public function getExecutionTime(): string; | ||
} |
Oops, something went wrong.