66 * {code:bash}
77 * wheels server start
88 * wheels server start port=8080
9- * wheels server start rewritesEnable=true
109 * {code}
1110 **/
1211component 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 /**
0 commit comments