Skip to content

Commit 9c89dd7

Browse files
committed
mostly udpated to all boxlang standards
1 parent 5b7ebf6 commit 9c89dd7

38 files changed

+408
-96
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
- New `modern` template for creating modern apps with the latest features
1515
- New `boxlang` template for creating apps with the latest boxlang features
16+
- Modernization of all templates to use the latest features of ColdBox
1617

1718
### Changed
1819

commands/coldbox/create/app-wizard.cfc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,34 @@ component extends="app" aliases="" {
6969
.options( [
7070
{
7171
accessKey : 1,
72-
value : "cbtemplate-simple",
73-
display : "Simple Script - Script based Coldbox App WITHOUT cfconfig & .env settings"
72+
value : "cbtemplate-bx-default",
73+
display : "BoxLang ColdBox Template - Default ColdBox App with BoxLang"
7474
},
7575
{
7676
accessKey : 2,
77+
value : "cbtemplate-supersimple",
78+
display : "Super simple starting template - no modules, no config, no nothing",
79+
},
80+
{
81+
accessKey : 3,
7782
value : "cbtemplate-advanced-script",
78-
display : "Advanced Script - Script based Coldbox App which uses cfconfig & .env settings",
83+
display : "Default Script based Coldbox App which uses cfconfig & .env settings",
7984
selected : true
8085
},
8186
{
82-
accessKey : 3,
87+
accessKey : 4,
8388
value : "cbtemplate-elixir",
8489
display : "Elixir Template - Advanced Script + ColdBox Elixir: Enable Webpack tasks for your ColdBox applications"
8590
},
8691
{
87-
accessKey : 4,
88-
value : "cbtemplate-elixir-vuejs",
89-
display : "Elixir + Vuejs Template - Elixir Template + pre-installed & configured VueJS"
92+
accessKey : 5,
93+
value : "cbtemplate-modern",
94+
display : "A modern ColdBox template with a modern approach to building apps"
95+
},
96+
{
97+
accessKey : 6,
98+
value : "cbtemplate-vite",
99+
display : "A ColdBox template with ViteJS for modern web development"
90100
}
91101
] )
92102
.required()

commands/coldbox/create/app.cfc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ component extends="coldbox-cli.models.BaseCommand" {
129129
shell.cd( originalPath );
130130
}
131131

132+
// Prepare language
133+
if( arguments.boxlang ) {
134+
command( "package set" )
135+
.params(
136+
language : "BoxLang"
137+
)
138+
.run();
139+
}
140+
132141
// Prepare defaults on box.json so we remove template based ones
133142
command( "package set" )
134143
.params(

commands/coldbox/create/handler.cfc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo
3636
* @rest Make this a REST handler instead of a normal ColdBox Handler
3737
* @force Force overwrite of existing handler
3838
* @resource Generate a resourceful handler with all the actions
39+
* @boxlang Is this a boxlang project? else it is a CFML project
3940
**/
4041
function run(
4142
required name,
@@ -50,7 +51,8 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo
5051
boolean open = false,
5152
boolean rest = false,
5253
boolean force = false,
53-
boolean resource = false
54+
boolean resource = false,
55+
boolean boxlang = isBoxLangProject( getCWD() )
5456
){
5557
// This will make each directory canonical and absolute
5658
arguments.directory = resolvePath( arguments.directory );
@@ -100,6 +102,11 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo
100102
arguments.description,
101103
"all"
102104
);
105+
// BoxLang replacements
106+
if( arguments.boxlang ){
107+
handlerContent = toBoxLangClass( handlerContent );
108+
handlerTestContent = toBoxLangClass( handlerTestContent );
109+
}
103110

104111
// Auto Actions Determination if none passed via resource && rest, else empty handler
105112
if ( !len( arguments.actions ) ) {

commands/coldbox/create/integration-test.cfc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ component extends="coldbox-cli.models.BaseCommand" {
3434
* @open Open the file once it is created
3535
* @directory The base directory to create your test spec in and creates the directory if it does not exist. Defaults to 'tests/specs/integration'
3636
* @force Force overwrite of existing files
37+
* @boxlang Is this a boxlang project?
3738
**/
3839
function run(
3940
required handler,
@@ -43,7 +44,8 @@ component extends="coldbox-cli.models.BaseCommand" {
4344
boolean xunit = false,
4445
boolean open = false,
4546
directory = "tests/specs/integration",
46-
boolean force = false
47+
boolean force = false,
48+
boolean boxlang = isBoxLangProject( getCWD() )
4749
){
4850
// This will make each directory canonical and absolute
4951
arguments.directory = resolvePath( arguments.directory );
@@ -83,6 +85,9 @@ component extends="coldbox-cli.models.BaseCommand" {
8385
arguments.handler,
8486
"all"
8587
);
88+
if( arguments.boxlang ) {
89+
handlerTestContent = toBoxLangClass( handlerTestContent );
90+
}
8691

8792
// Handle Actions if passed
8893
if ( len( arguments.actions ) ) {
@@ -125,7 +130,7 @@ component extends="coldbox-cli.models.BaseCommand" {
125130
);
126131
}
127132

128-
var integrationTestPath = "#arguments.directory#/#arguments.handler#Test.cfc";
133+
var integrationTestPath = "#arguments.directory#/#arguments.handler#Test.#arguments.boxlang ? "bx" : "cfc"#";
129134
// Create dir if it doesn't exist
130135
directoryCreate(
131136
getDirectoryFromPath( integrationTestPath ),

commands/coldbox/create/interceptor-test.cfc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ component extends="coldbox-cli.models.BaseCommand" {
1515
* @testsDirectory Your unit tests directory. Only used if tests is true
1616
* @open Open the test once generated
1717
* @force Force overwrite of existing test
18+
* @boxlang Is this a boxlang project?
1819
**/
1920
function run(
2021
required path,
2122
points = "",
2223
testsDirectory = "tests/specs/interceptors",
2324
boolean open = false,
24-
boolean force = false
25+
boolean force = false,
26+
boolean boxlang = isBoxLangProject( getCWD() )
2527
){
2628
// This will make each directory canonical and absolute
2729
arguments.testsDirectory = resolvePath( arguments.testsDirectory );
@@ -42,6 +44,9 @@ component extends="coldbox-cli.models.BaseCommand" {
4244
arguments.path,
4345
"all"
4446
);
47+
if( arguments.boxlang ) {
48+
interceptorTestContent = toBoxLangClass( interceptorTestContent );
49+
}
4550

4651
// Interception Points
4752
if ( len( arguments.points ) ) {
@@ -73,7 +78,7 @@ component extends="coldbox-cli.models.BaseCommand" {
7378
}
7479

7580
// Write it out.
76-
var testPath = "#arguments.testsDirectory#/#listLast( arguments.path, "." )#Test.cfc";
81+
var testPath = "#arguments.testsDirectory#/#listLast( arguments.path, "." )#Test.#arguments.boxlang ? "bx" : "cfc"#";
7782
// Create dir if it doesn't exist
7883
directoryCreate(
7984
getDirectoryFromPath( testPath ),

commands/coldbox/create/interceptor.cfc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ component extends="coldbox-cli.models.BaseCommand" {
2121
* @directory The base directory to create your interceptor in and creates the directory if it does not exist.
2222
* @open Open the interceptor once generated
2323
* @force Force overwrite of the interceptor if it exists
24+
* @boxlang Is this a boxlang project?
2425
**/
2526
function run(
2627
required name,
@@ -30,7 +31,8 @@ component extends="coldbox-cli.models.BaseCommand" {
3031
testsDirectory = "tests/specs/interceptors",
3132
directory = "interceptors",
3233
boolean open = false,
33-
boolean force = false
34+
boolean force = false,
35+
boolean boxlang = isBoxLangProject( getCWD() )
3436
){
3537
// This will make each directory canonical and absolute
3638
var relativeDirectory = arguments.directory;
@@ -58,13 +60,19 @@ component extends="coldbox-cli.models.BaseCommand" {
5860
arguments.name,
5961
"all"
6062
);
63+
if( arguments.boxlang ) {
64+
interceptorContent = toBoxLangClass( interceptorContent );
65+
}
6166
var interceptorPath = listChangeDelims( relativeDirectory, ".", "/\" ).listAppend( arguments.name, "." );
6267
interceptorTestContent = replaceNoCase(
6368
interceptorTestContent,
6469
"|name|",
6570
interceptorPath,
6671
"all"
6772
);
73+
if( arguments.boxlang ) {
74+
interceptorTestContent = toBoxLangClass( interceptorTestContent );
75+
}
6876

6977
// Placeholder in case we add this in
7078
interceptorContent = replaceNoCase(
@@ -127,7 +135,7 @@ component extends="coldbox-cli.models.BaseCommand" {
127135
}
128136

129137
// Write it out.
130-
var interceptorPath = "#arguments.directory#/#arguments.name#.cfc";
138+
var interceptorPath = "#arguments.directory#/#arguments.name#.#arguments.boxlang ? "bx" : "cfc"#";
131139

132140
// Confirm it
133141
if (
@@ -143,7 +151,7 @@ component extends="coldbox-cli.models.BaseCommand" {
143151
print.greenLine( "#interceptorPath#" );
144152

145153
if ( tests ) {
146-
var testPath = "#TestsDirectory#/#arguments.name#Test.cfc";
154+
var testPath = "#TestsDirectory#/#arguments.name#Test.#arguments.boxlang ? "bx" : "cfc"#";
147155
// Create dir if it doesn't exist
148156
directoryCreate(
149157
getDirectoryFromPath( testPath ),

commands/coldbox/create/layout.cfc

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ component extends="coldbox-cli.models.BaseCommand" {
2424
directory = "layouts",
2525
boolean open = false,
2626
boolean force = false,
27-
content = "<h1>#arguments.name# Layout</h1>#variables.utility.BREAK#"
27+
content = "<h1>#arguments.name# Layout</h1>#variables.utility.BREAK#",
28+
boolean boxlang = isBoxLangProject( getCWD() )
2829
){
2930
// This will make each directory canonical and absolute
3031
arguments.directory = resolvePath( arguments.directory );
@@ -37,15 +38,24 @@ component extends="coldbox-cli.models.BaseCommand" {
3738
// This help readability so the success messages aren't up against the previous command line
3839
print.line();
3940

40-
savecontent variable="local.layoutContent" {
41-
writeOutput( "<cfoutput>#variables.utility.BREAK#" )
42-
writeOutput( arguments.content )
43-
writeOutput( "<div>##view()##</div>#variables.utility.BREAK#" )
44-
writeOutput( "</cfoutput>" )
45-
};
41+
if( arguments.boxlang ){
42+
savecontent variable="local.layoutContent" {
43+
writeOutput( "<bx:output>#variables.utility.BREAK#" )
44+
writeOutput( arguments.content )
45+
writeOutput( "<div>##view()##</div>#variables.utility.BREAK#" )
46+
writeOutput( "</bx:output>" )
47+
};
48+
} else {
49+
savecontent variable="local.layoutContent" {
50+
writeOutput( "<cfoutput>#variables.utility.BREAK#" )
51+
writeOutput( arguments.content )
52+
writeOutput( "<div>##view()##</div>#variables.utility.BREAK#" )
53+
writeOutput( "</cfoutput>" )
54+
};
55+
}
4656

4757
// Write out layout
48-
var layoutPath = "#arguments.directory#/#arguments.name#.cfm";
58+
var layoutPath = "#arguments.directory#/#arguments.name#.#arguments.boxlang ? "bxm" : "cfm"#";
4959

5060
// Confirm it
5161
if (
@@ -67,7 +77,7 @@ component extends="coldbox-cli.models.BaseCommand" {
6777

6878
if ( arguments.helper ) {
6979
var layoutHelperContent= "<!--- #arguments.name# Layout Helper --->";
70-
var layoutHelperPath = "#arguments.directory#/#arguments.name#Helper.cfm";
80+
var layoutHelperPath = "#arguments.directory#/#arguments.name#Helper.#arguments.boxlang ? "bxm" : "cfm"#";
7181
file action ="write" file="#layoutHelperPath#" mode="777" output="#layoutHelperContent#";
7282
printInfo( "Created Layout Helper [#layoutHelperPath#]" );
7383

commands/coldbox/create/model-test.cfc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ component extends="coldbox-cli.models.BaseCommand" {
2727
* @testsDirectory Your unit tests directory. Only used if tests is true
2828
* @open Open the file once generated
2929
* @force Force overwrite of existing files
30+
* @boxlang Is this a boxlang project?
3031
**/
3132
function run(
3233
required path,
3334
methods = "",
3435
testsDirectory = "tests/specs/unit",
3536
boolean open = false,
36-
boolean force = false
37+
boolean force = false,
38+
boolean boxlang = isBoxLangProject( getCWD() )
3739
){
3840
// This will make each directory canonical and absolute
3941
arguments.testsDirectory = resolvePath( arguments.testsDirectory );
@@ -60,6 +62,9 @@ component extends="coldbox-cli.models.BaseCommand" {
6062
arguments.path,
6163
"all"
6264
);
65+
if( arguments.boxlang ) {
66+
modelTestContent = toBoxLangClass( modelTestContent );
67+
}
6368

6469
// Handle Methods
6570
if ( len( arguments.methods ) ) {
@@ -96,7 +101,7 @@ component extends="coldbox-cli.models.BaseCommand" {
96101
);
97102
}
98103

99-
var testPath = "#arguments.TestsDirectory#/#listLast( arguments.path, "." )#Test.cfc";
104+
var testPath = "#arguments.TestsDirectory#/#listLast( arguments.path, "." )#Test.#arguments.boxlang ? "bx" : "cfc"#";
100105
// Create dir if it doesn't exist
101106
directoryCreate(
102107
getDirectoryFromPath( testPath ),

0 commit comments

Comments
 (0)