Skip to content

Commit

Permalink
feat!: update and shorten command signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Dec 31, 2024
1 parent f9bba5f commit 15b30eb
Show file tree
Hide file tree
Showing 30 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion src/Generator/Commands/ActionGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ActionGenerator extends Generator implements ComponentsGenerator
*
* @var string
*/
protected $name = 'apiato:generate:action';
protected $name = 'apiato:make:action';
/**
* The console command description.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Commands/ConfigurationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ConfigurationGenerator extends Generator implements ComponentsGenerator
*
* @var string
*/
protected $name = 'apiato:generate:configuration';
protected $name = 'apiato:make:configuration';
/**
* The console command description.
*
Expand Down
46 changes: 23 additions & 23 deletions src/Generator/Commands/ContainerApiGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ContainerApiGenerator extends Generator implements ComponentsGenerator
*
* @var string
*/
protected $name = 'apiato:generate:container:api';
protected $name = 'apiato:make:container:api';
/**
* The console command description.
*
Expand Down Expand Up @@ -68,37 +68,37 @@ public function getUserInputs(): array|null
$models = Pluralizer::plural($model);

$this->printInfoMessage('Generating README File');
$this->call('apiato:generate:readme', [
$this->call('apiato:make:readme', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'README',
]);

$this->printInfoMessage('Generating Configuration File');
$this->call('apiato:generate:configuration', [
$this->call('apiato:make:configuration', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => Str::camel($this->sectionName) . '-' . Str::camel($this->containerName),
]);

$this->printInfoMessage('Generating Model and Repository');
$this->call('apiato:generate:model', [
$this->call('apiato:make:model', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $model,
'--repository' => true,
]);

$this->printInfoMessage('Generating a basic Migration file');
$this->call('apiato:generate:migration', [
$this->call('apiato:make:migration', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'create_' . Str::snake($models) . '_table',
'--tablename' => Str::snake($models),
]);

$this->printInfoMessage('Generating Transformer for the Model');
$this->call('apiato:generate:transformer', [
$this->call('apiato:make:transformer', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $containerName . 'Transformer',
Expand All @@ -107,7 +107,7 @@ public function getUserInputs(): array|null
]);

$this->printInfoMessage('Generating Factory for the Model');
$this->call('apiato:generate:factory', [
$this->call('apiato:make:factory', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $containerName . 'Factory',
Expand Down Expand Up @@ -247,15 +247,15 @@ public function getUserInputs(): array|null
];

foreach ($routes as $route) {
$this->call('apiato:generate:request', [
$this->call('apiato:make:request', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['request'],
'--ui' => $ui,
'--stub' => $route['stub'],
]);

$this->call('apiato:generate:action', [
$this->call('apiato:make:action', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['action'],
Expand All @@ -264,7 +264,7 @@ public function getUserInputs(): array|null
'--stub' => $route['stub'],
]);

$this->call('apiato:generate:task', [
$this->call('apiato:make:task', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['task'],
Expand All @@ -274,7 +274,7 @@ public function getUserInputs(): array|null
]);

if ($generateEvents) {
$this->call('apiato:generate:event', [
$this->call('apiato:make:event', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['event'],
Expand All @@ -286,7 +286,7 @@ public function getUserInputs(): array|null
}

if ($generateTests) {
$this->call('apiato:generate:test:unit', [
$this->call('apiato:make:test:unit', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['unittest']['task']['filename'],
Expand All @@ -297,7 +297,7 @@ public function getUserInputs(): array|null
'--event' => $generateEvents ? $route['event'] : false,
]);

$this->call('apiato:generate:test:unit', [
$this->call('apiato:make:test:unit', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $model . 'FactoryTest',
Expand All @@ -307,7 +307,7 @@ public function getUserInputs(): array|null
'--event' => false,
]);

$this->call('apiato:generate:test:unit', [
$this->call('apiato:make:test:unit', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $models . 'MigrationTest',
Expand All @@ -319,7 +319,7 @@ public function getUserInputs(): array|null
'--tablename' => Str::snake(Pluralizer::plural($containerName)),
]);

$this->call('apiato:generate:test:functional', [
$this->call('apiato:make:test:functional', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['functionaltest'],
Expand All @@ -331,7 +331,7 @@ public function getUserInputs(): array|null
}

if ('sac' === $controllertype) {
$this->call('apiato:generate:route', [
$this->call('apiato:make:route', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['name'],
Expand All @@ -344,7 +344,7 @@ public function getUserInputs(): array|null
'--controller' => $route['controller'],
]);

$this->call('apiato:generate:controller', [
$this->call('apiato:make:controller', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['controller'],
Expand All @@ -353,7 +353,7 @@ public function getUserInputs(): array|null
'--stub' => $route['stub'],
]);
} else {
$this->call('apiato:generate:route', [
$this->call('apiato:make:route', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => $route['name'],
Expand All @@ -370,7 +370,7 @@ public function getUserInputs(): array|null

if ('mac' === $controllertype) {
$this->printInfoMessage('Generating Controller to wire everything together');
$this->call('apiato:generate:controller', [
$this->call('apiato:make:controller', [
'--section' => $sectionName,
'--container' => $containerName,
'--model' => $model,
Expand All @@ -387,7 +387,7 @@ public function getUserInputs(): array|null
foreach ($events as $event) {
$listener = $event . 'Listener';
$listeners[$listener] = [$event];
$this->call('apiato:generate:listener', [
$this->call('apiato:make:listener', [
'--section' => $this->sectionName,
'--container' => $this->containerName,
'--file' => $listener,
Expand All @@ -402,7 +402,7 @@ public function getUserInputs(): array|null
}

$this->printInfoMessage('Generating EventServiceProvider');
$this->call('apiato:generate:provider', [
$this->call('apiato:make:provider', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'EventServiceProvider',
Expand All @@ -411,7 +411,7 @@ public function getUserInputs(): array|null
]);

$this->printInfoMessage('Generating MainServiceProvider');
$this->call('apiato:generate:provider', [
$this->call('apiato:make:provider', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'MainServiceProvider',
Expand All @@ -420,7 +420,7 @@ public function getUserInputs(): array|null
]);
} else {
$this->printInfoMessage('Generating MainServiceProvider');
$this->call('apiato:generate:provider', [
$this->call('apiato:make:provider', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'MainServiceProvider',
Expand Down
20 changes: 10 additions & 10 deletions src/Generator/Commands/ContainerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ContainerGenerator extends Generator implements ComponentsGenerator
*
* @var string
*/
protected $name = 'apiato:generate:container';
protected $name = 'apiato:make:container';
/**
* The console command description.
*
Expand Down Expand Up @@ -63,43 +63,43 @@ public function getUserInputs(): array|null
}
$generateTests = $this->checkParameterOrConfirm('tests', 'Do you want to generate the corresponding Tests for this Container?', true);
if ($generateTests) {
$this->call('apiato:generate:test:testcase', [
$this->call('apiato:make:test:testcase', [
'--section' => $this->sectionName,
'--container' => $this->containerName,
'--file' => 'TestCase',
'--type' => 'container',
]);
$this->call('apiato:generate:test:testcase', [
$this->call('apiato:make:test:testcase', [
'--section' => $this->sectionName,
'--container' => $this->containerName,
'--file' => 'TestCase',
'--type' => 'unit',
]);
$this->call('apiato:generate:test:testcase', [
$this->call('apiato:make:test:testcase', [
'--section' => $this->sectionName,
'--container' => $this->containerName,
'--file' => 'TestCase',
'--type' => 'functional',
]);
// $this->call('apiato:generate:test:testcase', [
// $this->call('apiato:make:test:testcase', [
// '--section' => $this->sectionName,
// '--container' => $this->containerName,
// '--file' => 'TestCase',
// '--type' => 'e2e',
// ]);
$this->call('apiato:generate:test:testcase', [
$this->call('apiato:make:test:testcase', [
'--section' => $this->sectionName,
'--container' => $this->containerName,
'--file' => 'TestCase',
'--type' => 'api',
]);
// $this->call('apiato:generate:test:testcase', [
// $this->call('apiato:make:test:testcase', [
// '--section' => $this->sectionName,
// '--container' => $this->containerName,
// '--file' => 'TestCase',
// '--type' => 'cli',
// ]);
// $this->call('apiato:generate:test:testcase', [
// $this->call('apiato:make:test:testcase', [
// '--section' => $this->sectionName,
// '--container' => $this->containerName,
// '--file' => 'TestCase',
Expand All @@ -113,7 +113,7 @@ public function getUserInputs(): array|null
$_sectionName = Str::lower($this->sectionName);

if ('api' === $ui || 'both' === $ui) {
$this->call('apiato:generate:container:api', [
$this->call('apiato:make:container:api', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'composer',
Expand All @@ -126,7 +126,7 @@ public function getUserInputs(): array|null
}

if ('web' === $ui || 'both' === $ui) {
$this->call('apiato:generate:container:web', [
$this->call('apiato:make:container:web', [
'--section' => $sectionName,
'--container' => $containerName,
'--file' => 'composer',
Expand Down
Loading

0 comments on commit 15b30eb

Please sign in to comment.