Skip to content

Commit

Permalink
Modified the rest of the shell tasks to account for the new plugin fo…
Browse files Browse the repository at this point in the history
…lder structure
  • Loading branch information
lorenzo committed Jun 17, 2014
1 parent d624cbb commit c0039f8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Console/Command/Task/ControllerTask.php
Expand Up @@ -127,6 +127,7 @@ public function bake($controllerName) {
$namespace = Configure::read('App.namespace');
if ($this->plugin) {
$namespace = $this->plugin;
$this->pathFragment = 'src/' . $this->pathFragment;
}

$data = compact(
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/Task/FixtureTask.php
Expand Up @@ -45,7 +45,7 @@ public function getPath() {
$dir = 'Test/Fixture/';
$path = ROOT . DS . $dir;
if (isset($this->plugin)) {
$path = $this->_pluginPath($this->plugin) . $dir;
$path = $this->_pluginPath($this->plugin) . 'tests/TestCase/';
}
return str_replace('/', DS, $path);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Console/Command/Task/ModelTask.php
Expand Up @@ -109,6 +109,10 @@ public function bake($name) {
$validation = $this->getValidation($model);
$behaviors = $this->getBehaviors($model);

if ($this->plugin) {
$this->pathFragment = 'src/' . $this->pathFragment;
}

$data = compact(
'associations', 'primaryKey', 'displayField',
'table', 'fields', 'validation', 'behaviors'
Expand Down
4 changes: 4 additions & 0 deletions src/Console/Command/Task/SimpleBakeTask.php
Expand Up @@ -90,6 +90,10 @@ public function main($name = null) {
* @return void
*/
public function bake($name) {
if ($this->plugin) {
$this->pathFragment = 'src/' . $this->pathFragment;
}

$this->Template->set('name', $name);
$this->Template->set($this->templateData());
$contents = $this->Template->generate('classes', $this->template());
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/Task/TestTask.php
Expand Up @@ -466,7 +466,7 @@ public function getPath() {
$dir = 'Test/TestCase/';
$path = ROOT . DS . $dir;
if (isset($this->plugin)) {
$path = $this->_pluginPath($this->plugin) . $dir;
$path = $this->_pluginPath($this->plugin) . 'tests/TestCase/';
}
return $path;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Console/Command/Task/ViewTask.php
Expand Up @@ -313,6 +313,9 @@ public function customAction() {
* @return string Generated file content.
*/
public function bake($action, $content = '') {
if ($this->plugin) {
$this->pathFragment = 'src/' . $this->pathFragment;
}
if ($content === true) {
$content = $this->getContent($action);
}
Expand Down

0 comments on commit c0039f8

Please sign in to comment.