ColdBox / coldbox-cli

The official ColdBox CLI for CommandBox
https://www.coldbox.org
3 stars 4 forks source link

create orm-crud fails #12

Open gavinbaumanis opened 1 month ago

gavinbaumanis commented 1 month ago

What are the steps to reproduce this issue?

Follow the instructions at; https://coldbox.ortusbooks.com/the-basics/models/coding-orm-scaffolding

When running the following command: coldbox create orm-crud entity=models.Contacts pluralName=Contacts

This is outputted to the console:

INFO Created Model: [C:\Users\gavin\Workspace\coldbox_playground_scaffolding\models\/Contacts.cfc]

The file 'ContactsTest.cfc' already exists, overwrite it (y/n)? : y Resource Opened! INFO Created Test: [C:\Users\gavin\Workspace\coldbox_playground_scaffolding\tests\specs\unit\/ContactsTest.cfc]

Resource Opened! CommandBox:coldbox_playground_scaffolding> coldbox create orm-crud entity=models.Contacts pluralName=Contacts INFO Generated Handler: [C:\Users\gavin\Workspace\coldbox_playground_scaffolding\handlers\/Contacts.cfc]

INFO Generated View: [C:\Users\gavin\Workspace\coldbox_playground_scaffolding\views\/Contacts/edit.cfm]

INFO Generated View: [C:\Users\gavin\Workspace\coldbox_playground_scaffolding\views\/Contacts/editor.cfm]

INFO Generated View: [C:\Users\gavin\Workspace\coldbox_playground_scaffolding\views\/Contacts/new.cfm]

Then this error message follows:

ERROR (6.1.0-rc+00808)

Page /commandbox/modules/coldbox-cli/commands/coldbox/create/C:/Users/gavin/.CommandBox/cfml/modules/coldbox-cli/templates/crud/table.cfm [C:\Users\gavin.CommandBox\cfml\modules\coldbox-cli\commands\coldbox\create\C:\Users\gavin.CommandBox\cfml\modules\coldbox-cli\templates\crud\table.cfm] not found

\modules\coldbox-cli\commands\coldbox\create\orm-crud.cfc: line 135 133:          // Build table output for index 134:          savecontent variable="local.tableData" { 135:             include "#variables.settings.templatesPath#/crud/table.cfm"; 136:          } 137:          tableData = replaceNoCase( called from \system\services\CommandService.cfc: line 443 called from \system\services\CommandService.cfc: line 225 called from \system\Shell.cfc: line 865 called from \system\Shell.cfc: line 680 called from \system\Bootstrap.cfm: line 165

What were you expecting to happen?

No error should be thrown!

What versions are you using?

Operating System: … Windows 11 - latest

Package Version: … CommandBox Version: 6.1.0-rc+00808

System Modules coldbox-cli@^7.5.0+11

Application modules testbox@6.0.0+8 /testbox coldbox@7.3.0+16 /coldbox cbproxies@1.3.0+3 /coldbox/system/async/cbproxies globber@3.1.5 /testbox/system/modules/globber mockdatacfc@3.7.0+1 /testbox/system/modules/mockdatacfc cbstreams@2.0.1+12 /testbox/system/modules/cbstreams cbproxies@1.3.0+3 /testbox/system/modules/cbstreams/modules/cbproxies

gavinbaumanis commented 1 month ago

This is a "Windows" issue only and is caused by the dynamic nature of the way directories are found / created.

The command: coldbox create orm-crud entity=models.Contacts pluralName=Contacts Works fine from Linux.

For a workaround on Windows - you can use the Windows Sub-system for Linux (WSL)

lmajano commented 1 month ago

I am not sure about this @gavinbaumanis since / is universal in Java, regardless of OS. I see more of a double expanding issue here rather than a / issue. I will investigate

lmajano commented 1 month ago

Ok, I could not reproduce it. @bdw429s can you try to see if you can reproduce this?

gavinbaumanis commented 1 month ago

The following recipe gives me the error every single time. I have included the steps in order that I have used, via the Coldbox Docs:

Step 1 : from: https://coldbox.ortusbooks.com/the-basics/models/coding-solo-style

coldbox create app name=solo skeleton=AdvancedScript --installColdBox
server start --rewritesEnable

Step 2 : from : https://coldbox.ortusbooks.com/the-basics/models/coding-solo-style/datasource

// Settings
settings = {
    contacts = {
        type = "mysql",
        name = "contacts"
    }
}

Step 3 : from: https://coldbox.ortusbooks.com/the-basics/models/coding-orm-scaffolding/orm orm = { injection = { enabled=true } };

Step 4 : from: https://coldbox.ortusbooks.com/the-basics/models/coding-orm-scaffolding/contacts.cfc coldbox create orm-entity entityName=contacts primaryKey=contactID properties=firstName,lastName,email --open

Step 5 : from: https://coldbox.ortusbooks.com/the-basics/models/coding-orm-scaffolding/scaffold coldbox create orm-crud entity=models.Contacts pluralName=Contacts

I get the error in the screenshot below - without fail. I haven't changed the version of dependencies from skeleton app, either. All my systems details / versions etc are in the Original post.

Please do let me know if you need anything extra from me. (I have tried multiple paths / different levels of directory nesting, too. I always get this error on the last command.)

image