Skip to content

Commit 7ac3c4c

Browse files
committed
Updated paths to accommodate for the new directory structure for CfWheels
Updated the paths for the following commands to work for the new directory structure: wheels g app wheels g model wheels g controller wheels g view wheels g test wheels g route wheels g property wheels scaffold wheels r Also updated the path for the following command: wheels d this command deletes the model, controller, test ,route, property and view but when it tries to delete the migrator file, it gives error which is also present in the current code of the develop branch
1 parent 1ee67c0 commit 7ac3c4c

11 files changed

Lines changed: 33 additions & 33 deletions

File tree

commands/wheels/base.cfc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ component excludeFromHelp=true {
1818
// we could also test for the existence of /wheels/dbmigrate, but that only gives us the major version.
1919
string function $getWheelsVersion(){
2020
// First, look for a wheels folder..
21-
if(!directoryExists( fileSystemUtil.resolvePath("wheels") ) ){
22-
error("We're currently looking in #getCWD()#, but can't find a /wheels/ folder?");
21+
if(!directoryExists( fileSystemUtil.resolvePath("vendor/cfwheels") ) ){
22+
error("We're currently looking in #getCWD()#, but can't find a /cfwheels/ folder?");
2323
}
24-
if(fileExists(fileSystemUtil.resolvePath("wheels/box.json"))){
25-
var output = command( 'cd wheels' ).run( returnOutput=true );
24+
if(fileExists(fileSystemUtil.resolvePath("vendor/cfwheels/box.json"))){
25+
var output = command( 'cd vendor\cfwheels' ).run( returnOutput=true );
2626
local.boxJSON = packageService.readPackageDescriptorRaw( getCWD() );
2727
var output = command( 'cd ../' ).run( returnOutput=true );
2828
return local.boxJSON.version;
29-
} else if(fileExists(fileSystemUtil.resolvePath("wheels/events/onapplicationstart.cfm"))) {
30-
var output = command( 'cd wheels' ).run( returnOutput=true );
31-
local.target=fileSystemUtil.resolvePath("events/onapplicationstart.cfm");
29+
} else if(fileExists(fileSystemUtil.resolvePath("vendor/cfwheels/events/onapplicationstart.cfm"))) {
30+
var output = command( 'cd vendor\cfwheels' ).run( returnOutput=true );
31+
local.target=fileSystemUtil.resolvePath("app/events/onapplicationstart.cfm");
3232
local.content=fileRead(local.target);
3333
local.content=listFirst(mid(local.content, (find('application.$wheels.version',local.content)+31),20),'"');
3434
var output = command( 'cd ../' ).run( returnOutput=true );
@@ -83,10 +83,10 @@ component excludeFromHelp=true {
8383
// Inject CLI content into template
8484
function $injectIntoView(required struct objectNames, required string property, required string type, string action="input"){
8585
if(arguments.action EQ "input"){
86-
local.target=fileSystemUtil.resolvePath("views/#objectNames.objectNamePlural#/_form.cfm");
86+
local.target=fileSystemUtil.resolvePath("app/views/#objectNames.objectNamePlural#/_form.cfm");
8787
local.inject=$generateFormField(objectname=objectNames.objectNameSingular, property=arguments.property, type=arguments.type);
8888
} else if(arguments.action EQ "output"){
89-
local.target=fileSystemUtil.resolvePath("views/#objectNames.objectNamePlural#/show.cfm");
89+
local.target=fileSystemUtil.resolvePath("app/views/#objectNames.objectNamePlural#/show.cfm");
9090
local.inject=$generateOutputField(objectname=objectNames.objectNameSingular, property=arguments.property, type=arguments.type);
9191
}
9292
local.content=fileRead(local.target);
@@ -101,7 +101,7 @@ component excludeFromHelp=true {
101101

102102
// Inject CLI content into index template
103103
function $injectIntoIndex(required struct objectNames, required string property, required string type){
104-
local.target=fileSystemUtil.resolvePath("views/#objectNames.objectNamePlural#/index.cfm");
104+
local.target=fileSystemUtil.resolvePath("app/views/#objectNames.objectNamePlural#/index.cfm");
105105
local.thead=" <th>#helpers.capitalize(arguments.property)#</th>";
106106
local.tbody=" <td>" & cr & " ~[~#arguments.property#~]~" & cr & " </td>";
107107

@@ -208,7 +208,7 @@ component excludeFromHelp=true {
208208
}
209209

210210
// Wheels folder in expected place? (just a good check to see if the user has actually installed wheels...)
211-
var wheelsFolder=fileSystemUtil.resolvePath("wheels");
211+
var wheelsFolder=fileSystemUtil.resolvePath("vendor/cfwheels");
212212
if(!directoryExists(wheelsFolder)){
213213
error("We can't find your wheels folder. Check you have installed CFWheels, and you're running this from the site root: If you've not started an app yet, try wheels new myApp");
214214
}
@@ -223,12 +223,12 @@ component excludeFromHelp=true {
223223
// Wheels 2.x has dbmigrate + dbmigratebridge equivalents in core
224224
if($isWheelsVersion(1, "major")){
225225

226-
var DBMigratePluginLocation=fileSystemUtil.resolvePath("plugins/dbmigrate");
226+
var DBMigratePluginLocation=fileSystemUtil.resolvePath("app/plugins/dbmigrate");
227227
if(!directoryExists(DBMigratePluginLocation)){
228228
error("We can't find your plugins/dbmigrate folder? Please check the plugin is successfully installed; if you've not started the server using server start for the first time, this folder may not be created yet.");
229229
}
230230

231-
var DBMigrateBridgePluginLocation=fileSystemUtil.resolvePath("plugins/dbmigratebridge");
231+
var DBMigrateBridgePluginLocation=fileSystemUtil.resolvePath("app/plugins/dbmigratebridge");
232232
if(!directoryExists(DBMigrateBridgePluginLocation)){
233233
error("We can't find your plugins/dbmigratebridge folder? Please check the plugin is successfully installed; if you've not started the server using server start for the first time, this folder may not be created yet.");
234234
}
@@ -249,7 +249,7 @@ component excludeFromHelp=true {
249249
string function $getBridgeURL() {
250250
var serverInfo=$getServerInfo();
251251
var geturl=serverInfo.serverUrl;
252-
getURL &= "/rewrite.cfm?controller=wheels&action=wheels&view=cli";
252+
getURL &= "/public/rewrite.cfm?controller=wheels&action=wheels&view=cli";
253253
return geturl;
254254
}
255255

commands/wheels/destroy.cfc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ component aliases='wheels d' extends="base" {
1414
function run(required string name) {
1515

1616
var obj = helpers.getNameVariants(arguments.name);
17-
var modelFile = fileSystemUtil.resolvePath("models/#obj.objectNameSingularC#.cfc");
18-
var controllerFile = fileSystemUtil.resolvePath("controllers/#obj.objectNamePluralC#.cfc");
19-
var viewFolder = fileSystemUtil.resolvePath("views/#obj.objectNamePlural#/");
17+
var modelFile = fileSystemUtil.resolvePath("app/models/#obj.objectNameSingularC#.cfc");
18+
var controllerFile = fileSystemUtil.resolvePath("app/controllers/#obj.objectNamePluralC#.cfc");
19+
var viewFolder = fileSystemUtil.resolvePath("app/views/#obj.objectNamePlural#/");
2020
var testmodelFile = fileSystemUtil.resolvePath("tests/models/#obj.objectNameSingularC#.cfc");
2121
var testcontrollerFile = fileSystemUtil.resolvePath("tests/controllers/#obj.objectNamePluralC#.cfc");
2222
var testviewFolder = fileSystemUtil.resolvePath("tests/views/#obj.objectNamePlural#/");
23-
var routeFile = fileSystemUtil.resolvePath("config/routes.cfm");
23+
var routeFile = fileSystemUtil.resolvePath("app/config/routes.cfm");
2424
var resourceName = '.resources("' & obj.objectNamePlural & '")';
2525

2626
print.redBoldLine("================================================")

commands/wheels/generate/app.cfc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ component aliases="wheels g app" extends="../base" {
140140

141141
// Setting Application Name
142142
print.greenBoldLine( 'Setting application name...' ).toConsole();
143-
command( 'tokenReplace' ).params( path = 'config/app.cfm', token = '|appName|', replacement = arguments.name ).run();
143+
command( 'tokenReplace' ).params( path = 'app/config/app.cfm', token = '|appName|', replacement = arguments.name ).run();
144144
command( 'tokenReplace' ).params( path = 'server.json', token = '|appName|', replacement = arguments.name ).run();
145145

146146
// Setting Reload Password
147147
print.greenBoldLine( 'Setting reload password...' ).toConsole();
148148
command( 'tokenReplace' )
149-
.params( path = 'config/settings.cfm', token = '|reloadPassword|', replacement = arguments.reloadPassword )
149+
.params( path = 'app/config/settings.cfm', token = '|reloadPassword|', replacement = arguments.reloadPassword )
150150
.run();
151151

152152
// Setting Datasource Name
153153
print.greenBoldLine( 'Setting datasource name...' ).toConsole();
154154
command( 'tokenReplace' )
155-
.params( path = 'config/settings.cfm', token = '|datasourceName|', replacement = arguments.datasourceName )
155+
.params( path = 'app/config/settings.cfm', token = '|datasourceName|', replacement = arguments.datasourceName )
156156
.run();
157157

158158
// Setting cfml Engine Name
@@ -183,7 +183,7 @@ component aliases="wheels g app" extends="../base" {
183183
// CLI-Appends-Here';
184184
print.yellowline( datasourceConfig ).toConsole();
185185
command( 'tokenReplace' )
186-
.params( path = 'config/app.cfm', token = '// CLI-Appends-Here', replacement = datasourceConfig )
186+
.params( path = 'app/config/app.cfm', token = '// CLI-Appends-Here', replacement = datasourceConfig )
187187
.run();
188188
print.greenline( '...Finished Adding Datasource to app.cfm.' ).toConsole();
189189
}

commands/wheels/generate/controller.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ component
2626
function run(
2727
required string name,
2828
string actionList = '',
29-
directory = 'controllers'
29+
directory = 'app/controllers'
3030
) {
3131
var obj = helpers.getNameVariants( arguments.name );
3232
arguments.directory = fileSystemUtil.resolvePath( arguments.directory );

commands/wheels/generate/model.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ component aliases='wheels g model' extends="../base" {
2525
){
2626

2727
var obj = helpers.getNameVariants(arguments.name);
28-
var directory = fileSystemUtil.resolvePath("models");
28+
var directory = fileSystemUtil.resolvePath("app/models");
2929
//TODO: Refactor into a function that tries to get the app name from the server.json file
3030
var appName = listLast( getCWD(), '/\' );
3131

commands/wheels/generate/property.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ component aliases='wheels g property' extends="../base" {
5959
// Quick Sanity Checks: are we actually adding a property to an existing model?
6060
// Check for existence of model file: NB, DB columns can of course exist without a model file,
6161
// But we should confirm they've got it correct.
62-
if(!fileExists(fileSystemUtil.resolvePath("models/#obj.objectNameSingularC#.cfc"))){
63-
if(!confirm("Hold On! We couldn't find a corresponding Model at /models/#obj.objectNameSingularC#.cfc: are you sure you wish to add the property '#arguments.columnName#' to #obj.objectNamePlural#? [y/n]")){
62+
if(!fileExists(fileSystemUtil.resolvePath("app/models/#obj.objectNameSingularC#.cfc"))){
63+
if(!confirm("Hold On! We couldn't find a corresponding Model at /app/models/#obj.objectNameSingularC#.cfc: are you sure you wish to add the property '#arguments.columnName#' to #obj.objectNamePlural#? [y/n]")){
6464
print.line("Fair enough. Aborting!");
6565
return;
6666
}

commands/wheels/generate/route.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ component aliases='wheels g route' extends="../base" {
99
**/
1010
function run(required string objectname) {
1111
var obj = helpers.getNameVariants(listLast( arguments.objectname, '/\' ));
12-
var target = fileSystemUtil.resolvePath("config/routes.cfm");
12+
var target = fileSystemUtil.resolvePath("app/config/routes.cfm");
1313
var content = fileRead(target);
1414

1515
var inject = '.resources("' & obj.objectNamePlural & '")';

commands/wheels/generate/view.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ component aliases='wheels g view' extends="../base" {
2727
string template=""
2828
){
2929
var obj = helpers.getNameVariants(listLast( arguments.objectname, '/\' ));
30-
var viewdirectory = fileSystemUtil.resolvePath( "views" );
31-
var directory = fileSystemUtil.resolvePath( "views" & "/" & obj.objectNamePlural);
30+
var viewdirectory = fileSystemUtil.resolvePath( "app/views" );
31+
var directory = fileSystemUtil.resolvePath( "app/views" & "/" & obj.objectNamePlural);
3232
print.line( "Creating View File..." ).toConsole();
3333

3434
// Validate directory

commands/wheels/init.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ component extends="base" {
3636
}
3737

3838
var serverJsonLocation=fileSystemUtil.resolvePath("server.json");
39-
var wheelsBoxJsonLocation=fileSystemUtil.resolvePath("wheels/box.json");
39+
var wheelsBoxJsonLocation=fileSystemUtil.resolvePath("vendor/cfwheels/box.json");
4040
var boxJsonLocation=fileSystemUtil.resolvePath("box.json");
4141

4242
var wheelsVersion = $getWheelsVersion();

commands/wheels/reload.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ component aliases='wheels r' extends="base" {
2222
var serverDetails = $getServerInfo();
2323

2424
getURL = serverDetails.serverURL &
25-
"/rewrite.cfm?reload=#mode#&password=#password#";
25+
"/public/rewrite.cfm?reload=#mode#&password=#password#";
2626
var loc = new Http( url=getURL ).send().getPrefix();
2727
print.line("Reload Request sent");
2828
}

0 commit comments

Comments
 (0)