|
25 | 25 | use Symfony\Component\Console\Output\OutputInterface; |
26 | 26 | use Symfony\Component\Yaml\Yaml; |
27 | 27 | use RuntimeException; |
28 | | -use Google\Cloud\Dev\Component; |
29 | 28 |
|
30 | 29 | /** |
31 | 30 | * Add a Component |
32 | 31 | * @internal |
33 | 32 | */ |
34 | | -class AddVersionCommand extends Command |
| 33 | +class ComponentAddVersionCommand extends Command |
35 | 34 | { |
36 | 35 | private const OWL_BOT_REGEX='/.*\/\(([\w|]+)\).*/'; |
37 | 36 |
|
38 | 37 | protected function configure() |
39 | 38 | { |
40 | | - $this->setName('add-version') |
| 39 | + $this->setName('component:add-version') |
41 | 40 | ->setDescription('Add a new version to an existing Component') |
42 | 41 | ->addArgument('component', InputArgument::REQUIRED, 'Component to add the version to.') |
43 | 42 | ->addArgument('version', InputArgument::REQUIRED, 'The new version to add.') |
44 | 43 | ->addOption( |
45 | | - 'no-update-component', |
| 44 | + 'no-update', |
46 | 45 | null, |
47 | 46 | InputOption::VALUE_NONE, |
48 | 47 | 'Do not run the update-component command after adding the component skeleton' |
@@ -96,31 +95,34 @@ protected function execute(InputInterface $input, OutputInterface $output) |
96 | 95 | } |
97 | 96 |
|
98 | 97 | // Run "update-component" command to generate the new version and add its sample to the README |
99 | | - if ($input->getOption('no-update-component')) { |
| 98 | + if ($input->getOption('no-update')) { |
100 | 99 | // nothing left to do |
101 | | - $output->writeln('Skipping component update: "--no-update-component" flag set'); |
| 100 | + $output->writeln('Skipping component update: "--no-update" flag set'); |
102 | 101 | return 0; |
103 | 102 | } |
104 | 103 |
|
105 | 104 | $args = [ |
106 | 105 | 'component' => $componentName, |
107 | 106 | '--timeout' => $input->getOption('timeout'), |
108 | 107 | ]; |
109 | | - if (!$this->getApplication()->has('update-component')) { |
| 108 | + if (!$this->getApplication()->has('component:update:gencode')) { |
110 | 109 | throw new \RuntimeException( |
111 | | - 'Application does not have an update-component command. ' |
112 | | - . 'Run with --no-update-component to skip this.' |
| 110 | + 'Application does not have an component:update:gencode command. ' |
| 111 | + . 'Run with --no-update to skip this.' |
113 | 112 | ); |
114 | 113 | } |
115 | | - $updateCommand = $this->getApplication()->find('update-component'); |
| 114 | + $updateCommand = $this->getApplication()->find('component:update:gencode'); |
116 | 115 | $returnCode = $updateCommand->run(new ArrayInput($args), $output); |
117 | 116 | if ($returnCode !== Command::SUCCESS) { |
118 | 117 | return $returnCode; |
119 | 118 | } |
120 | | - // Run "update-readme-sample" command to ensure our README contains the latest version's sample. |
| 119 | + // Run "component:update:readme-sample" command to ensure our README contains the latest version's sample. |
121 | 120 | $updateReadmeSampleArgs = ['--component' => [$componentName], '--update' => true]; |
122 | | - if (!$updateReadmeSampleCommand = $this->getApplication()->find('update-readme-sample')) { |
123 | | - throw new \RuntimeException('Application does not have an add-samples-to-readme command.'); |
| 121 | + if (!$updateReadmeSampleCommand = $this->getApplication()->find('component:update::readme-sample')) { |
| 122 | + throw new \RuntimeException( |
| 123 | + 'Application does not have an component:update::readme-sample command. ' |
| 124 | + . 'Run with --no-update to skip this.' |
| 125 | + ); |
124 | 126 | } |
125 | 127 | return $updateReadmeSampleCommand->run(new ArrayInput($updateReadmeSampleArgs), $output); |
126 | 128 | } |
|
0 commit comments