Browse Source

picking-up path from composer autoload added to `PhpDocController`

tags/2.0.14
Klimov Paul 7 years ago
parent
commit
ab10e43195
  1. 14
      build/controllers/DevController.php
  2. 44
      build/controllers/PhpDocController.php
  3. 8
      docs/internals/release.md

14
build/controllers/DevController.php

@ -24,19 +24,25 @@ use yii\helpers\FileHelper;
*/
class DevController extends Controller
{
/**
* {@inheritdoc}
*/
public $defaultAction = 'all';
/**
* @var bool whether to use HTTP when cloning github repositories
*/
public $useHttp = false;
/**
* @var array
*/
public $apps = [
'basic' => 'git@github.com:yiisoft/yii2-app-basic.git',
'advanced' => 'git@github.com:yiisoft/yii2-app-advanced.git',
'benchmark' => 'git@github.com:yiisoft/yii2-app-benchmark.git',
];
/**
* @var array
*/
public $extensions = [
'apidoc' => 'git@github.com:yiisoft/yii2-apidoc.git',
'authclient' => 'git@github.com:yiisoft/yii2-authclient.git',
@ -229,7 +235,7 @@ class DevController extends Controller
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function options($actionID)
{

44
build/controllers/PhpDocController.php

@ -11,6 +11,7 @@ use Yii;
use yii\console\Controller;
use yii\helpers\Console;
use yii\helpers\FileHelper;
use yii\helpers\Json;
/**
* PhpDocController is there to help maintaining PHPDoc annotation in class files.
@ -21,6 +22,9 @@ use yii\helpers\FileHelper;
*/
class PhpDocController extends Controller
{
/**
* {@inheritdoc}
*/
public $defaultAction = 'property';
/**
* @var bool whether to update class docs directly. Setting this to false will just output docs
@ -106,13 +110,18 @@ class PhpDocController extends Controller
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function options($actionID)
{
return array_merge(parent::options($actionID), ['updateFiles', 'skipFrameworkRequirements']);
}
/**
* @param string $root
* @param bool $needsInclude
* @return array list of files.
*/
protected function findFiles($root, $needsInclude = true)
{
$except = [];
@ -132,7 +141,7 @@ class PhpDocController extends Controller
'/generators/extension/default/AutoloadExample.php',
],
'swiftmailer' => [
'/Logger.php',
'src/Logger.php',
],
'twig' => [
'/Extension.php',
@ -149,11 +158,7 @@ class PhpDocController extends Controller
if ($root === null) {
$root = dirname(YII2_PATH);
$extensionPath = "$root/extensions";
foreach (scandir($extensionPath) as $extension) {
if (ctype_alpha($extension) && is_dir($extensionPath . '/' . $extension)) {
Yii::setAlias("@yii/$extension", "$extensionPath/$extension");
}
}
$this->setUpExtensionAliases($extensionPath);
$except = [
'/apps/',
@ -230,14 +235,30 @@ class PhpDocController extends Controller
'vendor/',
]),
];
return FileHelper::findFiles($root, $options);
}
/**
* @param string $extensionPath root path containing extension repositories.
*/
private function setUpExtensionAliases($extensionPath)
{
foreach (scandir($extensionPath) as $extension) {
if (ctype_alpha($extension) && is_dir($extensionPath . '/' . $extension)) {
Yii::setAlias("@yii/$extension", "$extensionPath/$extension");
$composerConfigFile = $extensionPath . '/' . $extension . '/composer.json';
if (file_exists($composerConfigFile)) {
$composerConfig = Json::decode(file_get_contents($composerConfigFile));
if (isset($composerConfig['autoload']['psr-4'])) {
foreach ($composerConfig['autoload']['psr-4'] as $namespace => $subPath) {
$alias = '@' . str_replace('\\', '/', $namespace);
$path = rtrim("$extensionPath/$extension/$subPath", '/');
Yii::setAlias($alias, $path);
}
}
}
}
}
}
@ -285,6 +306,7 @@ class PhpDocController extends Controller
/**
* Markdown aware fix of whitespace issues in doc comments.
* @param array $lines
*/
protected function fixDocBlockIndentation(&$lines)
{
@ -340,6 +362,10 @@ class PhpDocController extends Controller
}
}
/**
* @param string $line
* @return string
*/
protected function fixParamTypes($line)
{
return preg_replace_callback('~@(param|return) ([\w\\|]+)~i', function ($matches) {
@ -706,7 +732,7 @@ class PhpDocController extends Controller
}
if (!$parentSetter) {
$note = ' This property is read-only.';
// $docline .= '-read';
//$docline .= '-read';
}
} elseif (isset($prop['set'])) {
// check if parent class has getter defined
@ -721,7 +747,7 @@ class PhpDocController extends Controller
}
if (!$parentGetter) {
$note = ' This property is write-only.';
// $docline .= '-write';
//$docline .= '-write';
}
} else {
continue;

8
docs/internals/release.md

@ -53,13 +53,13 @@ You may run it with `--update` to fetch tags for all repos to get the newest inf
Making a framework release includes the following commands (apps are always released together with the framework):
./build release framework
./build release app-basic
./build release app-advanced
./build/build release framework
./build/build release app-basic
./build/build release app-advanced
Making an extension release includes only one command (e.g. for redis):
./build release redis
./build/build release redis
The default release command will release a new minor version from the currently checked out branch.
To release another version than the default, you have to specify it using the `--version` option, e.g.

Loading…
Cancel
Save