Liip\RMT\Changelog\ChangelogManager::update PHP Method

update() public method

public update ( $version, $comment, $options = [] )
    public function update($version, $comment, $options = array())
    {
        $lines = file($this->filePath, FILE_IGNORE_NEW_LINES);
        $lines = $this->formatter->updateExistingLines($lines, $version, $comment, $options);
        file_put_contents($this->filePath, implode("\n", $lines));
    }

Usage Example

Beispiel #1
0
 public function execute()
 {
     // Handle the commits dump
     if ($this->options['dump-commits'] == true) {
         try {
             $extraLines = Context::get('vcs')->getAllModificationsSince(Context::get('version-persister')->getCurrentVersionTag(), false, $this->options['exclude-merge-commits']);
             $this->options['extra-lines'] = $extraLines;
         } catch (NoReleaseFoundException $e) {
             Context::get('output')->writeln('<error>No commits dumped as this is the first release</error>');
         }
         unset($this->options['dump-commits']);
     }
     $manager = new ChangelogManager($this->options['file'], $this->options['format']);
     $manager->update(Context::getParam('new-version'), Context::get('information-collector')->getValueFor('comment'), array_merge(array('type' => Context::get('information-collector')->getValueFor('type', null)), $this->options));
     $this->confirmSuccess();
 }