-
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.
Merge pull request #10 from fuelviews/decouple-deps-add-install-command
Decouple deps add install command
- Loading branch information
Showing
3 changed files
with
61 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,27 +15,19 @@ | |
"role": "Developer" | ||
} | ||
], | ||
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "[email protected]:fuelviews/laravel-forms.git" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.2", | ||
"illuminate/contracts": "^10.0 || ^11.0", | ||
"illuminate/support": "^10.0 || ^11.0", | ||
"spatie/laravel-package-tools": "^1.16", | ||
"ralphjsmit/laravel-glide": "^1.2.1", | ||
"fuelviews/laravel-forms": "^0.0" | ||
"spatie/laravel-package-tools": "^1.16" | ||
}, | ||
"require-dev": { | ||
"laravel/pint": "^1.14", | ||
"nunomaduro/collision": "^8.1.1||^7.10.0", | ||
"orchestra/testbench": "^9.0.0||^8.22.0", | ||
"pestphp/pest": "^2.34", | ||
"pestphp/pest-plugin-arch": "^2.7", | ||
"pestphp/pest-plugin-laravel": "^2.3" | ||
"pestphp/pest-plugin-laravel": "^2.3", | ||
"ralphjsmit/laravel-glide": "^1.2.1", | ||
"livewire/livewire": "^3.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
|
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,54 @@ | ||
<?php | ||
|
||
namespace Fuelviews\Navigation\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Symfony\Component\Process\Exception\ProcessFailedException; | ||
use Symfony\Component\Process\Process; | ||
|
||
class NavigationInstallCommand extends Command | ||
{ | ||
protected $signature = 'navigation:install'; | ||
|
||
protected $description = 'Install packages and dependencies'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$packages = [ | ||
'ralphjsmit/laravel-glide' => '^1.2', | ||
]; | ||
|
||
$requireCommand = 'composer require'; | ||
foreach ($packages as $package => $version) { | ||
$requireCommand .= " {$package}:{$version}"; | ||
} | ||
|
||
$this->info('Installing packages...'); | ||
|
||
$this->runShellCommand($requireCommand); | ||
|
||
$this->info('Packages installed successfully.'); | ||
} | ||
|
||
private function runShellCommand($command) | ||
{ | ||
$process = Process::fromShellCommandline($command); | ||
|
||
// Set the input to the process's standard input, allowing for interaction | ||
$process->setTty(Process::isTtySupported()); | ||
|
||
// Run the process | ||
$process->run(function ($type, $buffer) { | ||
$this->output->write($buffer); | ||
}); | ||
|
||
if (! $process->isSuccessful()) { | ||
throw new ProcessFailedException($process); | ||
} | ||
} | ||
} |
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