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();
     }
 }
Beispiel #2
0
 /**
  * Check if the package is upgradable.
  *
  * @return bool
  */
 public function isUpgradable()
 {
     return Version::satisfies($this->getLatestVersion(), $this->prettyVersion);
 }