userator /
deploid
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Deploid\Command; |
||
| 4 | |||
| 5 | use Symfony\Component\Console\Command\Command; |
||
| 6 | use Symfony\Component\Console\Input\InputInterface; |
||
| 7 | use Symfony\Component\Console\Output\OutputInterface; |
||
| 8 | use Symfony\Component\Console\Input\InputArgument; |
||
| 9 | use Deploid\Payload; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @method \Deploid\Application getApplication() return application object |
||
| 13 | */ |
||
| 14 | class ReleaseRotate extends Command { |
||
| 15 | |||
| 16 | protected function configure() { |
||
| 17 | $this->setName('release:rotate'); |
||
| 18 | $this->setDescription('Rotate release directory'); |
||
| 19 | $this->setHelp('This command rotate release directory'); |
||
| 20 | $this->addArgument('quantity', InputArgument::REQUIRED, 'quantity leave releases directory'); |
||
| 21 | $this->addArgument('path', InputArgument::OPTIONAL, 'path to target directory', getcwd()); |
||
| 22 | } |
||
| 23 | |||
| 24 | protected function execute(InputInterface $input, OutputInterface $output) { |
||
| 25 | $payload = $this->getApplication()->deploidStructureValidate($input->getArgument('path')); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 26 | if ($payload->getType() == Payload::STRUCTURE_VALIDATE_FAIL) { |
||
| 27 | $output->writeln($payload->getMessage()); |
||
| 28 | return $payload->getCode(); |
||
| 29 | } |
||
| 30 | |||
| 31 | $payload = $this->getApplication()->deploidReleaseRotate($input->getArgument('quantity'), $input->getArgument('path')); |
||
| 32 | $output->writeln($payload->getMessage()); |
||
| 33 | return $payload->getCode(); |
||
| 34 | } |
||
| 35 | |||
| 36 | } |