Skip to content

Commit

Permalink
COMMANDBOX-249
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Feb 23, 2019
1 parent 3f1d17e commit 731a9a7
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,18 @@ component aliases='coldbox create controller' {

// Are we creating views?
if( arguments.views ) {
var viewPath = arguments.viewsDirectory & '/' & arguments.name & '/' & thisAction & '.cfm';

var camelCaseHandlerName = arguments.name.left( 1 ).lCase();
if( arguments.name.len() > 1 ) {
camelCaseHandlerName &= arguments.name.right( -1 );
}

var viewPath = resolvePath( arguments.viewsDirectory & '/' & camelCaseHandlerName & '/' & thisAction & '.cfm' );
// Create dir if it doesn't exist
directorycreate( getDirectoryFromPath( viewPath ), true, true );
// Create View Stub
fileWrite( viewPath, '<cfoutput>#cr#<h1>#arguments.name#.#thisAction#</h1>#cr#</cfoutput>' );
print.greenLine( 'Created ' & arguments.viewsDirectory & '/' & arguments.name & '/' & thisAction & '.cfm' );
print.greenLine( 'Created ' & viewPath );
}

// Are we creating tests cases on actions
Expand All @@ -109,7 +115,7 @@ component aliases='coldbox create controller' {
handlerTestContent = replaceNoCase( handlerTestContent, '|TestCases|', '', 'all' );
}

var handlerPath = '#arguments.directory#/#arguments.name#.cfc';
var handlerPath = resolvePath( '#arguments.directory#/#arguments.name#.cfc' );
// Create dir if it doesn't exist
directorycreate( getDirectoryFromPath( handlerPath ), true, true );

Expand All @@ -124,7 +130,7 @@ component aliases='coldbox create controller' {
print.greenLine( 'Created #handlerPath#' );

if( arguments.integrationTests ) {
var testPath = '#arguments.testsDirectory#/#arguments.name#Test.cfc';
var testPath = resolvePath( '#arguments.testsDirectory#/#arguments.name#Test.cfc' );
// Create dir if it doesn't exist
directorycreate( getDirectoryFromPath( testPath ), true, true );
// Create the tests
Expand Down

0 comments on commit 731a9a7

Please sign in to comment.