Beispiel #1
0
 /**
  * Execute the command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return mixed
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $climate = new CLImate();
     $climate->br();
     try {
         $packages = $this->ladder->getOutdatedPackages();
         if (!$packages) {
             $climate->write('All dependencies match the latest package versions <green>:)</green>')->br();
             return;
         }
         $outdated = [];
         $upgradable = [];
         foreach ($packages as $name => list($constraint, $version, $latest)) {
             if (Version::satisfies($latest, $constraint)) {
                 $latest = $this->diff($version, $latest);
                 $upgradable[] = [$name, $version, '→', $latest];
             } else {
                 $latest = $this->diff($version, $latest);
                 $outdated[] = [$name, $version, '→', $latest];
             }
         }
         if ($outdated) {
             $climate->columns($outdated, 3)->br();
         }
         if ($upgradable) {
             $climate->write('The following dependencies are satisfied by their declared version constraint, but the installed versions are behind. You can install the latest versions without modifying your composer.json file by using \'composer update\'.')->br();
             $climate->columns($upgradable, 3)->br();
         }
     } catch (ClimbException $exception) {
         $climate->error($exception->getMessage())->br();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function process()
 {
     $msg = 'Processing workflow';
     if ($this->workflow instanceof Workflow and $name = $this->workflow->getName()) {
         $msg .= ': ' . $name;
     }
     $this->climate->write($msg . "\n");
     $result = $this->workflow->process();
     $this->climate->info('Time elapsed: ' . $result->getElapsed()->format('%i minute(s) %s second(s)'));
     $this->climate->info('Total processed: ' . $result->getTotalProcessedCount() . ' row(s)');
     if ($errorCount = $result->getErrorCount() > 0) {
         $this->climate->error('Errors: ' . $errorCount);
     }
     return $result;
 }