diff --git a/cake/console/libs/tasks/plugin.php b/cake/console/libs/tasks/plugin.php index 5fcf45840ca..796f21cf29e 100644 --- a/cake/console/libs/tasks/plugin.php +++ b/cake/console/libs/tasks/plugin.php @@ -139,20 +139,30 @@ function bake($plugin) { if (strtolower($looksGood) == 'y') { $verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n'); - $skel = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . DS . 'templates' . DS . 'skel'; - $Skel =& new Folder($skel); $Folder =& new Folder($this->path . $pluginPath); - $allFiles = $Skel->findRecursive(); - $directories = array(); - foreach($allFiles as $file) { - $dir = ltrim(str_replace($skel, '', dirname($file)), DS); - if (!$dir || preg_match('@^(tmp|plugins)@', $dir) || in_array($dir, $directories)) { - continue; - } - $dirPath = $this->path . $pluginPath . DS . $dir; + $directories = array( + 'config' . DS . 'schema', + 'models' . DS . 'behaviors', + 'models' . DS . 'datasources', + 'controllers' . DS . 'components', + 'views' . DS . 'helpers', + 'tests' . DS . 'cases' . DS . 'components', + 'tests' . DS . 'cases' . DS . 'helpers', + 'tests' . DS . 'cases' . DS . 'behaviors', + 'tests' . DS . 'cases' . DS . 'controllers', + 'tests' . DS . 'cases' . DS . 'models', + 'tests' . DS . 'groups', + 'tests' . DS . 'fixtures', + 'vendors' . DS . 'img', + 'vendors' . DS . 'js', + 'vendors' . DS . 'css', + 'vendors' . DS . 'shells' . DS . 'tasks' + ); + + foreach ($directories as $directory) { + $dirPath = $this->path . $pluginPath . DS . $directory; $Folder->create($dirPath); $File =& new File($dirPath . DS . 'empty', true); - $directories[] = $dir; } if (strtolower($verbose) == 'y') { diff --git a/cake/tests/cases/console/libs/tasks/plugin.test.php b/cake/tests/cases/console/libs/tasks/plugin.test.php index 819d4f60f96..352679f4a22 100644 --- a/cake/tests/cases/console/libs/tasks/plugin.test.php +++ b/cake/tests/cases/console/libs/tasks/plugin.test.php @@ -38,7 +38,6 @@ require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'plugin.php'; require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php'; - Mock::generatePartial( 'ShellDispatcher', 'TestPluginTaskMockShellDispatcher', array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment') @@ -116,14 +115,19 @@ function testBakeFoldersAndFiles() { $this->assertTrue(is_dir($path), 'No plugin dir %s'); $this->assertTrue(is_dir($path . DS . 'config'), 'No config dir %s'); - $this->assertTrue(is_dir($path . DS . 'config' . DS . 'sql'), 'No config dir %s'); - $this->assertTrue(file_exists($path . DS . 'config' . DS . 'sql' . DS . 'empty'), 'No empty file %s'); + $this->assertTrue(is_dir($path . DS . 'config' . DS . 'schema'), 'No schema dir %s'); + $this->assertTrue(file_exists($path . DS . 'config' . DS . 'schema' . DS . 'empty'), 'No empty file %s'); $this->assertTrue(is_dir($path . DS . 'controllers'), 'No controllers dir %s'); $this->assertTrue(is_dir($path . DS . 'controllers' . DS .'components'), 'No components dir %s'); $this->assertTrue(file_exists($path . DS . 'controllers' . DS . 'components' . DS . 'empty'), 'No empty file %s'); + $this->assertTrue(is_dir($path . DS . 'models'), 'No models dir %s'); $this->assertTrue(file_exists($path . DS . 'models' . DS . 'behaviors' . DS . 'empty'), 'No empty file %s'); + $this->assertTrue(is_dir($path . DS . 'models' . DS . 'datasources'), 'No datasources dir %s'); + debug($path . DS . 'models' . DS . 'datsources' . DS . 'empty'); + $this->assertTrue(file_exists($path . DS . 'models' . DS . 'datasources' . DS . 'empty'), 'No empty file %s'); + die; $this->assertTrue(is_dir($path . DS . 'views'), 'No views dir %s'); $this->assertTrue(is_dir($path . DS . 'views' . DS . 'helpers'), 'No helpers dir %s'); @@ -179,7 +183,8 @@ function testBakeFoldersAndFiles() { $this->assertTrue(file_exists($path . DS . 'vendors' . DS . 'img' . DS . 'empty'), 'No empty file %s'); $this->assertTrue(is_dir($path . DS . 'vendors' . DS . 'shells'), 'No vendors shells dir %s'); - $this->assertTrue(is_dir($path . DS . 'vendors' . DS . 'shells' . DS . 'tasks'), 'No vendors shells dir %s'); + $this->assertTrue(file_exists($path . DS . 'vendors' . DS . 'shells' . 'empty'), 'No empty file %s'); + $this->assertTrue(is_dir($path . DS . 'vendors' . DS . 'shells' . DS . 'tasks'), 'No vendors shells tasks dir %s'); $this->assertTrue(file_exists($path . DS . 'vendors' . DS . 'shells' . DS . 'tasks' . DS . 'empty'), 'No empty file %s'); $file = $path . DS . 'bake_test_plugin_app_controller.php';