bame themes now in correct order: app -> plugin -> default

This commit is contained in:
euromark 2012-04-24 02:40:42 +02:00
parent 74ee75b0ef
commit 6353558622
2 changed files with 10 additions and 9 deletions

View file

@ -55,11 +55,18 @@ class TemplateTask extends AppShell {
* Find the paths to all the installed shell themes in the app. * Find the paths to all the installed shell themes in the app.
* *
* Bake themes are directories not named `skel` inside a `Console/Templates` path. * 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. * @return array Array of bake themes that are installed.
*/ */
protected function _findThemes() { 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')); $core = current(App::core('Console'));
$separator = DS === '/' ? '/' : '\\\\'; $separator = DS === '/' ? '/' : '\\\\';
$core = preg_replace('#shells' . $separator . '$#', '', $core); $core = preg_replace('#shells' . $separator . '$#', '', $core);
@ -69,13 +76,7 @@ class TemplateTask extends AppShell {
$contents = $Folder->read(); $contents = $Folder->read();
$themeFolders = $contents[0]; $themeFolders = $contents[0];
$plugins = App::objects('plugin');
$paths[] = $core; $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 // TEMPORARY TODO remove when all paths are DS terminated
foreach ($paths as $i => $path) { foreach ($paths as $i => $path) {

View file

@ -134,7 +134,7 @@ class TemplateTaskTest extends CakeTestCase {
$result = $this->Task->generate('classes', 'test_object', array('test' => 'foo')); $result = $this->Task->generate('classes', 'test_object', array('test' => 'foo'));
$expected = "I got rendered\nfoo"; $expected = "I got rendered\nfoo";
$this->assertEquals($expected, $result); $this->assertTextEquals($expected, $result);
} }
/** /**