-
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
Showing
7 changed files
with
189 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace LaraGram\Foundation; | ||
|
||
class CoreCommand | ||
{ | ||
private array $commands = []; | ||
|
||
public function __construct() | ||
{ | ||
$this->registerBaseCommands(); | ||
} | ||
|
||
public function getCoreCommands(): array | ||
{ | ||
return $this->commands; | ||
} | ||
|
||
private function registerBaseCommands(): void | ||
{ | ||
foreach ($this->baseCommands() as $command) { | ||
$this->append($command); | ||
} | ||
} | ||
|
||
public function append($command): static | ||
{ | ||
$this->commands[] = $command; | ||
return $this; | ||
} | ||
|
||
private function baseCommands(): array | ||
{ | ||
return [ | ||
\LaraGram\Console\GenerateCommand::class, | ||
\LaraGram\Database\Factories\GenerateFactory::class, | ||
\LaraGram\Database\Migrations\GenerateMigration::class, | ||
\LaraGram\Database\Models\GenerateModel::class, | ||
\LaraGram\Database\Seeders\GenerateSeeder::class, | ||
\LaraGram\Database\Migrations\Migrator\MigrateCommand::class, | ||
\LaraGram\Database\Seeders\SeederCommand::class, | ||
\LaraGram\JsonDatabase\Migrations\GenerateMigration::class, | ||
\LaraGram\JsonDatabase\Models\GenerateModel::class, | ||
\LaraGram\JsonDatabase\MigrateCommand::class, | ||
\LaraGram\Foundation\Provider\GenerateProvider::class, | ||
\LaraGram\Foundation\Resource\GenerateResource::class, | ||
\LaraGram\Foundation\Webhook\SetWebhookCommand::class, | ||
\LaraGram\Foundation\Webhook\DeleteWebhookCommand::class, | ||
\LaraGram\Foundation\Webhook\DropWebhookCommand::class, | ||
\LaraGram\Foundation\Webhook\WebhookInfoCommand::class, | ||
\LaraGram\Foundation\Objects\Facade\GenerateFacade::class, | ||
\LaraGram\Foundation\Objects\Class\GenerateClass::class, | ||
\LaraGram\Foundation\Objects\Enum\GenerateEnum::class, | ||
\LaraGram\Foundation\Server\ServeCommand::class, | ||
\LaraGram\Foundation\Server\APIServeCommand::class, | ||
\LaraGram\Foundation\Objects\Controller\GenerateController::class, | ||
\LaraGram\Foundation\PackageManager\Installer\Eloquent::class, | ||
\LaraGram\Foundation\PackageManager\Installer\OpenSwoole::class, | ||
\LaraGram\Foundation\PackageManager\Uninstaller\OpenSwoole::class, | ||
\LaraGram\Foundation\PackageManager\Uninstaller\Eloquent::class, | ||
]; | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace LaraGram\Foundation\PackageManager\Installer; | ||
|
||
use LaraGram\Console\Command; | ||
use LaraGram\Support\Facades\Console; | ||
|
||
class Eloquent extends Command | ||
{ | ||
protected $signature = 'install:eloquent'; | ||
protected $description = 'Install Laravel Eloquent ORM'; | ||
|
||
public function handle() | ||
{ | ||
if ($this->getOption('h') == 'h') Console::output()->message($this->description, true); | ||
|
||
Console::output()->message("This operation may take time..."); | ||
|
||
exec("composer require illuminate/database illuminate/events illuminate/support fakerphp/faker 2>&1", $output, $return_var); | ||
|
||
if ($return_var !== 0) { | ||
Console::output()->failed("Error installing package: "); | ||
echo implode("\n", $output); | ||
} else { | ||
Console::output()->success("[ Eloquent ORM ] Installed Successfully!", true); | ||
} | ||
} | ||
} |
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 | ||
|
||
namespace LaraGram\Foundation\PackageManager\Installer; | ||
|
||
use LaraGram\Console\Command; | ||
use LaraGram\Support\Facades\Console; | ||
|
||
class OpenSwoole extends Command | ||
{ | ||
protected $signature = 'install:openswoole'; | ||
protected $description = 'Install Openswoole Core'; | ||
|
||
public function handle() | ||
{ | ||
if ($this->getOption('h') == 'h') Console::output()->message($this->description, true); | ||
|
||
if (!extension_loaded('openswoole')) { | ||
Console::output()->failed("openswoole extension not loaded", true); | ||
} | ||
|
||
Console::output()->message("This operation may take time..."); | ||
|
||
exec("composer require openswoole/core 2>&1", $output, $return_var); | ||
|
||
if ($return_var !== 0) { | ||
Console::output()->failed("Error installing package: "); | ||
echo implode("\n", $output); | ||
} else { | ||
Console::output()->success("[ OpenSwoole Core ] Installed Successfully!", true); | ||
} | ||
} | ||
} |
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 | ||
|
||
namespace LaraGram\Foundation\PackageManager\Uninstaller; | ||
|
||
use LaraGram\Console\Command; | ||
use LaraGram\Support\Facades\Console; | ||
|
||
class Eloquent extends Command | ||
{ | ||
protected $signature = 'remove:eloquent'; | ||
protected $description = 'Remove Laravel Eloquent ORM'; | ||
|
||
public function handle() | ||
{ | ||
if ($this->getOption('h') == 'h') Console::output()->message($this->description, true); | ||
|
||
exec("composer remove illuminate/database illuminate/events illuminate/support fakerphp/faker 2>&1", $output, $return_var); | ||
|
||
if ($return_var !== 0) { | ||
Console::output()->failed("Error removing package: "); | ||
echo implode("\n", $output); | ||
} else { | ||
Console::output()->success("[ Eloquent ORM ] Removed Successfully!", true); | ||
} | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace LaraGram\Foundation\PackageManager\Uninstaller; | ||
|
||
use LaraGram\Console\Command; | ||
use LaraGram\Support\Facades\Console; | ||
|
||
class OpenSwoole extends Command | ||
{ | ||
protected $signature = 'remove:openswoole'; | ||
protected $description = 'Remove Openswoole Core'; | ||
|
||
public function handle() | ||
{ | ||
if ($this->getOption('h') == 'h') Console::output()->message($this->description, true); | ||
|
||
if (!extension_loaded('openswoole')) { | ||
Console::output()->failed("openswoole extension not loaded", true); | ||
} | ||
|
||
exec("composer remove openswoole/core 2>&1", $output, $return_var); | ||
|
||
if ($return_var !== 0) { | ||
Console::output()->failed("Error removing package: "); | ||
echo implode("\n", $output); | ||
} else { | ||
Console::output()->success("[ OpenSwoole Core ] Removed Successfully!", true); | ||
} | ||
} | ||
} |