Skip to content

Commit

Permalink
Merge branch '8.x' into 9.x
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Aug 12, 2024
2 parents f085fe5 + 126106b commit 657e4a5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve"
"@php vendor/bin/testbench serve --ansi"
],
"lint": [
"@php vendor/bin/pint --ansi",
Expand Down
30 changes: 19 additions & 11 deletions src/Console/DevToolCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,14 @@
use Orchestra\Workbench\Events\InstallStarted;
use Orchestra\Workbench\Workbench;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

use function Illuminate\Filesystem\join_paths;
use function Orchestra\Testbench\package_path;

#[AsCommand(name: 'workbench:devtool', description: 'Configure Workbench for package development')]
class DevToolCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'workbench:devtool
{--force : Overwrite any existing files}
{--skip-install : Skipped Workbench installation}';

/**
* Execute the console command.
*
Expand All @@ -44,10 +36,10 @@ public function handle(Filesystem $filesystem)
$this->prepareWorkbenchDirectories($filesystem, $workingPath);
$this->prepareWorkbenchNamespaces($filesystem, $workingPath);

if (! $this->option('skip-install')) {
if ($this->option('install') === true && $this->option('skip-install') === false) {
$this->call('workbench:install', [
'--force' => $this->option('force'),
'--skip-devtool' => true,
'--no-devtool' => true,
]);
}

Expand Down Expand Up @@ -260,4 +252,20 @@ protected function appendAutoloadDevToComposer(array $content, Filesystem $files

return $content;
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['force', 'f', InputOption::VALUE_NONE, 'Overwrite any existing files'],
['install', null, InputOption::VALUE_NEGATABLE, 'Run Workbench installation'],

/** @deprecated */
['skip-install', null, InputOption::VALUE_NONE, 'Skipped Workbench installation'],
];
}
}
33 changes: 22 additions & 11 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Collection;
use Orchestra\Testbench\Foundation\Console\Actions\GeneratesFile;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

use function Illuminate\Filesystem\join_paths;
use function Laravel\Prompts\confirm;
Expand All @@ -16,15 +17,6 @@
#[AsCommand(name: 'workbench:install', description: 'Setup Workbench for package development')]
class InstallCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'workbench:install
{--force : Overwrite any existing files}
{--skip-devtool : Skipped DevTool installation}';

/**
* The `testbench.yaml` default configuration file.
*/
Expand All @@ -38,12 +30,15 @@ class InstallCommand extends Command
public function handle(Filesystem $filesystem)
{
if (! $this->option('skip-devtool')) {
$devtool = confirm('Install Workbench DevTool?', true);
$devtool = match (true) {
\is_bool($this->option('devtool')) => $this->option('devtool'),
default => confirm('Install Workbench DevTool?', true),
};

if ($devtool === true) {
$this->call('workbench:devtool', [
'--force' => $this->option('force'),
'--skip-install' => true,
'--no-install' => true,
]);
}
}
Expand Down Expand Up @@ -165,4 +160,20 @@ protected function environmentFiles(): array
"{$environmentFile}.dist",
];
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['force', 'f', InputOption::VALUE_NONE, 'Overwrite any existing files'],
['devtool', null, InputOption::VALUE_NEGATABLE, 'Run DevTool installation'],

/** @deprecated */
['skip-devtool', null, InputOption::VALUE_NONE, 'Skipped DevTool installation'],
];
}
}

0 comments on commit 657e4a5

Please sign in to comment.