Skip to content

Commit

Permalink
Revert "Changing the Plugin task to take the dirs to create from the …
Browse files Browse the repository at this point in the history
…App skeleton"

This reverts commit fe8b641.

Conflicts:

	cake/console/libs/tasks/plugin.php
  • Loading branch information
AD7six committed Aug 2, 2009
1 parent db6f2ce commit 20b1dd7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
32 changes: 21 additions & 11 deletions cake/console/libs/tasks/plugin.php
Expand Up @@ -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') {
Expand Down
13 changes: 9 additions & 4 deletions cake/tests/cases/console/libs/tasks/plugin.test.php
Expand Up @@ -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')
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 20b1dd7

Please sign in to comment.