Skip to content

Commit

Permalink
Making model, view, and controller task use BakeTask.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 5, 2010
1 parent 1af49c8 commit 4a6ab01
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions cake/console/libs/tasks/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

include_once dirname(__FILE__) . DS . 'bake.php';

/**
* Task class for creating and updating controller files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
*/
class ControllerTask extends Shell {
class ControllerTask extends BakeTask {

var $name = 'Controller';
/**
* Name of plugin
*
Expand Down Expand Up @@ -318,10 +321,7 @@ function bake($controllerName, $actions = '', $helpers = null, $components = nul
$this->Template->set(compact('controllerName', 'actions', 'helpers', 'components', 'isScaffold'));
$contents = $this->Template->generate('classes', 'controller');

$path = $this->path;
if (isset($this->plugin)) {
$path = $this->_pluginPath($this->plugin) . 'controllers' . DS;
}
$path = $this->getPath();
$filename = $path . $this->_controllerPath($controllerName) . '_controller.php';
if ($this->createFile($filename, $contents)) {
return $contents;
Expand Down
10 changes: 5 additions & 5 deletions cake/console/libs/tasks/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

include_once dirname(__FILE__) . DS . 'bake.php';

/**
* Task class for creating and updating model files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
*/
class ModelTask extends Shell {
class ModelTask extends BakeTask {

var $name = 'Model';
/**
* Name of plugin
*
Expand Down Expand Up @@ -751,10 +754,7 @@ function bake($name, $data = array()) {
$this->Template->set('plugin', Inflector::camelize($this->plugin));
$out = $this->Template->generate('classes', 'model');

$path = $this->path;
if (isset($this->plugin)) {
$path = $this->_pluginPath($this->plugin) . 'models' . DS;
}
$path = $this->getPath();
$filename = $path . Inflector::underscore($name) . '.php';
$this->out("\nBaking model class for $name...");
$this->createFile($filename, $out);
Expand Down
10 changes: 5 additions & 5 deletions cake/console/libs/tasks/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::import('Controller', 'Controller', false);
include_once dirname(__FILE__) . DS . 'bake.php';

/**
* Task class for creating and updating view files.
*
* @package cake
* @subpackage cake.cake.console.libs.tasks
*/
class ViewTask extends Shell {
class ViewTask extends BakeTask {

var $name = 'View';

/**
* Name of plugin
Expand Down Expand Up @@ -370,10 +373,7 @@ function bake($action, $content = '') {
if ($content === true) {
$content = $this->getContent($action);
}
$path = $this->path;
if (isset($this->plugin)) {
$path = $this->_pluginPath($this->plugin) . 'views' . DS;
}
$path = $this->getPath();
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
return $this->createFile($filename, $content);
}
Expand Down

0 comments on commit 4a6ab01

Please sign in to comment.