[ Index ]
 

Code source de CakePHP 1.1.13.4450

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/cake/scripts/ -> bake.php (sommaire)

Command-line code generation utility to automate programmer chores. Bake is CakePHP's code generation script, which can help you kickstart application development by writing fully functional skeleton controllers, models, and views. Going further, Bake can also write Unit Tests for you.

Copyright: Copyright 2005-2007, Cake Software Foundation, Inc.
License: http://www.opensource.org/licenses/mit-license.php The MIT License
Version: $Revision: 4409 $
Poids: 2653 lignes (101 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 7 fichiers
 cake/dispatcher.php
 cake/app_controller.php
 cake/app_model.php
 cake/config/paths.php
 cake/basics.php
 cake/scripts/templates/views/home.thtml
 cake/scripts/templates/skel/config/core.php

Définit 1 class

Bake:: (49 méthodes):
  __construct()
  Bake()
  main()
  doDbConfig()
  doModel()
  doView()
  __bakeViews()
  doController()
  __bakeActions()
  doUnitTest()
  bakeDbConfig()
  bakeModel()
  bakeView()
  bakeController()
  bakeUnitTest()
  getInput()
  stdout()
  stderr()
  hr()
  __createFile()
  generateFields()
  generateAreaDiv()
  generateCheckboxDiv()
  generateDate()
  generateTime()
  generateDateTime()
  generateInputDiv()
  generateSelectDiv()
  generateSubmitDiv()
  divTag()
  __attributesToArray()
  help()
  project()
  __checkPath()
  __buildDirLayout()
  __copydirr()
  __addAdminRoute()
  welcome()
  __defaultHome()
  __controllerPath()
  __controllerName()
  __modelName()
  __modelKey()
  __modelNameFromKey()
  __singularName()
  __pluralName()
  __singularHumanName()
  __pluralHumanName()
  __doList()


Classe: Bake  - X-Ref

Bake is a command-line code generation utility for automating programmer chores.

__construct()   X-Ref
Private helper function for constructor


Bake()   X-Ref
Constructor.

return: Bake

main()   X-Ref
Main-loop method.


doDbConfig()   X-Ref
Database configuration setup.


doModel()   X-Ref
Action to create a Model.


doView()   X-Ref
Action to create a View.


__bakeViews($controllerName, $controllerPath, $admin= null, $admin_url = null)   X-Ref
Pas de description

doController()   X-Ref
Action to create a Controller.


__bakeActions($controllerName, $admin = null, $admin_url = null, $wannaUseSession = 'y')   X-Ref
Pas de description

doUnitTest()   X-Ref
Action to create a Unit Test.

return: Success

bakeDbConfig( $driver, $connect, $host, $login, $password, $database, $prefix)   X-Ref
Creates a database configuration file for Bake.

param: string $host
param: string $login
param: string $password
param: string $database

bakeModel($name, $useDbConfig = 'default', $useTable = null, $primaryKey = 'id', $validate=array()   X-Ref
Assembles and writes a Model file.

param: string $name
param: object $useDbConfig
param: string $useTable
param: string $primaryKey
param: array $validate
param: array $associations

bakeView($controllerName, $actionName, $content = '')   X-Ref
Assembles and writes a View file.

param: string $controllerName
param: string $actionName
param: string $content

bakeController($controllerName, $uses, $helpers, $components, $actions = '', $wannaUseScaffold = 'y')   X-Ref
Assembles and writes a Controller file.

param: string $controllerName
param: array $uses
param: array $helpers
param: array $components
param: string $actions

bakeUnitTest($type, $className)   X-Ref
Assembles and writes a unit test file.

param: string $type One of "model", and "controller".
param: string $className

getInput($prompt, $options = null, $default = null)   X-Ref
Prompts the user for input, and returns it.

param: string $prompt Prompt text.
param: mixed $options Array or string of options.
param: string $default Default input value.
return: Either the default value, or the user-provided input.

stdout($string, $newline = true)   X-Ref
Outputs to the stdout filehandle.

param: string $string String to output.
param: boolean $newline If true, the outputs gets an added newline.

stderr($string)   X-Ref
Outputs to the stderr filehandle.

param: string $string Error text to output.

hr()   X-Ref
Outputs a series of minus characters to the standard output, acts as a visual separator.


__createFile($path, $contents)   X-Ref
Creates a file at given path.

param: string $path        Where to put the file.
param: string $contents Content to put in the file.
return: Success

generateFields( $fields, $readOnly = false )   X-Ref
Takes an array of database fields, and generates an HTML form for a View.
This is an extraction from the Scaffold functionality.

param: array $fields
param: boolean $readOnly
return: Generated HTML and PHP.

generateAreaDiv($tagName, $prompt, $required=false, $errorMsg=null, $cols=60, $rows=10, $htmlOptions=null )   X-Ref
Generates PHP code for a View file that makes a textarea.

param: string $tagName
param: string $prompt
param: boolean $required
param: string $errorMsg
param: integer $cols
param: integer $rows
param: array $htmlOptions
return: Generated HTML and PHP.

generateCheckboxDiv($tagName, $prompt, $required=false, $errorMsg=null, $htmlOptions=null )   X-Ref
Generates PHP code for a View file that makes a checkbox, wrapped in a DIV.

param: string $tagName
param: string $prompt
param: boolean $required
param: string $errorMsg
param: array $htmlOptions
return: Generated HTML and PHP.

generateDate($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected=null )   X-Ref
Generates PHP code for a View file that makes a date-picker, wrapped in a DIV.

param: string $tagName
param: string $prompt
param: boolean $required
param: string $errorMsg
param: integer $size
param: array $htmlOptions
param: string $selected
return: Generated HTML and PHP.

generateTime($tagName, $prompt, $required = false, $errorMsg = null, $size = 20, $htmlOptions = null, $selected = null)   X-Ref
Generates PHP code for a View file that makes a time-picker, wrapped in a DIV.

param: string $tagName
param: string $prompt
param: boolean $required
param: string $errorMsg
param: integer $size
param: array $htmlOptions
param: string $selected
return: Generated HTML and PHP.

generateDateTime($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null, $selected = null )   X-Ref
EGenerates PHP code for a View file that makes a datetime-picker, wrapped in a DIV.

param: string $tagName
param: string $prompt
param: boolean $required
param: string $errorMsg
param: integer $size
param: array $htmlOptions
param: string $selected
return: Generated HTML and PHP.

generateInputDiv($tagName, $prompt, $required=false, $errorMsg=null, $size=20, $htmlOptions=null )   X-Ref
Generates PHP code for a View file that makes an INPUT field, wrapped in a DIV.

param: string $tagName
param: string $prompt
param: boolean $required
param: string $errorMsg
param: integer $size
param: array $htmlOptions
return: Generated HTML and PHP.

generateSelectDiv($tagName, $prompt, $options, $selected=null, $selectAttr=null, $optionAttr=null, $required=false, $errorMsg=null)   X-Ref
Generates PHP code for a View file that makes a SELECT box, wrapped in a DIV.

param: string $tagName
param: string $prompt
param: array $options
param: string $selected
param: array $selectAttr
param: array $optionAttr
param: boolean $required
param: string $errorMsg
return: Generated HTML and PHP.

generateSubmitDiv($displayText, $htmlOptions = null)   X-Ref
Generates PHP code for a View file that makes a submit button, wrapped in a DIV.

param: string $displayText
param: array $htmlOptions
return: Generated HTML.

divTag($class, $text)   X-Ref
Returns the text wrapped in an HTML DIV, followed by a newline.

param: string $class
param: string $text
return: Generated HTML.

__attributesToArray($htmlAttributes)   X-Ref
Parses the HTML attributes array, which is a common data structure in View files.
Returns PHP code for initializing this array in a View file.

param: array $htmlAttributes
return: Generated PHP code.

help()   X-Ref
Outputs usage text on the standard output.


project($projectPath = null)   X-Ref
Checks that given project path does not already exist, and
finds the app directory in it. Then it calls __buildDirLayout() with that information.

param: string $projectPath

__checkPath($projectPath)   X-Ref
Returns true if given path is a directory.

param: string $projectPath
return: True if given path is a directory.

__buildDirLayout($projectPath, $appName)   X-Ref
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.
A default home page will be added, and the tmp file storage will be chmod'ed to 0777.

param: string $projectPath
param: string $appName

__copydirr($fromDir, $toDir, $chmod = 0755, $verbose = false)   X-Ref
Recursive directory copy.

param: string $fromDir
param: string $toDir
param: octal $chmod
param: boolean     $verbose
return: Success.

__addAdminRoute($name)   X-Ref
Pas de description

welcome()   X-Ref
Outputs an ASCII art banner to standard output.


__defaultHome($dir, $app)   X-Ref
Writes a file with a default home page to the project.

param: string $dir
param: string $app

__controllerPath($name)   X-Ref
creates the proper pluralize controller for the url

param: string $name
return: string $name

__controllerName($name)   X-Ref
creates the proper pluralize controller class name.

param: string $name
return: string $name

__modelName($name)   X-Ref
creates the proper singular model name.

param: string $name
return: string $name

__modelKey($name)   X-Ref
creates the proper singular model key for associations.

param: string $name
return: string $name

__modelNameFromKey($key)   X-Ref
creates the proper model name from a foreign key.

param: string $key
return: string $name

__singularName($name)   X-Ref
creates the singular name for use in views.

param: string $name
return: string $name

__pluralName($name)   X-Ref
creates the plural name for views.

param: string $name
return: string $name

__singularHumanName($name)   X-Ref
creates the singular human name used in views

param: string $name
return: string $name

__pluralHumanName($name)   X-Ref
creates the plural humna name used in views

param: string $name
return: string $name

__doList($useDbConfig = 'default', $type = 'Models')   X-Ref
outputs the a list of possible models or controllers from database

param: string $useDbConfig
param: string $type = Models or Controllers
return: output



Généré le : Sun Feb 25 19:27:47 2007 par Balluche grâce à PHPXref 0.7