From c8830e2a5847f4c6c17b4c2a3372c5bd972979cf Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Thu, 6 Jul 2017 14:21:37 -0600 Subject: [PATCH] 3380 relocate to debug module commands (#3409) * Move migrate:debug to debug:migrate * Move rest:debug to debug:rest * Move test:debug to debug:test * Move features:debug to debug:features --- config/services/debug.yml | 23 ++++++++++ config/services/feature.yml | 5 -- config/services/migrate.yml | 6 --- config/services/rest.yml | 6 --- config/services/simpletest.yml | 6 --- .../FeaturesCommand.php} | 26 +++++------ .../MigrateCommand.php} | 26 +++++------ .../RestCommand.php} | 46 +++++++++---------- .../TestCommand.php} | 32 ++++++------- 9 files changed, 88 insertions(+), 88 deletions(-) rename src/Command/{Features/DebugCommand.php => Debug/FeaturesCommand.php} (66%) rename src/Command/{Migrate/DebugCommand.php => Debug/MigrateCommand.php} (76%) rename src/Command/{Rest/DebugCommand.php => Debug/RestCommand.php} (74%) rename src/Command/{Test/DebugCommand.php => Debug/TestCommand.php} (84%) diff --git a/config/services/debug.yml b/config/services/debug.yml index 6f201e81a..e63e3da6e 100644 --- a/config/services/debug.yml +++ b/config/services/debug.yml @@ -143,3 +143,26 @@ services: tags: - { name: drupal.command } lazy: true + console.migrate_debug: + class: Drupal\Console\Command\Debug\MigrateCommand + arguments: ['@?plugin.manager.migration'] + tags: + - { name: drupal.command } + lazy: true + console.rest_debug: + class: Drupal\Console\Command\Debug\RestCommand + arguments: ['@?plugin.manager.rest'] + tags: + - { name: drupal.command } + lazy: true + console.test_debug: + class: Drupal\Console\Command\Debug\TestCommand + arguments: ['@?test_discovery'] + tags: + - { name: drupal.command } + lazy: true + console.feature_debug: + class: Drupal\Console\Command\Debug\FeaturesCommand + tags: + - { name: drupal.command } + lazy: true diff --git a/config/services/feature.yml b/config/services/feature.yml index 9fd6bf21d..1c4041b7c 100644 --- a/config/services/feature.yml +++ b/config/services/feature.yml @@ -1,9 +1,4 @@ services: - console.feature_debug: - class: Drupal\Console\Command\Features\DebugCommand - tags: - - { name: drupal.command } - lazy: true console.feature_import: class: Drupal\Console\Command\Features\ImportCommand tags: diff --git a/config/services/migrate.yml b/config/services/migrate.yml index ab1ba6817..ba69672b6 100644 --- a/config/services/migrate.yml +++ b/config/services/migrate.yml @@ -11,12 +11,6 @@ services: tags: - { name: drupal.command } lazy: true - console.migrate_debug: - class: Drupal\Console\Command\Migrate\DebugCommand - arguments: ['@?plugin.manager.migration'] - tags: - - { name: drupal.command } - lazy: true console.migrate_setup: class: Drupal\Console\Command\Migrate\SetupCommand arguments: ['@state', '@?plugin.manager.migration'] diff --git a/config/services/rest.yml b/config/services/rest.yml index 5b59ced3b..be4a30613 100644 --- a/config/services/rest.yml +++ b/config/services/rest.yml @@ -1,10 +1,4 @@ services: - console.rest_debug: - class: Drupal\Console\Command\Rest\DebugCommand - arguments: ['@?plugin.manager.rest'] - tags: - - { name: drupal.command } - lazy: true console.rest_disable: class: Drupal\Console\Command\Rest\DisableCommand arguments: ['@config.factory', '@?plugin.manager.rest'] diff --git a/config/services/simpletest.yml b/config/services/simpletest.yml index 52668d29a..327f8ae40 100644 --- a/config/services/simpletest.yml +++ b/config/services/simpletest.yml @@ -1,10 +1,4 @@ services: - console.test_debug: - class: Drupal\Console\Command\Test\DebugCommand - arguments: ['@?test_discovery'] - tags: - - { name: drupal.command } - lazy: true console.test_run: class: Drupal\Console\Command\Test\RunCommand arguments: ['@app.root', '@?test_discovery', '@module_handler', '@date.formatter'] diff --git a/src/Command/Features/DebugCommand.php b/src/Command/Debug/FeaturesCommand.php similarity index 66% rename from src/Command/Features/DebugCommand.php rename to src/Command/Debug/FeaturesCommand.php index 5c7b5f1c3..21c195cb8 100644 --- a/src/Command/Features/DebugCommand.php +++ b/src/Command/Debug/FeaturesCommand.php @@ -2,10 +2,10 @@ /** * @file -* Contains \Drupal\Console\Command\Features\DebugCommand. +* Contains \Drupal\Console\Command\Debug\FeaturesCommand. */ -namespace Drupal\Console\Command\Features; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -23,7 +23,7 @@ * ) */ -class DebugCommand extends Command +class FeaturesCommand extends Command { use CommandTrait; use FeatureTrait; @@ -31,12 +31,12 @@ class DebugCommand extends Command protected function configure() { $this - ->setName('features:debug') - ->setDescription($this->trans('commands.features.debug.description')) + ->setName('debug:features') + ->setDescription($this->trans('commands.debug.features.description')) ->addArgument( 'bundle', InputArgument::OPTIONAL, - $this->trans('commands.features.debug.arguments.bundle') + $this->trans('commands.debug.features.arguments.bundle') ); } @@ -46,17 +46,17 @@ protected function execute(InputInterface $input, OutputInterface $output) $bundle= $input->getArgument('bundle'); $tableHeader = [ - $this->trans('commands.features.debug.messages.bundle'), - $this->trans('commands.features.debug.messages.name'), - $this->trans('commands.features.debug.messages.machine_name'), - $this->trans('commands.features.debug.messages.status'), - $this->trans('commands.features.debug.messages.state'), + $this->trans('commands.debug.features.messages.bundle'), + $this->trans('commands.debug.features.messages.name'), + $this->trans('commands.debug.features.messages.machine_name'), + $this->trans('commands.debug.features.messages.status'), + $this->trans('commands.debug.features.messages.state'), ]; $tableRows = []; - + $features = $this->getFeatureList($io, $bundle); - + foreach ($features as $feature) { $tableRows[] = [$feature['bundle_name'],$feature['name'], $feature['machine_name'], $feature['status'],$feature['state']]; } diff --git a/src/Command/Migrate/DebugCommand.php b/src/Command/Debug/MigrateCommand.php similarity index 76% rename from src/Command/Migrate/DebugCommand.php rename to src/Command/Debug/MigrateCommand.php index da908d8c9..9b2f8b20d 100644 --- a/src/Command/Migrate/DebugCommand.php +++ b/src/Command/Debug/MigrateCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Migrate\DebugCommand. + * Contains \Drupal\Console\Command\Debug\MigrateCommand. */ -namespace Drupal\Console\Command\Migrate; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -23,7 +23,7 @@ * extensionType = "module" * ) */ -class DebugCommand extends Command +class MigrateCommand extends Command { use MigrationTrait; use CommandTrait; @@ -34,7 +34,7 @@ class DebugCommand extends Command protected $pluginManagerMigration; /** - * DebugCommand constructor. + * MigrateCommand constructor. * * @param MigrationPluginManagerInterface $pluginManagerMigration */ @@ -48,12 +48,12 @@ public function __construct( protected function configure() { $this - ->setName('migrate:debug') - ->setDescription($this->trans('commands.migrate.debug.description')) + ->setName('debug:migrate') + ->setDescription($this->trans('commands.debug.migrate.description')) ->addArgument( 'tag', InputArgument::OPTIONAL, - $this->trans('commands.migrate.debug.arguments.tag') + $this->trans('commands.debug.migrate.arguments.tag') ) ->setAliases(['mid']); } @@ -62,21 +62,21 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $drupal_version = 'Drupal ' . $input->getArgument('tag'); - + $migrations = $this->getMigrations($drupal_version); - + $tableHeader = [ - $this->trans('commands.migrate.debug.messages.id'), - $this->trans('commands.migrate.debug.messages.description'), - $this->trans('commands.migrate.debug.messages.tags'), + $this->trans('commands.debug.migrate.messages.id'), + $this->trans('commands.debug.migrate.messages.description'), + $this->trans('commands.debug.migrate.messages.tags'), ]; $tableRows = []; if (empty($migrations)) { $io->error( sprintf( - $this->trans('commands.migrate.debug.messages.no-migrations'), + $this->trans('commands.debug.migrate.messages.no-migrations'), count($migrations) ) ); diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Debug/RestCommand.php similarity index 74% rename from src/Command/Rest/DebugCommand.php rename to src/Command/Debug/RestCommand.php index 2ffa178de..456cc1b83 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Debug/RestCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Rest\DebugCommand. + * Contains \Drupal\Console\Command\Debug\RestCommand. */ -namespace Drupal\Console\Command\Rest; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -24,7 +24,7 @@ * extensionType = "module" * ) */ -class DebugCommand extends Command +class RestCommand extends Command { use CommandTrait; use RestTrait; @@ -35,7 +35,7 @@ class DebugCommand extends Command protected $pluginManagerRest; /** - * DebugCommand constructor. + * RestCommand constructor. * * @param ResourcePluginManager $pluginManagerRest */ @@ -48,18 +48,18 @@ public function __construct(ResourcePluginManager $pluginManagerRest) protected function configure() { $this - ->setName('rest:debug') - ->setDescription($this->trans('commands.rest.debug.description')) + ->setName('debug:rest') + ->setDescription($this->trans('commands.debug.rest.description')) ->addArgument( 'resource-id', InputArgument::OPTIONAL, - $this->trans('commands.rest.debug.arguments.resource-id') + $this->trans('commands.debug.rest.arguments.resource-id') ) ->addOption( 'authorization', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.rest.debug.options.status') + $this->trans('commands.debug.rest.options.status') ) ->setAliases(['rede']); } @@ -89,7 +89,7 @@ private function restDetail(DrupalStyle $io, $resource_id) if (empty($plugin)) { $io->error( sprintf( - $this->trans('commands.rest.debug.messages.not-found'), + $this->trans('commands.debug.rest.messages.not-found'), $resource_id ) ); @@ -101,24 +101,24 @@ private function restDetail(DrupalStyle $io, $resource_id) $configuration = []; $configuration[] = [ - $this->trans('commands.rest.debug.messages.id'), + $this->trans('commands.debug.rest.messages.id'), $resource['id'] ]; $configuration[] = [ - $this->trans('commands.rest.debug.messages.label'), + $this->trans('commands.debug.rest.messages.label'), (string) $resource['label'] ]; $configuration[] = [ - $this->trans('commands.rest.debug.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.canonical_url'), $resource['uri_paths']['canonical'] ]; $configuration[] = [ - $this->trans('commands.rest.debug.messages.status'), - (isset($config[$resource['id']])) ? $this->trans('commands.rest.debug.messages.enabled') : $this->trans('commands.rest.debug.messages.disabled')]; + $this->trans('commands.debug.rest.messages.status'), + (isset($config[$resource['id']])) ? $this->trans('commands.debug.rest.messages.enabled') : $this->trans('commands.debug.rest.messages.disabled')]; $configuration[] = [ $this->trans( sprintf( - 'commands.rest.debug.messages.provider', + 'commands.debug.rest.messages.provider', $resource['provider'] ) ) @@ -130,9 +130,9 @@ private function restDetail(DrupalStyle $io, $resource_id) $io->table([], $configuration, 'compact'); $tableHeader = [ - $this->trans('commands.rest.debug.messages.rest-state'), - $this->trans('commands.rest.debug.messages.supported-formats'), - $this->trans('commands.rest.debug.messages.supported_auth'), + $this->trans('commands.debug.rest.messages.rest-state'), + $this->trans('commands.debug.rest.messages.supported-formats'), + $this->trans('commands.debug.rest.messages.supported_auth'), ]; $tableRows = []; @@ -152,11 +152,11 @@ protected function restList(DrupalStyle $io, $status) $rest_resources = $this->getRestResources($status); $tableHeader = [ - $this->trans('commands.rest.debug.messages.id'), - $this->trans('commands.rest.debug.messages.label'), - $this->trans('commands.rest.debug.messages.canonical_url'), - $this->trans('commands.rest.debug.messages.status'), - $this->trans('commands.rest.debug.messages.provider'), + $this->trans('commands.debug.rest.messages.id'), + $this->trans('commands.debug.rest.messages.label'), + $this->trans('commands.debug.rest.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.status'), + $this->trans('commands.debug.rest.messages.provider'), ]; $tableRows = []; diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Debug/TestCommand.php similarity index 84% rename from src/Command/Test/DebugCommand.php rename to src/Command/Debug/TestCommand.php index 9f3c5e53a..e18c784a5 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Debug/TestCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Test\DebugCommand. + * Contains \Drupal\Console\Command\Debug\TestCommand. */ -namespace Drupal\Console\Command\Test; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -24,7 +24,7 @@ * extensionType = "module", * ) */ -class DebugCommand extends Command +class TestCommand extends Command { use CommandTrait; @@ -34,7 +34,7 @@ class DebugCommand extends Command protected $test_discovery; /** - * DebugCommand constructor. + * TestCommand constructor. * * @param TestDiscovery $test_discovery */ @@ -49,19 +49,19 @@ public function __construct( protected function configure() { $this - ->setName('test:debug') - ->setDescription($this->trans('commands.test.debug.description')) + ->setName('debug:test') + ->setDescription($this->trans('commands.debug.test.description')) ->addArgument( 'group', InputArgument::OPTIONAL, - $this->trans('commands.test.debug.options.group'), + $this->trans('commands.debug.test.options.group'), null ) ->addOption( 'test-class', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.test.debug.arguments.test-class') + $this->trans('commands.debug.test.arguments.test-class') ) ->setAliases(['td']); } @@ -124,7 +124,7 @@ private function testDetail(DrupalStyle $io, $test_class) if ($class) { $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); - $io->info($this->trans('commands.test.debug.messages.methods')); + $io->info($this->trans('commands.debug.test.messages.methods')); foreach ($methods as $method) { if ($method->class == $testDetails['name'] && strpos($method->name, 'test') === 0) { $io->simple($method->name); @@ -132,7 +132,7 @@ private function testDetail(DrupalStyle $io, $test_class) } } } else { - $io->error($this->trans('commands.test.debug.messages.not-found')); + $io->error($this->trans('commands.debug.test.messages.not-found')); } } @@ -142,17 +142,17 @@ protected function testList(DrupalStyle $io, $group) ->getTestClasses(null); if (empty($group)) { - $tableHeader = [$this->trans('commands.test.debug.messages.group')]; + $tableHeader = [$this->trans('commands.debug.test.messages.group')]; } else { $tableHeader = [ - $this->trans('commands.test.debug.messages.class'), - $this->trans('commands.test.debug.messages.type') + $this->trans('commands.debug.test.messages.class'), + $this->trans('commands.debug.test.messages.type') ]; $io->writeln( sprintf( '%s: %s', - $this->trans('commands.test.debug.messages.group'), + $this->trans('commands.debug.test.messages.group'), $group ) ); @@ -186,13 +186,13 @@ protected function testList(DrupalStyle $io, $group) if ($group) { $io->success( sprintf( - $this->trans('commands.test.debug.messages.success-group'), + $this->trans('commands.debug.test.messages.success-group'), $group ) ); } else { $io->success( - $this->trans('commands.test.debug.messages.success-groups') + $this->trans('commands.debug.test.messages.success-groups') ); } }