From d100f09bb244837a61885e4a455ae47981107ce5 Mon Sep 17 00:00:00 2001 From: AD7six Date: Sun, 1 May 2011 22:40:40 +0200 Subject: [PATCH] move/rename folders --- lib/Cake/Console/Command/UpgradeShell.php | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index 1071491a7..e1a00e626 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -4,6 +4,9 @@ * * @package cake.console/shells */ + +App::uses('Folder', 'Utility'); + class UpgradeShell extends Shell { protected $_files = array(); @@ -32,6 +35,31 @@ class UpgradeShell extends Shell { } } + function locations() { + $moves = array( + 'controllers' . DS . 'components' => 'Controller' . DS . 'Component', + 'controllers' => 'Controller', + 'libs' => 'Lib', + 'models' . DS . 'behaviors' => 'Model' . DS . 'Behavior', + 'models' . DS . 'datasources' => 'Model' . DS . 'Datasource', + 'models' => 'Model', + 'tests' . DS . 'cases' => 'tests' . DS . 'Case', + 'tests' . DS . 'fixtures' => 'tests' . DS . 'Fixture', + 'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'templates', + 'vendors' . DS . 'shells' => 'Console' . DS . 'Command', + 'views' . DS . 'helpers' => 'View' . DS . 'Helper', + 'views' => 'View' + ); + + foreach($moves as $old => $new) { + if (is_dir($old)) { + $this->out("Moving $old to $new"); + $Folder = new Folder($old); + $Folder->move($new); + } + } + } + /** * Update helpers. * @@ -333,6 +361,10 @@ class UpgradeShell extends Shell { 'help' => 'Run all upgrade commands.', 'parser' => $subcommandParser )) + ->addSubcommand('locations', array( + 'help' => 'Move files and folders to their new homes.', + 'parser' => $subcommandParser + )) ->addSubcommand('i18n', array( 'help' => 'Update the i18n translation method calls.', 'parser' => $subcommandParser