Beispiel #1
0
 public function actionIndex()
 {
     $commitsFile = '.hidev/commits.md';
     $historyFile = Yii::$app->config->historyFile;
     if (!file_exists($commitsFile)) {
         throw new Exception("no {$commitsFile} found");
     }
     $history = '';
     $commits = file($commitsFile);
     foreach ($commits as $line) {
         if (preg_match('/^## (\\S+) (\\S+)$/', $line, $m)) {
             $history .= "## [{$m['1']}] - {$m['2']}\n";
             // - ebeece6 2016-06-10 commit message (sol@hiqdev.com)
         } elseif (preg_match('/^    - (\\S{7}) (\\S+) (.*?) \\((\\S+)\\)$/', $line, $m)) {
             $history .= "    - [{$m['1']}] {$m['2']} {$m['3']} [{$m['4']}]\n";
         } else {
             $history .= $line;
         }
     }
     File::write($historyFile, $history);
 }
Beispiel #2
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));
 }