コード例 #1
0
 public function testAddVersion()
 {
     $file = sys_get_temp_dir() . '/test.xml';
     @unlink($file);
     $changelog = new Changelog($file);
     $commits = array('myhash' => 'my message', 'abc' => 'def');
     $changelog->addVersion('0.1.0', 'First version', $commits);
     $this->assertContains('version="0.1.0"', file_get_contents($file));
     $versions = $changelog->getVersions();
     $this->assertEquals(1, $versions->length);
 }
コード例 #2
0
 public function render($file = "CHANGELOG.md")
 {
     $buffer = '# Changelog' . PHP_EOL;
     $versions = $this->changelog->getVersions();
     foreach ($versions as $version) {
         $versionNumber = Changelog::getVersionNumberFromVersion($version);
         $title = Changelog::getTitleFromVersion($version);
         $buffer .= PHP_EOL . '## ' . $versionNumber . ' - ' . $title . PHP_EOL . PHP_EOL;
         $commits = Changelog::getCommitsFromVersion($version);
         foreach ($commits as $hash => $message) {
             $buffer .= '* ' . $message . " [{$hash}]" . PHP_EOL;
         }
     }
     file_put_contents($file, $buffer);
 }
コード例 #3
0
 public function execute()
 {
     $changelog = new Changelog($this->options['file']);
     $changelog->addVersion($this->context->getNewVersion(), $this->context->getInformationCollector()->getValueFor('comment'), $this->getCommits());
     $this->confirmSuccess();
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 public function save(Version $version)
 {
     $comment = $this->context->getInformationCollector()->getValueFor('comment');
     $type = $this->context->getInformationCollector()->getValueFor('type', null);
     $this->changelog->addVersion($version, $comment, array());
 }