Skip to content

Commit

Permalink
Add additional validation for module, when we use no-interaction mode (
Browse files Browse the repository at this point in the history
  • Loading branch information
LOBsTerr authored and jmolivas committed Apr 22, 2018
1 parent 1a9a48e commit 73139e3
Show file tree
Hide file tree
Showing 40 changed files with 73 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/Command/Config/ExportContentTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$contentType = $input->getArgument('content-type');
$optionalConfig = $input->getOption('optional-config');
$removeUuid = $input->getOption('remove-uuid');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Config/ExportSingleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output)
{
$directory = $input->getOption('directory');
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$name = $input->getOption('name');
$optional = $input->getOption('optional');
$removeUuid = $input->getOption('remove-uuid');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Config/ExportViewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function interact(InputInterface $input, OutputInterface $output)

protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$viewId = $input->getArgument('view-id');
$optionalConfig = $input->getOption('optional-config');
$includeModuleDependencies = $input->getOption('include-module-dependencies');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/AjaxCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class = $this->validator->validateClassName($input->getOption('class'));
$method = $input->getOption('method');
$js_name = $input->getOption('js-name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/AuthenticationProviderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class = $this->validator->validateClassName($input->getOption('class'));
$provider_id = $input->getOption('provider-id');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/CacheContextCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$cache_context = $input->getOption('cache-context');
$class = $this->validator->validateClassName($input->getOption('class'));
$services = $input->getOption('services');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/ControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class = $this->validator->validateControllerName($input->getOption('class'));
$routes = $input->getOption('routes');
$test = $input->getOption('test');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EntityBundleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$bundleName = $input->getOption('bundle-name');
$bundleTitle = $input->getOption('bundle-title');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EntityConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$entity_class = $input->getOption('entity-class');
$entity_name = $input->getOption('entity-name');
$label = $input->getOption('label');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EntityContentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$entity_class = $input->getOption('entity-class');
$entity_name = $input->getOption('entity-name');
$label = $input->getOption('label');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EventSubscriberCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$name = $input->getOption('name');
$class = $this->validator->validateClassName($input->getOption('class'));
$events = $input->getOption('events');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/FormAlterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$formId = $input->getOption('form-id');
$inputs = $input->getOption('inputs');
$noInteraction = $input->getOption('no-interaction');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/FormCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$services = $input->getOption('services');
$path = $input->getOption('path');
$config_file = $input->getOption('config-file');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));

if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_help')) {
throw new \Exception(
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/JsTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class = $this->validator->validateClassName($input->getOption('class'));

$this->generator->generate([
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Generate/ModuleFileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$machine_name = $input->getOption('module');
$file_path = $this->extensionManager->getModule($machine_name)->getPath();
$module = $this->validateModule($input->getOption('module'));
$file_path = $this->extensionManager->getModule($module)->getPath();

$this->generator->generate([
'machine_name' => $machine_name,
'machine_name' => $module,
'file_path' => $file_path,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PermissionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$permissions = $input->getOption('permissions');
$learning = $input->hasOption('learning');
$noInteraction = $input->getOption('no-interaction');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginBlockCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginCKEditorButtonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginConditionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
7 changes: 4 additions & 3 deletions src/Command/Generate/PluginFieldCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $this->validateModule($input->getOption('module'));
$this->chainQueue
->addCommand(
'generate:plugin:fieldtype', [
'--module' => $input->getOption('module'),
'--module' => $module,
'--class' => $this->validator->validateClassName($input->getOption('type-class')),
'--label' => $input->getOption('type-label'),
'--plugin-id' => $input->getOption('type-plugin-id'),
Expand All @@ -185,7 +186,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->chainQueue
->addCommand(
'generate:plugin:fieldwidget', [
'--module' => $input->getOption('module'),
'--module' => $module,
'--class' => $this->validator->validateClassName($input->getOption('widget-class')),
'--label' => $input->getOption('widget-label'),
'--plugin-id' => $input->getOption('widget-plugin-id'),
Expand All @@ -196,7 +197,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->chainQueue
->addCommand(
'generate:plugin:fieldformatter', [
'--module' => $input->getOption('module'),
'--module' => $module,
'--class' => $this->validator->validateClassName($input->getOption('formatter-class')),
'--label' => $input->getOption('formatter-label'),
'--plugin-id' => $input->getOption('formatter-plugin-id'),
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldFormatterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldWidgetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginImageEffectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginImageFormatterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginMailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginMigrateProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$plugin_id = $input->getOption('plugin-id');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginMigrateSourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$plugin_id = $input->getOption('plugin-id');
$table = $input->getOption('table');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginRestResourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

$http_methods = $this->getHttpMethods();
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$plugin_id = $input->getOption('plugin-id');
$plugin_label = $input->getOption('plugin-label');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginRulesActionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$label = $input->getOption('label');
$plugin_id = $input->getOption('plugin-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginSkeletonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));

$pluginId = $input->getOption('plugin-id');
$plugin = ucfirst($this->stringConverter->underscoreToCamelCase($pluginId));
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginTypeAnnotationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$machine_name = $input->getOption('machine-name');
$label = $input->getOption('label');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginTypeYamlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$class_name = $this->validator->validateClassName($input->getOption('class'));
$plugin_name = $input->getOption('plugin-name');
$plugin_file_name = $input->getOption('plugin-file-name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PostUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$postUpdateName = $input->getOption('post-update-name');

$this->validatePostUpdateName($module, $postUpdateName);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/RouteSubscriberCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$name = $input->getOption('name');
$class = $this->validator->validateClassName($input->getOption('class'));

Expand Down
3 changes: 2 additions & 1 deletion src/Command/Generate/ServiceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$name = $input->getOption('name');
$class = $this->validator->validateClassName($input->getOption('class'));
$interface = $input->getOption('interface');
Expand All @@ -171,6 +171,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'name' => $name,
'class' => $class,
'interface' => $interface,
'interface_name' => $interface_name,
'services' => $build_services,
'path_service' => $path_service,
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/TwigExtensionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$name = $input->getOption('name');
$class = $this->validator->validateClassName($input->getOption('class'));
$services = $input->getOption('services');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}

$module = $input->getOption('module');
$module = $this->validateModule($input->getOption('module'));
$updateNumber = $input->getOption('update-n');

$lastUpdateSchema = $this->getLastUpdate($module);
Expand Down
Loading

0 comments on commit 73139e3

Please sign in to comment.