Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Add RoadRunner Bridge to metrics and grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
msmakouz committed Dec 22, 2022
1 parent 87c668e commit 326f48c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions installer/Application/GRPC.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Installer\Generator\GeneratorInterface;
use Installer\Package\ExtGRPC;
use Installer\Package\ExtMbString;
use Installer\Package\Generator\RoadRunnerBridge\GRPC as RoadRunnerGRPC;
use Installer\Package\Generator\RoadRunnerBridge\GRPCBootloader;
use Installer\Package\GRPC as PackageGRPC;
use Installer\Package\Package;
use Installer\Package\RoadRunnerBridge;
Expand Down Expand Up @@ -51,7 +51,7 @@ public function __construct(
array $questions = [],
array $generators = [
new GRPCApplicationBootloaders(),
new RoadRunnerGRPC(),
new GRPCBootloader(),
new ViewRenderer(),
],
array $resources = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
use Installer\Generator\Context;
use Installer\Generator\GeneratorInterface;
use Spiral\RoadRunnerBridge\Bootloader\CacheBootloader;
use Spiral\RoadRunnerBridge\Bootloader\GRPCBootloader;
use Spiral\RoadRunnerBridge\Bootloader\GRPCBootloader as Bootloader;

final class GRPC implements GeneratorInterface
final class GRPCBootloader implements GeneratorInterface
{
public function process(Context $context): void
{
$context->kernel->load->append(GRPCBootloader::class, CacheBootloader::class);
$context->kernel->load->append(Bootloader::class, CacheBootloader::class);

$context->application->useRoadRunnerPlugin('grpc');

Expand Down
25 changes: 14 additions & 11 deletions installer/Question/RoadRunnerGRPC.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Installer\Question;

use Installer\Package\Generator\RoadRunnerBridge\GRPC;
use Installer\Package\Package;
use Installer\Package\Generator\RoadRunnerBridge\GRPCBootloader;
use Installer\Package\Packages;
use Installer\Question\Option\BooleanOption;
use Installer\Question\Option\Option;

final class RoadRunnerGRPC extends AbstractQuestion
Expand All @@ -18,16 +18,19 @@ public function __construct(
string $question = 'Do you need the RoadRunner gRPC?',
bool $required = false,
array $options = [
new Option(name: 'Yes', packages: [
new Package(
package: Packages::RoadRunnerBridge,
generators: [
new GRPC(),
]
),
]),
new BooleanOption(
name: 'Yes',
generators: [
new GRPCBootloader(),
]
),
],
array $conditions = [
'require' => [
Packages::RoadRunnerBridge,
],
]
) {
parent::__construct($question, $required, $options);
parent::__construct($question, $required, $options, $conditions);
}
}
8 changes: 7 additions & 1 deletion installer/Question/RoadRunnerMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Installer\Question;

use Installer\Package\Generator\RoadRunnerBridge\MetricsBootloader;
use Installer\Package\Packages;
use Installer\Question\Option\BooleanOption;
use Installer\Question\Option\OptionInterface;

Expand All @@ -23,8 +24,13 @@ public function __construct(
new MetricsBootloader(),
]
),
],
array $conditions = [
'require' => [
Packages::RoadRunnerBridge,
],
]
) {
parent::__construct($question, $required, $options);
parent::__construct($question, $required, $options, $conditions);
}
}
1 change: 1 addition & 0 deletions installer/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
new Question\CycleBridge(),
new Question\Serializer(),
new Question\Mailer(),
new Question\RoadRunnerBridge(),
new Question\RoadRunnerMetrics(),
]
),
Expand Down

0 comments on commit 326f48c

Please sign in to comment.