Skip to content

Commit e1be00f

Browse files
committed
more updates
1 parent f85848d commit e1be00f

File tree

1 file changed

+69
-28
lines changed

1 file changed

+69
-28
lines changed

commands/coldbox/create/app-wizard.cfc

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,81 @@ component extends="app" aliases="" {
1515
boolean boxlang = isBoxLangProject( getCWD() )
1616
){
1717
arguments.directory = getCWD();
18+
19+
// Ensure Folder Creation
1820
if ( !confirm( "Are you currently inside the ""/#name#"" folder (if ""No"" we will create it)? [y/n]" ) ) {
19-
arguments.directory = getCWD() & name & "/";
21+
arguments.directory = getCWD() & name & "/"
2022
if ( !directoryExists( arguments.directory ) ) {
21-
directoryCreate( arguments.directory );
23+
directoryCreate( arguments.directory )
2224
}
23-
shell.cd( arguments.directory );
25+
shell.cd( arguments.directory )
2426
}
2527

2628
print.boldgreenline(
2729
"------------------------------------------------------------------------------------------"
28-
);
29-
print.boldgreenline( "Files will be installed in the " & arguments.directory & " directory" );
30+
)
31+
print.boldgreenline( "Files will be installed in the " & arguments.directory & " directory" )
3032
print.boldgreenline(
3133
"------------------------------------------------------------------------------------------"
32-
);
34+
)
35+
36+
// Language Selection
37+
if( confirm( "Is this a BoxLang project? [y/n]" ) ){
38+
arguments.boxlang = true;
39+
boxlangWizard( args = arguments );
40+
} else {
41+
arguments.boxlang = false;
42+
cfmlWizard( args = arguments );
43+
}
44+
45+
if ( confirm( "Are you going to require Database Migrations? [y/n]" ) ) {
46+
arguments.migrations = true;
47+
} else {
48+
arguments.migrations = false;
49+
}
50+
51+
variables.print
52+
.boldGreenLine( "🍳 Creating your site..." )
53+
.line()
54+
.toConsole()
55+
56+
// turn off wizard
57+
arguments.wizard = false
58+
arguments.initWizard = true
59+
// Cook the app
60+
super.run( argumentCollection = arguments );
61+
}
62+
63+
/**
64+
* Ask the user which BoxLang project they want to create
65+
**/
66+
private function boxlangWizard( required args ){
67+
// REST Setup
68+
if ( confirm( "Are you creating an API? [y/n]" ) ) {
69+
args.rest = true;
70+
} else {
71+
args.rest = false;
72+
73+
// Vite Setup
74+
if ( confirm( "Would you like to configure Vite as your Front End UI pipeline? [y/n]" ) ) {
75+
args.vite = true;
76+
} else {
77+
args.vite = false;
78+
}
79+
}
3380

81+
// Docker Setup
82+
if ( confirm( "Would you like to setup a Docker environment? [y/n]" ) ) {
83+
args.docker = true;
84+
} else {
85+
args.docker = false;
86+
}
87+
}
88+
89+
/**
90+
* Ask the user which CFML project they want to create
91+
**/
92+
private function cfmlWizard( required args ){
3493
if ( confirm( "Are you creating an API? [y/n]" ) ) {
3594
print.boldgreenline(
3695
"------------------------------------------------------------------------------------------"
@@ -74,47 +133,29 @@ component extends="app" aliases="" {
74133
.options( [
75134
{
76135
accessKey : 1,
77-
value : "boxlang",
78-
display : "BoxLang ColdBox Template - Default ColdBox App with BoxLang",
136+
value : "modern",
137+
display : "Modern Template - Security-first CFML and BoxLang template with /app outside webroot",
79138
selected : true
80139
},
81140
{
82141
accessKey : 2,
83-
value : "modern",
84-
display : "Modern Template - Security-first CFML and BoxLang template with /app outside webroot"
85-
},
86-
{
87-
accessKey : 3,
88142
value : "flat",
89143
display : "Flat Template - Traditional flat structure with everything in webroot"
90144
},
91145
{
92-
accessKey : 4,
146+
accessKey : 3,
93147
value : "vite",
94148
display : "Vite Template - Traditional flat structure development with Vite, Vue 3, and Tailwind CSS"
95149
},
96150
{
97-
accessKey : 5,
151+
accessKey : 4,
98152
value : "supersimple",
99153
display : "Super Simple Template - Bare bones, minimal starting point"
100154
}
101155
] )
102156
.required()
103157
.ask();
104158
}
105-
print.line( "Creating your site..." ).toConsole();
106-
107-
var skeletons = skeletonComplete();
108-
// turn off wizard
109-
arguments.wizard = false;
110-
arguments.initWizard = true;
111-
112-
if ( !arguments.skeleton.len() ) {
113-
// Remove if empty so it can default correctly
114-
arguments.delete( "skeleton" );
115-
}
116-
117-
super.run( argumentCollection = arguments );
118159
}
119160

120161
}

0 commit comments

Comments
 (0)