|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Changelog keeper |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://github.com/hiqdev/chkipper |
|
6
|
|
|
* @package chkipper |
|
7
|
|
|
* @license BSD-3-Clause |
|
8
|
|
|
* @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/) |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace hiqdev\chkipper\console; |
|
12
|
|
|
|
|
13
|
|
|
use Exception; |
|
14
|
|
|
use hiqdev\chkipper\helpers\File; |
|
15
|
|
|
use hiqdev\chkipper\lib\modifiers\Normalization; |
|
16
|
|
|
use hiqdev\chkipper\lib\parsers\GitLogParser; |
|
17
|
|
|
use hiqdev\chkipper\lib\parsers\MarkdownParser; |
|
18
|
|
|
use hiqdev\chkipper\lib\renderers\MarkdownRenderer; |
|
19
|
|
|
use Yii; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Bump Controller. |
|
23
|
|
|
* |
|
24
|
|
|
* @author Andrii Vasyliev <[email protected]> |
|
25
|
|
|
*/ |
|
26
|
|
|
class BumpController extends \yii\console\Controller |
|
27
|
|
|
{ |
|
28
|
|
|
public function actionIndex($version = null) |
|
29
|
|
|
{ |
|
30
|
|
|
$config = Yii::$app->config; |
|
31
|
|
|
$historyFile = $config->historyFile; |
|
32
|
|
|
$changelogFile = $config->getChangelogFile(); |
|
|
|
|
|
|
33
|
|
|
$parser = Yii::createObject(MarkdownParser::class); |
|
34
|
|
|
$history = $parser->parsePath($historyFile); |
|
35
|
|
|
$gitlog = Yii::createObject(GitLogParser::class); |
|
36
|
|
|
$gitlog->parseGitLog(); |
|
37
|
|
|
$history->merge($gitlog->getHistory(), true); |
|
38
|
|
|
|
|
39
|
|
|
if ($version) { |
|
40
|
|
|
if ($version === 'dev') { |
|
41
|
|
|
$version = $history->lastTag; |
|
42
|
|
|
} |
|
43
|
|
|
$history->setFirstTag($version); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
Normalization::create()->run($history); |
|
47
|
|
|
|
|
48
|
|
|
$historyRenderer = Yii::createObject(MarkdownRenderer::class); |
|
49
|
|
|
$changelogRenderer = $config->createChangelogRenderer(); |
|
50
|
|
|
File::write($historyFile, $historyRenderer->render($history)); |
|
51
|
|
|
File::write($changelogFile, $changelogRenderer->render($history)); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function actionParse($path) |
|
55
|
|
|
{ |
|
56
|
|
|
if (!file_exists($path)) { |
|
57
|
|
|
throw new Exception('wrong path: ' . $path); |
|
58
|
|
|
} |
|
59
|
|
|
$parser = new MarkdownParser(); |
|
|
|
|
|
|
60
|
|
|
$history = $parser->parsePath($path); |
|
61
|
|
|
var_dump($history->getTags()); |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.