Browse Source

move/rename folders

AD7six 15 years ago
parent
commit
d100f09bb2
1 changed files with 32 additions and 0 deletions
  1. 32 0
      lib/Cake/Console/Command/UpgradeShell.php

+ 32 - 0
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