-
-
Notifications
You must be signed in to change notification settings - Fork 8
Auto-detect app layout and generate files in correct path (flat vs modern) #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,11 +42,11 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo | |
| required name, | ||
| actions = "", | ||
| boolean views = true, | ||
| viewsDirectory = "views", | ||
| viewsDirectory = getAppPrefix( getCWD() ) & "views", | ||
| boolean integrationTests = true, | ||
| appMapping = "/", | ||
| testsDirectory = "tests/specs/integration", | ||
| directory = "handlers", | ||
| directory = getAppPrefix( getCWD() ) & "handlers", | ||
| description = "I am a new handler", | ||
|
Comment on lines
43
to
50
|
||
| boolean open = false, | ||
| boolean rest = false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| description = "I am a new interceptor", | ||
| boolean tests = true, | ||
| testsDirectory = "tests/specs/interceptors", | ||
| directory = "interceptors", | ||
| directory = getAppPrefix( getCWD() ) & "interceptors", | ||
| boolean open = false, | ||
|
Comment on lines
29
to
33
|
||
| boolean force = false, | ||
| boolean boxlang = isBoxLangProject( getCWD() ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| function run( | ||
| required name, | ||
| boolean helper = false, | ||
| directory = "layouts", | ||
| directory = getAppPrefix( getCWD() ) & "layouts", | ||
| boolean open = false, | ||
|
Comment on lines
22
to
25
|
||
| boolean force = false, | ||
| content = "<h1>#arguments.name# Layout</h1>#variables.utility.BREAK#", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,7 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| persistence = "transient", | ||
| boolean tests = true, | ||
| testsDirectory = "tests/specs/unit", | ||
| directory = "models", | ||
| directory = getAppPrefix( getCWD() ) & "models", | ||
| description = "I am a new Model Object", | ||
|
Comment on lines
61
to
64
|
||
| boolean open = false, | ||
| boolean accessors = true, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,8 +22,8 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| function run( | ||
| required entity, | ||
| pluralName = "", | ||
| handlersDirectory = "handlers", | ||
| viewsDirectory = "views", | ||
| handlersDirectory = getAppPrefix( getCWD() ) & "handlers", | ||
| viewsDirectory = getAppPrefix( getCWD() ) & "views", | ||
| boolean tests = true, | ||
|
Comment on lines
23
to
27
|
||
| testsDirectory = "tests/specs/integration", | ||
| boolean boxlang = isBoxLangProject( getCWD() ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,9 +91,9 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| generator = "native", | ||
| properties = "", | ||
| modulesDirectory = "modules_app", | ||
| handlersDirectory = "handlers", | ||
| viewsDirectory = "views", | ||
| modelsDirectory = "models", | ||
| handlersDirectory = getAppPrefix( getCWD() ) & "handlers", | ||
| viewsDirectory = getAppPrefix( getCWD() ) & "views", | ||
| modelsDirectory = getAppPrefix( getCWD() ) & "models", | ||
| boolean tests = true, | ||
|
Comment on lines
92
to
97
|
||
| specsDirectory = "tests/specs", | ||
| boolean api = false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| methods = "", | ||
| boolean tests = true, | ||
| testsDirectory = "tests/specs/unit", | ||
| directory = "models", | ||
| directory = getAppPrefix( getCWD() ) & "models", | ||
| description = "I am a new service", | ||
|
Comment on lines
34
to
37
|
||
| boolean open = false, | ||
| boolean force = false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ component extends="coldbox-cli.models.BaseCommand" { | |
| function run( | ||
| required name, | ||
| boolean helper = false, | ||
| directory = "views", | ||
| directory = getAppPrefix( getCWD() ) & "views", | ||
| boolean open = false, | ||
|
Comment on lines
23
to
26
|
||
| content = "<h1>#arguments.name# view</h1>", | ||
| boolean force = false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,19 @@ component accessors="true" { | |||||
| return this; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Detects the application layout and returns the appropriate path prefix. | ||||||
| * In a modern layout (app/ and public/ directories exist), returns "app/". | ||||||
| * In a flat layout, returns "". | ||||||
| * | ||||||
| * @cwd The current working directory | ||||||
| * | ||||||
| * @return string "app/" for modern layout, "" for flat layout | ||||||
| */ | ||||||
| function getAppPrefix( required cwd ){ | ||||||
| return variables.utility.detectTemplateType( cwd ) == "modern" ? "app/" : ""; | ||||||
|
||||||
| return variables.utility.detectTemplateType( cwd ) == "modern" ? "app/" : ""; | |
| return variables.utility.detectTemplateType( arguments.cwd ) == "modern" ? "app/" : ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Flat layout detection description is slightly inaccurate. The code treats a project as "flat" whenever both
app/andpublic/are not present (i.e., either folder missing), not only when neither exists. Update the table wording to match the actual detection behavior.