public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $releaseName = $input->getArgument('release'); if ($releaseName === null) { throw new InvalidArgumentException('A release name is required'); } $log = $this->changeLog->parse(); // Don't continue if there is no unreleased version if (!$log->hasRelease('unreleased')) { throw new ReleaseNotFoundException('Unable to find an unreleased version.'); } // Work out what version number we actually want $newReleaseName = $log->getNextVersion($releaseName); // Don't continue if the release already exists if ($log->hasRelease($newReleaseName)) { throw new ReleaseExistsException('A release with the name "' . $newReleaseName . '" already exists."'); } $release = $log->getRelease('unreleased'); $release->setName($newReleaseName); $newLink = $input->getOption('link'); if ($newLink === null) { $release->setLink(null); $release->setLinkName(null); } else { $newLinkName = $input->getOption('linkName'); $newLinkName = $newLinkName === null ? $newReleaseName : $newLinkName; $release->setLink($newLink); $release->setLinkName($newLinkName); } // Remove and re-add the release to trigger the log internals $log->addRelease($release); $log->removeRelease('unreleased'); $this->changeLog->write($log); }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $log = $this->changeLog->parse(); $releaseName = $input->getArgument('release'); // Create the release_name if needed if (!$log->hasRelease($releaseName)) { $newRelease = new LogRelease($releaseName); $log->addRelease($newRelease); } $release = $log->getRelease($releaseName); $release->addChange($input->getArgument('type'), $input->getArgument('change')); $this->changeLog->write($log); }
/** * Reads and writes the log to covert the format. * * @param InputInterface $input * @param OutputInterface $output */ public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $log = $this->changeLog->parse(); $this->changeLog->write($log); }