Skip to content

Commit 89eb3df

Browse files
committed
prepare for release 2.0.6
1 parent a0ca029 commit 89eb3df

File tree

4 files changed

+82
-60
lines changed

4 files changed

+82
-60
lines changed

build/controllers/ReleaseController.php

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Yii;
1111
use yii\base\Exception;
1212
use yii\console\Controller;
13+
use yii\helpers\ArrayHelper;
1314

1415
/**
1516
* ReleaseController is there to help preparing releases
@@ -25,49 +26,54 @@ class ReleaseController extends Controller
2526
* Usage:
2627
*
2728
* ```
28-
* ./build/build release/prepare 2.0.0-beta
29+
* ./build/build release/prepare framework 2.0.0-beta
30+
* ./build/build release/prepare redis 2.0.0-beta
2931
* ```
3032
*
3133
*/
32-
public function actionPrepare($version)
34+
public function actionPrepare(array $what, $version)
3335
{
34-
$this->resortChangelogs($version);
35-
$this->mergeChangelogs($version);
36-
$this->closeChangelogs($version);
37-
$this->composerSetStability($version);
38-
$this->updateYiiVersion($version);
36+
$this->resortChangelogs($what, $version);
37+
$this->closeChangelogs($what, $version);
38+
$this->composerSetStability($what, $version);
39+
if (in_array('framework', $what)) {
40+
$this->updateYiiVersion($version);
41+
}
3942
}
4043

4144
/**
4245
* Usage:
4346
*
4447
* ```
45-
* ./build/build release/done 2.0.0-dev 2.0.0-rc
48+
* ./build/build release/done framework 2.0.0-dev 2.0.0-rc
49+
* ./build/build release/done redis 2.0.0-dev 2.0.0-rc
4650
* ```
4751
*/
48-
public function actionDone($devVersion, $nextVersion)
52+
public function actionDone(array $what, $devVersion, $nextVersion)
4953
{
50-
$this->openChangelogs($nextVersion);
51-
$this->composerSetStability('dev');
52-
$this->updateYiiVersion($devVersion);
54+
$this->openChangelogs($what, $nextVersion);
55+
$this->composerSetStability($what, 'dev');
56+
if (in_array('framework', $what)) {
57+
$this->updateYiiVersion($devVersion);
58+
}
5359
}
5460

55-
protected function closeChangelogs($version)
61+
protected function closeChangelogs($what, $version)
5662
{
5763
$v = str_replace('\\-', '[\\- ]', preg_quote($version, '/'));
5864
$headline = $version . ' ' . date('F d, Y');
5965
$this->sed(
6066
'/'.$v.' under development\n(-+?)\n/',
6167
$headline . "\n" . str_repeat('-', strlen($headline)) . "\n",
62-
$this->getChangelogs()
68+
$this->getChangelogs($what)
6369
);
6470
}
6571

