Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Oct 1, 2024
1 parent 7a7c158 commit 14b280c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"require": {
"php": "^8.2.0",
"ext-json": "*",
"illuminate/console": "^11.25",
"illuminate/support": "^11.25",
"illuminate/console": "^11.0",
"illuminate/support": "^11.0",
"laravel/fortify": "^1.20",
"mobiledetect/mobiledetectlib": "^4.8",
"symfony/console": "^7.0"
Expand Down
23 changes: 16 additions & 7 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

use function Illuminate\Support\php_binary;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\multiselect;
use function Laravel\Prompts\select;
Expand Down Expand Up @@ -398,7 +397,7 @@ protected function installInertiaStack()

// Middleware...
(new Filesystem)->ensureDirectoryExists(app_path('Http/Middleware'));
(new Process([php_binary(), 'artisan', 'inertia:middleware', 'HandleInertiaRequests', '--force'], base_path()))
(new Process([$this->phpBinary(), 'artisan', 'inertia:middleware', 'HandleInertiaRequests', '--force'], base_path()))
->setTimeout(null)
->run(function ($type, $output) {
$this->output->write($output);
Expand Down Expand Up @@ -657,13 +656,13 @@ protected function requireComposerPackages($packages)
$composer = $this->option('composer');

if ($composer !== 'global') {
$command = [php_binary(), $composer, 'require'];
$command = [$this->phpBinary(), $composer, 'require'];
}

$command = array_merge(
$command ?? ['composer', 'require'],
is_array($packages) ? $packages : func_get_args(),
['--update-with-dependencies'],
['--update-with-dependencies']
);

return ! (new Process($command, base_path(), ['COMPOSER_MEMORY_LIMIT' => '-1']))
Expand All @@ -684,7 +683,7 @@ protected function removeComposerDevPackages($packages)
$composer = $this->option('composer');

if ($composer !== 'global') {
$command = [php_binary(), $composer, 'remove', '--dev'];
$command = [$this->phpBinary(), $composer, 'remove', '--dev'];
}

$command = array_merge(
Expand All @@ -710,7 +709,7 @@ protected function requireComposerDevPackages($packages)
$composer = $this->option('composer');

if ($composer !== 'global') {
$command = [php_binary(), $composer, 'require', '--dev'];
$command = [$this->phpBinary(), $composer, 'require', '--dev'];
}

$command = array_merge(
Expand Down Expand Up @@ -763,7 +762,7 @@ protected static function updateNodePackages(callable $callback, $dev = true)
protected function runDatabaseMigrations()
{
if (confirm('New database migrations were added. Would you like to re-run your migrations?', true)) {
(new Process([php_binary(), 'artisan', 'migrate:fresh', '--force'], base_path()))
(new Process([$this->phpBinary(), 'artisan', 'migrate:fresh', '--force'], base_path()))
->setTimeout(null)
->run(function ($type, $output) {
$this->output->write($output);
Expand Down Expand Up @@ -797,6 +796,16 @@ protected function removeDarkClasses(Finder $finder)
}
}

/**
* Get the path to the appropriate PHP binary.
*
* @return string
*/
protected function phpBinary()
{
return (new PhpExecutableFinder())->find(false) ?: 'php';
}

/**
* Run the given commands.
*
Expand Down

0 comments on commit 14b280c

Please sign in to comment.