generated from red-explosion/laravel-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edeb11b
commit 2f1f791
Showing
6 changed files
with
93 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RedExplosion\Fabricate\Actions; | ||
|
||
use Symfony\Component\Process\Process; | ||
|
||
class RemoveComposerPackagesAction | ||
{ | ||
/** | ||
* @param array<int, string> $packages | ||
*/ | ||
public function handle(array $packages, bool $asDev = false): bool | ||
{ | ||
$command = array_merge( | ||
['composer', 'remove'], | ||
$packages, | ||
$asDev ? ['--dev'] : [], | ||
); | ||
|
||
return (new Process($command, base_path(), ['COMPOSER_MEMORY_LIMIT' => '-1'])) | ||
->setTimeout(null) | ||
->run() === 0; | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RedExplosion\Fabricate\Modules\Default\Tasks; | ||
|
||
use Illuminate\Filesystem\Filesystem; | ||
use RedExplosion\Fabricate\Data\InstallData; | ||
use RedExplosion\Fabricate\Task; | ||
use Symfony\Component\Process\Process; | ||
|
||
class InstallPest extends Task | ||
{ | ||
public function __construct( | ||
protected readonly Filesystem $filesystem, | ||
) { | ||
} | ||
|
||
public function progressLabel(): string | ||
{ | ||
return 'Installing Pest'; | ||
} | ||
|
||
public function perform(InstallData $data): void | ||
{ | ||
if ($this->filesystem->exists('tests/Pest.php')) { | ||
return; | ||
} | ||
|
||
(new Process(['./vendor/bin/pest', '--init']))->run(); | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RedExplosion\Fabricate\Modules\Default\Tasks; | ||
|
||
use RedExplosion\Fabricate\Actions\RemoveComposerPackagesAction; | ||
use RedExplosion\Fabricate\Data\InstallData; | ||
use RedExplosion\Fabricate\Task; | ||
|
||
class RemoveComposerDependencies extends Task | ||
{ | ||
public function __construct( | ||
protected readonly RemoveComposerPackagesAction $removeComposerPackages, | ||
) { | ||
} | ||
|
||
public function progressLabel(): string | ||
{ | ||
return 'Removing Composer dependencies'; | ||
} | ||
|
||
public function perform(InstallData $data): void | ||
{ | ||
$this->removeComposerPackages->handle([ | ||
'phpunit/phpunit', | ||
], asDev: true); | ||
} | ||
} |