Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flight/commands/ControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(array $config)
public function execute(string $controller)
{
$io = $this->app()->io();
if (isset($this->config['app_root']) === false) {
if (isset($this->config['runway']['app_root']) === false) {
$io->error('app_root not set in .runway-config.json', true);
return;
}
Expand All @@ -38,7 +38,7 @@ public function execute(string $controller)
$controller .= 'Controller';
}

$controllerPath = getcwd() . DIRECTORY_SEPARATOR . $this->config['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php';
$controllerPath = getcwd() . DIRECTORY_SEPARATOR . $this->config['runway']['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php';
if (file_exists($controllerPath) === true) {
$io->error($controller . ' already exists.', true);
return;
Expand Down Expand Up @@ -86,6 +86,6 @@ public function execute(string $controller)
protected function persistClass(string $controllerName, PhpFile $file)
{
$printer = new \Nette\PhpGenerator\PsrPrinter();
file_put_contents(getcwd() . DIRECTORY_SEPARATOR . $this->config['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controllerName . '.php', $printer->printFile($file));
file_put_contents(getcwd() . DIRECTORY_SEPARATOR . $this->config['runway']['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controllerName . '.php', $printer->printFile($file));
}
}
5 changes: 3 additions & 2 deletions flight/commands/RouteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public function execute()
{
$io = $this->app()->io();

if (isset($this->config['index_root']) === false) {

if (isset($this->config['runway']['index_root']) === false) {
$io->error('index_root not set in .runway-config.json', true);
return;
}
Expand All @@ -50,7 +51,7 @@ public function execute()

$cwd = getcwd();

$index_root = $cwd . '/' . $this->config['index_root'];
$index_root = $cwd . '/' . $this->config['runway']['index_root'];

// This makes it so the framework doesn't actually execute
Flight::map('start', function () {
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/ControllerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testControllerAlreadyExists(): void
$app = $this->newApp('test', '0.0.1');
mkdir(__DIR__ . '/controllers/');
file_put_contents(__DIR__ . '/controllers/TestController.php', '<?php class TestController {}');
$app->add(new ControllerCommand(['app_root' => 'tests/commands/']));
$app->add(new ControllerCommand(['runway' => ['app_root' => 'tests/commands/']]));
$app->handle(['runway', 'make:controller', 'Test']);

$this->assertStringContainsString('TestController already exists.', file_get_contents(static::$ou));
Expand All @@ -76,7 +76,7 @@ public function testControllerAlreadyExists(): void
public function testCreateController(): void
{
$app = $this->newApp('test', '0.0.1');
$app->add(new ControllerCommand(['app_root' => 'tests/commands/']));
$app->add(new ControllerCommand(['runway' => ['app_root' => 'tests/commands/']]));
$app->handle(['runway', 'make:controller', 'Test']);

$this->assertFileExists(__DIR__ . '/controllers/TestController.php');
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/RouteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function testGetRoutes(): void
{
$app = @$this->newApp('test', '0.0.1');
$this->createIndexFile();
$app->add(new RouteCommand(['index_root' => 'tests/commands/index.php']));
$app->add(new RouteCommand(['runway' => ['index_root' => 'tests/commands/index.php']]));
@$app->handle(['runway', 'routes']);

$this->assertStringContainsString('Routes', file_get_contents(static::$ou));
Expand All @@ -127,7 +127,7 @@ public function testGetPostRoute(): void
{
$app = @$this->newApp('test', '0.0.1');
$this->createIndexFile();
$app->add(new RouteCommand(['index_root' => 'tests/commands/index.php']));
$app->add(new RouteCommand(['runway' => ['index_root' => 'tests/commands/index.php']]));
@$app->handle(['runway', 'routes', '--post']);

$this->assertStringContainsString('Routes', file_get_contents(static::$ou));
Expand Down