Skip to content

Commit 1755f9a

Browse files
authored
Merge pull request #1905 from wheels-dev/fw-fixes
Merge pull request #1904 from wheels-dev/fw-fixes
2 parents be5803d + beff458 commit 1755f9a

File tree

7 files changed

+73
-89
lines changed

7 files changed

+73
-89
lines changed

cli/src/commands/wheels/server/log.cfc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ component extends="../base" {
2222
numeric lines = 50,
2323
boolean debug = false
2424
) {
25+
detailOutput.header("Wheels Server Logs");
2526
// Build the log command
2627
var logCommand = "server log";
2728

@@ -63,7 +64,14 @@ component extends="../base" {
6364
print.line();
6465

6566
// Execute the server log command
67+
detailOutput.subHeader("Executing Log Command");
68+
detailOutput.code(logCommand);
69+
6670
command(logCommand).run();
71+
72+
if (arguments.follow) {
73+
detailOutput.statusInfo("Press Ctrl+C to stop following logs");
74+
}
6775
}
6876

6977
}

cli/src/commands/wheels/server/restart.cfc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ component extends="../base" {
1717
string name,
1818
boolean force = false
1919
) {
20+
detailOutput.header("Restart Wheels Development Server");
2021
// Build the restart command
2122
var restartCommand = "server restart";
2223

@@ -45,25 +46,23 @@ component extends="../base" {
4546
restartCommand &= " --force";
4647
}
4748

48-
print.yellowLine("Restarting Wheels development server...");
49-
print.line();
49+
// Show command
50+
detailOutput.subHeader("Executing Restart Command");
51+
detailOutput.code(restartCommand);
5052

5153
// Execute the server restart command
5254
command(restartCommand).run();
5355

54-
print.line();
55-
print.greenLine("Server restarted successfully!");
56-
print.line();
57-
58-
// Also reload the Wheels application
59-
print.line("Reloading Wheels application...");
56+
detailOutput.statusSuccess("Server restarted successfully");
57+
58+
// Reload Wheels
59+
detailOutput.subHeader("Reload Wheels Application");
6060
try {
6161
command("wheels reload").run();
62-
print.greenLine("Application reloaded successfully!");
62+
detailOutput.statusSuccess("Application reloaded successfully");
6363
} catch (any e) {
64-
print.yellowLine("Note: Application reload may require manual refresh in browser.");
64+
detailOutput.statusWarning("Application reload may require manual browser refresh");
6565
}
66-
print.line();
6766
}
6867

6968
}

