/** * Handles the "upgrade" command. * * @param Args $args The console arguments * @param IO $io The I/O * * @return int The status code */ public function handle(Args $args, IO $io) { $moduleFile = $this->moduleFileManager->getModuleFile(); $originVersion = $moduleFile->getVersion(); $targetVersion = $args->getArgument('version'); if (version_compare($originVersion, $targetVersion, '=')) { $io->writeLine(sprintf('Your puli.json is already at version %s.', $targetVersion)); return 0; } $this->moduleFileManager->migrate($targetVersion); $io->writeLine(sprintf('Migrated your puli.json from version %s to version %s.', $originVersion, $targetVersion)); return 0; }