Class ProjectTask

Task class for creating new project apps and plugins

AppShell
Extended by ProjectTask
Package: Cake\Console\Command\Task
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ProjectTask.php

Properties summary

  • $configPath public
    string
    configs path (used in testing).

Method Summary

  • _replaceCorePath() protected
    Replaces the CAKE_PATH placeholder in the template files.
  • bake() public

    Looks for a skeleton template of a Cake application, and if not found asks the user for a path. When there is a path this method will make a deep copy of the skeleton to the project directory.

  • cachePrefix() public
    Writes cache prefix using app's name
  • cakeAdmin() public
    Enables Configure::read('Routing.prefixes') in /app/Config/core.php
  • Checks PHP's include_path for CakePHP.
  • consolePath() public

    Generates the correct path to the CakePHP libs that are generating the project and points app/console/cake.php to the right place

  • corePath() public
    Generates and writes CAKE_CORE_INCLUDE_PATH
  • execute() public

    Checks that given project path does not already exist, and finds the app directory in it. Then it calls bake() with that information.

  • Gets the option parser instance and configures it.
  • getPrefix() public
    Checks for Configure::read('Routing.prefixes') and forces user to input it if not enabled
  • Generates and writes 'Security.cipherSeed'
  • Generates and writes 'Security.salt'

Method Detail

_replaceCorePath()source protected

_replaceCorePath( string $filename , boolean $hardCode )

Replaces the CAKE_PATH placeholder in the template files.

Parameters

string $filename
The filename to operate on.
boolean $hardCode
Whether or not the define should be uncommented.

Returns

boolean
Success

bake()source public

bake( string $path , string $skel null , string $skip array('empty') )

Looks for a skeleton template of a Cake application, and if not found asks the user for a path. When there is a path this method will make a deep copy of the skeleton to the project directory.

Parameters

string $path
Project path
string $skel optional null
Path to copy from
string $skip optional array('empty')
array of directories to skip when copying

Returns

mixed

cachePrefix()source public

cachePrefix( string $dir )

Writes cache prefix using app's name

Parameters

string $dir
Path to project

Returns

boolean
Success

cakeAdmin()source public

cakeAdmin( string $name )

Enables Configure::read('Routing.prefixes') in /app/Config/core.php

Parameters

string $name
Name to use as admin routing

Returns

boolean
Success

cakeOnIncludePath()source public

cakeOnIncludePath( )

Checks PHP's include_path for CakePHP.

Returns

boolean
Indicates whether or not CakePHP exists on include_path

consolePath()source public

consolePath( string $path )

Generates the correct path to the CakePHP libs that are generating the project and points app/console/cake.php to the right place

Parameters

string $path
Project path.

Returns

boolean
success

corePath()source public

corePath( string $path , boolean $hardCode true )

Generates and writes CAKE_CORE_INCLUDE_PATH

Parameters

string $path
Project path
boolean $hardCode optional true
Whether or not define calls should be hardcoded.

Returns

boolean
Success

execute()source public

execute( )

Checks that given project path does not already exist, and finds the app directory in it. Then it calls bake() with that information.

Returns

mixed

getOptionParser()source public

getOptionParser( )

Gets the option parser instance and configures it.

Returns

ConsoleOptionParser

getPrefix()source public

getPrefix( )

Checks for Configure::read('Routing.prefixes') and forces user to input it if not enabled

Returns

string
Admin route to use

securityCipherSeed()source public

securityCipherSeed( string $path )

Generates and writes 'Security.cipherSeed'

Parameters

string $path
Project path

Returns

boolean
Success

securitySalt()source public

securitySalt( string $path )

Generates and writes 'Security.salt'

Parameters

string $path
Project path

Returns

boolean
Success

Properties detail

$configPathsource

public string

configs path (used in testing).

null

© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.10/class-ProjectTask.html