cli/src/commands/wheels/server/start.cfc

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
* {code:bash}
77
* wheels server start
88
* wheels server start port=8080
9-
* wheels server start rewritesEnable=true
109
* {code}
1110
**/
1211
component extends="../base" {
1312

1413
/**
1514
* @port Port number to start server on
1615
* @host Host/IP to bind server to
17-
* @rewritesEnable Enable URL rewriting
1816
* @openbrowser Open browser after starting
1917
* @directory Directory to serve (defaults to current)
2018
* @name Server name
@@ -23,27 +21,34 @@ component extends="../base" {
2321
function run(
2422
numeric port,
2523
string host = "127.0.0.1",
26-
boolean rewritesEnable,
2724
boolean openbrowser = true,
2825
string directory = getCWD(),
2926
string name,
3027
boolean force = false
3128
) {
32-
// Check if we're in a Wheels application
33-
if (!isWheelsApp(arguments.directory)) {
34-
print.redLine("This doesn't appear to be a Wheels application directory.");
35-
print.line("Looking for /vendor/wheels, /config, and /app folders in: #arguments.directory#");
36-
print.line();
37-
print.yellowLine("Did you mean to run 'wheels generate app' first?");
38-
return;
39-
}
29+
requireWheelsApp(getCWD());
30+
31+
arguments = reconstructArgs(
32+
argStruct = arguments
33+
);
34+
35+
// Header
36+
detailOutput.header("Wheels Development Server");
4037

4138
// Check if server is already running
4239
if (!arguments.force) {
43-
var serverInfo = getServerInfo();
44-
if (structKeyExists(serverInfo, "port") && serverInfo.port > 0) {
45-
print.yellowLine("Server appears to be already running on port #serverInfo.port#");
46-
print.line("Use --force to start anyway, or 'wheels server restart' to restart.");
40+
detailOutput.statusInfo("Checking server status");
41+
var statusCommand = "server status";
42+
local.result = runCommand(statusCommand);
43+
44+
// Check if server is not running
45+
if (findNoCase("running", local.result)) {
46+
detailOutput.statusWarning("Server appears to already be running");
47+
detailOutput.nextSteps([
48+
"Run 'wheels server restart' to restart the server",
49+
"Run 'wheels server stop' to stop the server",
50+
"Run with --force to start anyway"
51+
]);
4752
return;
4853
}
4954
}
@@ -53,40 +58,39 @@ component extends="../base" {
5358

5459
// Add parameters if provided
5560
if (!isNull(arguments.port)) {
56-
startCommand &= " --port=#arguments.port#";
61+
startCommand &= " port=#arguments.port#";
5762
}
5863
if (!isNull(arguments.host)) {
59-
startCommand &= " --host=#arguments.host#";
60-
}
61-
if (!isNull(arguments.rewritesEnable)) {
62-
startCommand &= " --rewritesEnable=#arguments.rewritesEnable#";
64+
startCommand &= " host=#arguments.host#";
6365
}
6466
if (!isNull(arguments.openbrowser)) {
65-
startCommand &= " --openbrowser=#arguments.openbrowser#";
67+
startCommand &= " openbrowser=#arguments.openbrowser#";
6668
}
6769
if (!isNull(arguments.name)) {
68-
startCommand &= " --name=#arguments.name#";
70+
startCommand &= " name=#arguments.name#";
6971
}
7072
if (arguments.directory != getCWD()) {
71-
startCommand &= " --directory=#arguments.directory#";
73+
startCommand &= " directory=#arguments.directory#";
7274
}
7375

74-
print.greenLine("Starting Wheels development server...");
75-
print.line();
76+
detailOutput.statusInfo("Starting Wheels development server...");
77+
78+
// Show command
79+
detailOutput.subHeader("Executing Command");
80+
detailOutput.code(startCommand);
7681

7782
// Execute the server start command
7883
command(startCommand).run();
7984

8085
// Show helpful information
81-
print.line();
82-
print.greenLine("Server started successfully!");
83-
print.line();
84-
print.line("Useful commands:");
85-
print.indentedLine("wheels server status - Check server status");
86-
print.indentedLine("wheels server log - View server logs");
87-
print.indentedLine("wheels server stop - Stop the server");
88-
print.indentedLine("wheels reload - Reload your application");
89-
print.line();
86+
detailOutput.success("Server started successfully!");
87+
88+
detailOutput.nextSteps([
89+
"wheels server status - Check server status",
90+
"wheels server log - View server logs",
91+
"wheels server stop - Stop the server",
92+
"wheels reload - Reload your application"
93+
]);
9094
}
9195

9296
/**

cli/src/commands/wheels/server/status.cfc

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ component extends="../base" {
3636
}
3737

3838
if (!arguments.json) {
39-
print.line();
40-
print.yellowLine("Wheels Server Status");
41-
print.line("===================");
42-
print.line();
39+
detailOutput.header("Wheels Server Status");
4340
}
4441

4542
// Execute the server status command
@@ -50,27 +47,24 @@ component extends="../base" {
5047
try {
5148
var serverInfo = $getServerInfo();
5249
if (structKeyExists(serverInfo, "port") && serverInfo.port > 0) {
53-
print.line();
54-
print.line("Wheels Application Info:");
55-
print.indentedLine("URL: #serverInfo.serverURL#");
50+
detailOutput.subHeader("Wheels Application Info");
51+
detailOutput.metric("URL", serverInfo.serverURL);
5652

5753
// Check if it's a Wheels app
5854
if (isWheelsApp()) {
59-
print.indentedLine("Wheels Version: #$getWheelsVersion()#");
60-
print.indentedLine("Application Root: #getCWD()#");
55+
detailOutput.metric("Wheels Version", $getWheelsVersion());
56+
detailOutput.metric("Application Root", getCWD());
6157
}
6258

63-
print.line();
64-
print.line("Quick Actions:");
65-
print.indentedLine("wheels server open - Open in browser");
66-
print.indentedLine("wheels server log - View logs");
67-
print.indentedLine("wheels reload - Reload application");
59+
detailOutput.nextSteps([
60+
"wheels server open - Open in browser",
61+
"wheels server log - View logs",
62+
"wheels reload - Reload application"
63+
]);
6864
}
6965
} catch (any e) {
7066
// Silently continue if we can't get additional info
7167
}
72-
print.line();
7368
}
7469
}
75-
7670
}

cli/src/commands/wheels/server/stop.cfc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ component extends="../base" {
4545
stopCommand &= " --all";
4646
}
4747

48-
print.yellowLine("Stopping Wheels development server...");
48+
detailOutput.header("Stop Wheels Development Server");
4949

50+
// Show command
51+
detailOutput.subHeader("Executing Stop Command");
52+
detailOutput.code(stopCommand);
5053
// Execute the server stop command
5154
command(stopCommand).run();
5255

53-
print.line();
54-
print.greenLine("Server stopped successfully!");
55-
print.line();
56+
detailOutput.statusSuccess("Server stopped successfully");
5657
}
5758

5859
}

core/src/wheels/Public.cfc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ component output="false" displayName="Internal GUI" extends="wheels.Global" {
44
* Internal function.
55
*/
66
public struct function $init() {
7+
include "/wheels/public/helpers.cfm";
78
return this;
89
}
910

@@ -23,7 +24,6 @@ component output="false" displayName="Internal GUI" extends="wheels.Global" {
2324
return "";
2425
}
2526
function routetester(verb, path) {
26-
include "/wheels/public/helpers.cfm";
2727
include "/wheels/public/views/routetester.cfm";
2828
return "";
2929
}
@@ -32,7 +32,6 @@ component output="false" displayName="Internal GUI" extends="wheels.Global" {
3232
return "";
3333
}
3434
function api() {
35-
include "/wheels/public/helpers.cfm";
3635
include "/wheels/public/views/api.cfm";
3736
return "";
3837
}
@@ -172,13 +171,11 @@ component output="false" displayName="Internal GUI" extends="wheels.Global" {
172171
}
173172

174173
function guides() {
175-
include "/wheels/public/helpers.cfm";
176174
include "/wheels/public/views/guides.cfm";
177175
return "";
178176
}
179177

180178
function ai() {
181-
include "/wheels/public/helpers.cfm";
182179
include "/wheels/public/views/ai.cfm";
183180
return "";
184181
}
@@ -208,7 +205,6 @@ component output="false" displayName="Internal GUI" extends="wheels.Global" {
208205
}
209206

210207
function mcp() {
211-
include "/wheels/public/helpers.cfm";
212208
include "/wheels/public/views/mcp.cfm";
213209
return "";
214210
}

core/src/wheels/public/docs/core.cfm

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,8 @@ if (StructKeyExists(application.wheels, "docs")) {
4444
https://github.com/wheels-dev/wheels/issues/1132
4545
4646
To add the test framework functions in the documentation. Added the Test component in the documentScope.
47-
48-
As app/test/functions/Example.cfc can be deleted, so check if that component exists then create that component's object.
49-
As Example.cfc extends tests.Test so we are checking the Example.cfc first as that will include both component's functions.
5047
*/
51-
try{
52-
// BoxLang compatibility: Use correct component path
53-
if (StructKeyExists(server, "boxlang")) {
54-
ArrayAppend(documentScope, {"name" = "test", "scope" = CreateObject("component", "wheels.tests.functions.Example")});
55-
} else {
56-
ArrayAppend(documentScope, {"name" = "test", "scope" = CreateObject("component", "tests.functions.Example")});
57-
}
58-
}
59-
catch (any exception){
60-
// BoxLang compatibility: Use correct component path
61-
if (StructKeyExists(server, "boxlang")) {
62-
ArrayAppend(documentScope, {"name" = "test", "scope" = CreateObject("component", "wheels.tests.Test")});
63-
} else {
64-
ArrayAppend(documentScope, {"name" = "test", "scope" = CreateObject("component", "tests.Test")});
65-
}
66-
}
48+
ArrayAppend(documentScope, {"name" = "test", "scope" = CreateObject("component", "wheels.tests.Test")});
6749
6850
ArrayAppend(documentScope, {"name" = "mapper", "scope" = application.wheels.mapper});
6951
if (application.wheels.enablePluginsComponent) {

0 commit comments

Comments
 (0)