From 63535586220b206284b63dc948eb86ea7eb85ffe Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 24 Apr 2012 02:40:42 +0200 Subject: [PATCH] bame themes now in correct order: app -> plugin -> default --- lib/Cake/Console/Command/Task/TemplateTask.php | 17 +++++++++-------- .../Console/Command/Task/TemplateTaskTest.php | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/Cake/Console/Command/Task/TemplateTask.php b/lib/Cake/Console/Command/Task/TemplateTask.php index d9a0e3f43..bbc586f65 100644 --- a/lib/Cake/Console/Command/Task/TemplateTask.php +++ b/lib/Cake/Console/Command/Task/TemplateTask.php @@ -55,11 +55,18 @@ class TemplateTask extends AppShell { * Find the paths to all the installed shell themes in the app. * * Bake themes are directories not named `skel` inside a `Console/Templates` path. - * + * They are listed in this order: app -> plugin -> default + * * @return array Array of bake themes that are installed. */ protected function _findThemes() { - $paths = array(); + $paths = App::path('Console'); + + $plugins = App::objects('plugin'); + foreach ($plugins as $plugin) { + $paths[] = $this->_pluginPath($plugin) . 'Console' . DS; + } + $core = current(App::core('Console')); $separator = DS === '/' ? '/' : '\\\\'; $core = preg_replace('#shells' . $separator . '$#', '', $core); @@ -69,13 +76,7 @@ class TemplateTask extends AppShell { $contents = $Folder->read(); $themeFolders = $contents[0]; - $plugins = App::objects('plugin'); $paths[] = $core; - foreach ($plugins as $plugin) { - $paths[] = $this->_pluginPath($plugin) . 'Console' . DS; - } - - $paths = array_merge($paths, App::path('Console')); // TEMPORARY TODO remove when all paths are DS terminated foreach ($paths as $i => $path) { diff --git a/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php index ad4589360..eff761c87 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php @@ -134,7 +134,7 @@ class TemplateTaskTest extends CakeTestCase { $result = $this->Task->generate('classes', 'test_object', array('test' => 'foo')); $expected = "I got rendered\nfoo"; - $this->assertEquals($expected, $result); + $this->assertTextEquals($expected, $result); } /**