66-
protected function openChangelogs($version)
72+
protected function openChangelogs($what, $version)
6773
{
6874
$headline = "\n$version under development\n";
6975
$headline .= str_repeat('-', strlen($headline) - 2) . "\n\n";
70-
foreach($this->getChangelogs() as $file) {
76+
foreach($this->getChangelogs($what) as $file) {
7177
$lines = explode("\n", file_get_contents($file));
7278
$hl = [
7379
array_shift($lines),
@@ -79,41 +85,16 @@ protected function openChangelogs($version)
7985
}
8086
}
8187

82-
protected function resortChangelogs($version)
88+
protected function resortChangelogs($what, $version)
8389
{
84-
foreach($this->getChangelogs() as $file) {
90+
foreach($this->getChangelogs($what) as $file) {
8591
// split the file into relevant parts
8692
list($start, $changelog, $end) = $this->splitChangelog($file, $version);
8793
$changelog = $this->resortChangelog($changelog);
8894
file_put_contents($file, implode("\n", array_merge($start, $changelog, $end)));
8995
}
9096
}
9197

92-
protected function mergeChangelogs($version)
93-
{
94-
$file = $this->getFrameworkChangelog();
95-
// split the file into relevant parts
96-
list($start, $changelog, $end) = $this->splitChangelog($file, $version);
97-
98-
$changelog = $this->resortChangelog($changelog);
99-
100-
$changelog[] = '';
101-
$extensions = $this->getExtensionChangelogs();
102-
asort($extensions);
103-
foreach($extensions as $changelogFile) {
104-
if (!preg_match('~extensions/([a-z]+)/CHANGELOG\\.md~', $changelogFile, $m)) {
105-
throw new Exception("Illegal extension changelog file: " . $changelogFile);
106-
}
107-
list( , $extensionChangelog, ) = $this->splitChangelog($changelogFile, $version);
108-
$name = $m[1];
109-
$ucname = ucfirst($name);
110-
$changelog[] = "### $ucname Extension (yii2-$name)";
111-
$changelog = array_merge($changelog, $extensionChangelog);
112-
}
113-
114-
file_put_contents($file, implode("\n", array_merge($start, $changelog, $end)));
115-
}
116-
11798
/**
11899
* Extract changelog content for a specific version
119100
*/
@@ -150,28 +131,69 @@ protected function resortChangelog($changelog)
150131
foreach($changelog as $i => $line) {
151132
$changelog[$i] = rtrim($line);
152133
}
134+
$changelog = array_filter($changelog);
135+
136+
$i = 0;
137+
ArrayHelper::multisort($changelog, function($line) use (&$i) {
138+
if (preg_match('/^- (Chg|Enh|Bug)( #\d+(, #\d+)*)?: .+$/', $line, $m)) {
139+
$o = ['Bug' => 'C', 'Enh' => 'D', 'Chg' => 'E'];
140+
print_r($m);
141+
return $o[$m[1]] . ' ' . (!empty($m[2]) ? $m[2] : 'AAAA' . $i++);
142+
}
143+
return 'B' . $i++;
144+
}, SORT_ASC, SORT_NATURAL);
145+
146+
// re-add leading and trailing lines
147+
array_unshift($changelog, '');
148+
$changelog[] = '';
149+
$changelog[] = '';
153150

154-
// TODO sorting
155151
return $changelog;
156152
}
157153

158-
protected function getChangelogs()
154+
protected function getChangelogs($what)
159155
{
160-
return array_merge([$this->getFrameworkChangelog()], $this->getExtensionChangelogs());
156+
$changelogs = [];
157+
if (in_array('framework', $what)) {
158+
$changelogs[] = $this->getFrameworkChangelog();
159+
}
160+
161+
return array_merge($changelogs, $this->getExtensionChangelogs($what));
161162
}
162163

163164
protected function getFrameworkChangelog()
164165
{
165166
return YII2_PATH . '/CHANGELOG.md';
166167
}
167168

168-
protected function getExtensionChangelogs()
169+
protected function getExtensionChangelogs($what)
169170
{
170-
return glob(dirname(YII2_PATH) . '/extensions/*/CHANGELOG.md');
171+
return array_filter(glob(dirname(YII2_PATH) . '/extensions/*/CHANGELOG.md'), function($elem) use ($what) {
172+
foreach($what as $ext) {
173+
if (strpos($elem, "extensions/$ext/CHANGELOG.md") !== false) {
174+
return true;
175+
}
176+
}
177+
return false;
178+
});
171179
}
172180

173-
protected function composerSetStability($version)
181+
protected function composerSetStability($what, $version)
174182
{
183+
$apps = [];
184+
if (in_array('app-advanced', $what)) {
185+
$apps[] = dirname(YII2_PATH) . '/apps/advanced/composer.json';
186+
}
187+
if (in_array('app-basic', $what)) {
188+
$apps[] = dirname(YII2_PATH) . '/apps/basic/composer.json';
189+
}
190+
if (in_array('app-benchmark', $what)) {
191+
$apps[] = dirname(YII2_PATH) . '/apps/benchmark/composer.json';
192+
}
193+
if (empty($apps)) {
194+
return;
195+
}
196+
175197
$stability = 'stable';
176198
if (strpos($version, 'alpha') !== false) {
177199
$stability = 'alpha';
@@ -186,11 +208,7 @@ protected function composerSetStability($version)
186208
$this->sed(
187209
'/"minimum-stability": "(.+?)",/',
188210
'"minimum-stability": "' . $stability . '",',
189-
[
190-
dirname(YII2_PATH) . '/apps/advanced/composer.json',
191-
dirname(YII2_PATH) . '/apps/basic/composer.json',
192-
dirname(YII2_PATH) . '/apps/benchmark/composer.json',
193-
]
211+
$apps
194212
);
195213
}
196214

framework/BaseYii.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class BaseYii
9393
*/
9494
public static function getVersion()
9595
{
96-
return '2.0.6-dev';
96+
return '2.0.6';
9797
}
9898

9999
/**

framework/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Yii Framework 2 Change Log
22
==========================
33

4-
2.0.6 under development
5-
-----------------------
4+
2.0.6 August 05, 2015
5+
---------------------
66

77
- Bug #4763: Fixed display issue with overlapping call stack item on exception display page (cebe)
88
- Bug #7305: Logging of Exception objects resulted in failure of the logger i.e. no logs being written (cebe)
@@ -15,12 +15,12 @@ Yii Framework 2 Change Log
1515
- Bug #8483: Sequence name in `Schema::getLastInsertId()` was not properly quoted (nineinchnick)
1616
- Bug #8506: Cleaning of output buffer in `Widget::run()` conflicts with `Pjax` widget which did the cleanup itself (cebe, joester89)
1717
- Bug #8544: Fixed `yii\db\ActiveRecord` does not update attribute specified at `optimisticLock()` after save (klimov-paul)
18-
- Bug #8551: `yii\pgsql\QueryBuilder::batchInsert()` may cause "undefined index" error (arkhamvm)
18+
- Bug #8549: Fixed `yii\caching\FileCache` doesn't lock cache files when reading (iworker)
19+
- Bug #8551: `yii\pgsql\QueryBuilder::batchInsert()` may cause "undefined index" error (arkhamvm)
1920
- Bug #8585: Fixed `yii\helpers\Html::activeTextarea()` does not allow value overriding via options (klimov-paul)
2021
- Bug #8592: Fixed `yii\db\Command::getRawSql()` unable to parse params specified without colon (':') (klimov-paul)
2122
- Bug #8593: Fixed `yii\db\ActiveQuery` produces incorrect SQL for aggregations, when `sql` field is set (klimov-paul)
2223
- Bug #8595: Fixed `yii\rbac\DbManager::checkAccessFromCache()` to check against auth items loaded in cache recursively (achretien, qiangxue)
23-
- Bug #8549: Fixed `yii\caching\FileCache` doesn't lock cache files when reading (iworker)
2424
- Bug #8606: Fixed `yii\web\Response::xSendFile()` does not reset format (vyants)
2525
- Bug #8627: Fixed `yii\db\Migration` produces incorrect results due to table schema caching (klimov-paul)
2626
- Bug #8661: Fixed `yii.activeForm.js` scrolling to top (nkovacs)
@@ -48,7 +48,7 @@ Yii Framework 2 Change Log
4848
- Enh #7259: Added `errorAttributes` parameter to ActiveForm `afterValidate` event. Made scrolling to first error optional (nkovacs)
4949
- Enh #8070: `yii\console\controllers\MessageController` now sorts created messages, even if there is no new one, while saving to PHP file (klimov-paul)
5050
- Enh #8286: `yii\console\controllers\MessageController` improved allowing extraction of nested translator calls (klimov-paul)
51-
- Ehn #8373: Check also `post_max_size` parameter in `yii\validators\FileValidator::getSizeLimit()` (maxxer)
51+
- Enh #8373: Check also `post_max_size` parameter in `yii\validators\FileValidator::getSizeLimit()` (maxxer)
5252
- Enh #8415: `yii\helpers\Html` allows correct rendering of conditional comments containing `!IE` (salaros, klimov-paul)
5353
- Enh #8444: Added `yii\widgets\LinkPager::$linkOptions` to allow configuring HTML attributes of the `a` tags (zinzinday)
5454
- Enh #8486: Added support to automatically set the `maxlength` attribute for `Html::activeTextArea()` and `Html::activePassword()` (klimov-paul)

framework/classes.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
'yii\db\BaseActiveRecord' => YII2_PATH . '/db/BaseActiveRecord.php',
9696
'yii\db\BatchQueryResult' => YII2_PATH . '/db/BatchQueryResult.php',
9797
'yii\db\ColumnSchema' => YII2_PATH . '/db/ColumnSchema.php',
98+
'yii\db\ColumnSchemaBuilder' => YII2_PATH . '/db/ColumnSchemaBuilder.php',
9899
'yii\db\Command' => YII2_PATH . '/db/Command.php',
99100
'yii\db\Connection' => YII2_PATH . '/db/Connection.php',
100101
'yii\db\DataReader' => YII2_PATH . '/db/DataReader.php',
@@ -108,6 +109,7 @@
108109
'yii\db\QueryInterface' => YII2_PATH . '/db/QueryInterface.php',
109110
'yii\db\QueryTrait' => YII2_PATH . '/db/QueryTrait.php',
110111
'yii\db\Schema' => YII2_PATH . '/db/Schema.php',
112+
'yii\db\SchemaBuilderTrait' => YII2_PATH . '/db/SchemaBuilderTrait.php',
111113
'yii\db\StaleObjectException' => YII2_PATH . '/db/StaleObjectException.php',
112114
'yii\db\TableSchema' => YII2_PATH . '/db/TableSchema.php',
113115
'yii\db\Transaction' => YII2_PATH . '/db/Transaction.php',
@@ -120,6 +122,7 @@
120122
'yii\db\mssql\TableSchema' => YII2_PATH . '/db/mssql/TableSchema.php',
121123
'yii\db\mysql\QueryBuilder' => YII2_PATH . '/db/mysql/QueryBuilder.php',
122124
'yii\db\mysql\Schema' => YII2_PATH . '/db/mysql/Schema.php',
125+
'yii\db\oci\ColumnSchemaBuilder' => YII2_PATH . '/db/oci/ColumnSchemaBuilder.php',
123126
'yii\db\oci\QueryBuilder' => YII2_PATH . '/db/oci/QueryBuilder.php',
124127
'yii\db\oci\Schema' => YII2_PATH . '/db/oci/Schema.php',
125128
'yii\db\pgsql\QueryBuilder' => YII2_PATH . '/db/pgsql/QueryBuilder.php',
@@ -280,6 +283,7 @@
280283
'yii\web\Link' => YII2_PATH . '/web/Link.php',
281284
'yii\web\Linkable' => YII2_PATH . '/web/Linkable.php',
282285
'yii\web\MethodNotAllowedHttpException' => YII2_PATH . '/web/MethodNotAllowedHttpException.php',
286+
'yii\web\MultiFieldSession' => YII2_PATH . '/web/MultiFieldSession.php',
283287
'yii\web\NotAcceptableHttpException' => YII2_PATH . '/web/NotAcceptableHttpException.php',
284288
'yii\web\NotFoundHttpException' => YII2_PATH . '/web/NotFoundHttpException.php',
285289
'yii\web\Request' => YII2_PATH . '/web/Request.php',

0 commit comments

Comments
 (0)