Skip to content

Commit

Permalink
renamed console <- controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 8, 2017
1 parent 54b8af9 commit 0621edb
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/base/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace hidev\base;

use hidev\controllers\CommonBehavior;
use hidev\console\CommonBehavior;

/**
* Basic controller.
Expand Down
13 changes: 12 additions & 1 deletion src/base/Starter.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function startProject()
$this->loadEnv();
$this->loadGoals();
$this->addAliases();
$this->addAutoloader();
$this->requireAll();
$this->includeAll();
$this->moreConfig();
Expand Down Expand Up @@ -104,7 +105,7 @@ public function getConfig()
if (!empty($config['controllerMap'])) {
foreach ($config['controllerMap'] as &$def) {
if (is_array($def) && empty($def['class'])) {
$def['class'] = \hidev\controllers\CommonController::class;
$def['class'] = \hidev\console\CommonController::class;
}
}
}
Expand Down Expand Up @@ -207,6 +208,16 @@ private function hasAlias($alias, $exact = true)
return $pos === false ? isset(Yii::$aliases[$alias]) : isset(Yii::$aliases[substr($alias, 0, $pos)][$alias]);
}

public function addAutoloader()
{
$autoloader = './vendor/autoload.php';
if (file_exists($autoloader)) {
spl_autoload_unregister(['Yii', 'autoload']);
require $autoloader;
spl_autoload_register(['Yii', 'autoload'], true, true);
}
}

/**
* - install configured plugins and register their app config
* - install project dependencies and register
Expand Down
10 changes: 5 additions & 5 deletions src/config/basis.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'basePath' => dirname(__DIR__),
'vendorPath' => HIDEV_VENDOR_DIR,
'runtimePath' => $runtimePath,
'controllerNamespace' => 'hidev\\controllers',
'controllerNamespace' => 'hidev\\console',
'defaultRoute' => 'default',
'bootstrap' => ['log'],
'components' => [
Expand Down Expand Up @@ -92,17 +92,17 @@
],
'controllerMap' => [
'--version' => [
'class' => \hidev\controllers\VersionController::class,
'class' => \hidev\console\VersionController::class,
'own' => true,
],
'.gitignore' => [
'class' => \hidev\controllers\GitignoreController::class,
'class' => \hidev\console\GitignoreController::class,
],
'github' => [
'class' => \hidev\controllers\GithubController::class,
'class' => \hidev\console\GithubController::class,
],
'dump' => [
'class' => \hidev\controllers\DumpController::class,
'class' => \hidev\console\DumpController::class,
],
],
'container' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

use hidev\base\Controller;
use Yii;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

use Yii;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

use Symfony\Component\Yaml\Yaml;
use Yii;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

/**
* Git.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

use yii\helpers\Json;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

/**
* `.gitignore` file generation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

use Exception;
use hidev\base\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

/**
* Controller for svn:ignore.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

/**
* VCS ignore file generation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/

namespace hidev\controllers;
namespace hidev\console;

/**
* Version management.
Expand Down

0 comments on commit 0621edb

Please sign in to comment.