Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making model, view, and controller task use BakeTask.

  • Loading branch information...
commit 4a6ab01134c8ab70a789a58c32fdbd94e28f8075 1 parent 1af49c8
@markstory markstory authored
View
10 cake/console/libs/tasks/controller.php
@@ -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
*
@@ -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;
View
10 cake/console/libs/tasks/model.php
@@ -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
*
@@ -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);
View
10 cake/console/libs/tasks/view.php
@@ -18,6 +18,7 @@
* @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.
@@ -25,7 +26,9 @@
* @package cake
* @subpackage cake.cake.console.libs.tasks
*/
-class ViewTask extends Shell {
+class ViewTask extends BakeTask {
+
+ var $name = 'View';
/**
* Name of plugin
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.