Ejemplo n.º 1
0
 public function testParsePath()
 {
     $this->object->parsePath(__DIR__ . '/big-git-log.txt');
     $this->object->getHistory()->setProject('hiqdev/chkipper');
     $renderer = new MarkdownRenderer();
     $text = $renderer->render($this->object->getHistory());
     $this->assertEquals(file_get_contents(__DIR__ . '/big-git-log.md'), $text);
 }
Ejemplo n.º 2
0
 public function testRender()
 {
     $path = __DIR__ . '/minimal.md';
     $parser = new MarkdownParser();
     $history = $parser->parsePath($path);
     $text = $this->object->render($history);
     $this->assertEquals(file_get_contents($path), $text);
 }
Ejemplo n.º 3
0
 public function actionIndex($version = null)
 {
     $historyFile = Yii::$app->config->historyFile;
     $changelogFile = Yii::$app->config->changelogFile;
     $parser = new MarkdownParser();
     $history = $parser->parsePath($historyFile);
     $gitlog = new GitLogParser();
     $gitlog->parseGitLog();
     $history->merge($gitlog->getHistory(), true);
     $history->normalize();
     if ($version) {
         if ($version === 'dev') {
             $version = $history->lastTag;
         }
         $history->setFirstTag($version);
     }
     $historyRenderer = new MarkdownRenderer();
     $changelogRenderer = new ChangelogMarkdownRenderer();
     File::write($historyFile, $historyRenderer->render($history));
     File::write($changelogFile, $changelogRenderer->render($history));
 }