From 9a81068e0652c07f3630979259a8856dd9b87444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=89=AC?= <3280204+ycrao@users.noreply.github.com> Date: Sat, 27 Dec 2025 17:41:53 +0800 Subject: [PATCH 1/5] Update index_root configuration access in RouteCommand --- flight/commands/RouteCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flight/commands/RouteCommand.php b/flight/commands/RouteCommand.php index bbcf52e..1b2691d 100644 --- a/flight/commands/RouteCommand.php +++ b/flight/commands/RouteCommand.php @@ -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; } @@ -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 () { From 94c58ad14cc58b8330bf5fd8cc134cf2658dc8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=89=AC?= <3280204+ycrao@users.noreply.github.com> Date: Sat, 27 Dec 2025 18:18:28 +0800 Subject: [PATCH 2/5] Update app_root configuration access in ControllerCommand --- flight/commands/ControllerCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/commands/ControllerCommand.php b/flight/commands/ControllerCommand.php index 9706d97..cfea2ae 100644 --- a/flight/commands/ControllerCommand.php +++ b/flight/commands/ControllerCommand.php @@ -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; } @@ -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; @@ -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)); } } From c8d38cae08779006b3dfc67cf90ddcab5e402e95 Mon Sep 17 00:00:00 2001 From: yangzhi-rao Date: Sat, 27 Dec 2025 18:40:58 +0800 Subject: [PATCH 3/5] fix tests --- tests/commands/ControllerCommandTest.php | 4 ++-- tests/commands/RouteCommandTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/commands/ControllerCommandTest.php b/tests/commands/ControllerCommandTest.php index 510aaa2..7a58aca 100644 --- a/tests/commands/ControllerCommandTest.php +++ b/tests/commands/ControllerCommandTest.php @@ -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', 'add(new ControllerCommand(['app_root' => 'tests/commands/'])); + $app->add(new ControllerCommand(['subway' => ['app_root' => 'tests/commands/']])); $app->handle(['runway', 'make:controller', 'Test']); $this->assertStringContainsString('TestController already exists.', file_get_contents(static::$ou)); @@ -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(['subway' => ['app_root' => 'tests/commands/']])); $app->handle(['runway', 'make:controller', 'Test']); $this->assertFileExists(__DIR__ . '/controllers/TestController.php'); diff --git a/tests/commands/RouteCommandTest.php b/tests/commands/RouteCommandTest.php index 0d2aee7..eef2b84 100644 --- a/tests/commands/RouteCommandTest.php +++ b/tests/commands/RouteCommandTest.php @@ -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(['subway' => ['index_root' => 'tests/commands/index.php']])); @$app->handle(['runway', 'routes']); $this->assertStringContainsString('Routes', file_get_contents(static::$ou)); @@ -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)); From b90d8dd94c47809578e188f6102ff91dfa608166 Mon Sep 17 00:00:00 2001 From: yangzhi-rao Date: Sat, 27 Dec 2025 18:45:12 +0800 Subject: [PATCH 4/5] update --- tests/commands/ControllerCommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commands/ControllerCommandTest.php b/tests/commands/ControllerCommandTest.php index 7a58aca..f4903a2 100644 --- a/tests/commands/ControllerCommandTest.php +++ b/tests/commands/ControllerCommandTest.php @@ -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', 'add(new ControllerCommand(['subway' => ['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)); @@ -76,7 +76,7 @@ public function testControllerAlreadyExists(): void public function testCreateController(): void { $app = $this->newApp('test', '0.0.1'); - $app->add(new ControllerCommand(['subway' => ['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'); From c2e0f4d40c4dd18ad73ba6d48c55aad8459735ee Mon Sep 17 00:00:00 2001 From: yangzhi-rao Date: Sat, 27 Dec 2025 18:47:37 +0800 Subject: [PATCH 5/5] fix typo --- tests/commands/RouteCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/commands/RouteCommandTest.php b/tests/commands/RouteCommandTest.php index eef2b84..993599c 100644 --- a/tests/commands/RouteCommandTest.php +++ b/tests/commands/RouteCommandTest.php @@ -101,7 +101,7 @@ public function testGetRoutes(): void { $app = @$this->newApp('test', '0.0.1'); $this->createIndexFile(); - $app->add(new RouteCommand(['subway' => ['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));