/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var PackageInterface[] $availablePackages */ $availablePackages = $this->getContainer()->get('oro_distribution.package_manager')->getAvailable(); $grid = new Grid(2, [':']); foreach ($availablePackages as $package) { $grid->addRow([$package->getName(), $package->getPrettyVersion()]); } $output->writeln($grid->render()); }
protected function execute(InputInterface $input, OutputInterface $output) { /** @var PackageManager $manager */ $manager = $this->getContainer()->get('oro_distribution.package_manager'); $updates = $manager->getAvailableUpdates(); if ($updates) { $output->writeln('<info>Following updates are available:</info>'); $grid = new Grid(3, [':', '=>']); foreach ($updates as $update) { $grid->addRow([$update->getPackageName(), $update->getCurrentVersionString(), $update->getUpToDateVersionString()]); } $output->writeln($grid->render()); $output->writeln(''); $output->writeln('run <comment>oro:package:update <info>package</info></comment> to update'); } else { $output->writeln('<comment>No updates available</comment>'); } return 0; }
/** * @test */ public function shouldWorkWithOneColumn() { $expectedResult = <<<GRID 1 1 1 10 GRID; $grid = new Grid(1); $grid->addRow(['1']); $grid->addRow(['1']); $grid->addRow(['1']); $grid->addRow(['10']); $expected = preg_replace('/(\\r\\n)|\\n/m', PHP_EOL, $expectedResult); $this->assertEquals($expected, $grid->render()); }