Skip to content

Commit

Permalink
Merge branch '2.1' into 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 13, 2012
2 parents 0fdf9dd + 8103eae commit 9628910
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions lib/Cake/Console/Command/Task/ExtractTask.php
Expand Up @@ -105,6 +105,38 @@ class ExtractTask extends AppShell {
*/
protected $_validationDomain = 'default';

/**
* Method to interact with the User and get path selections.
*
* @return void
*/
protected function _getPaths() {
$defaultPath = APP;
while (true) {
$currentPaths = count($this->_paths) > 0 ? $this->_paths : array('None');
$message = __d(
'cake_console',
"Current paths: %s\nWhat is the path you would like to extract?\n[Q]uit [D]one",
implode(', ', $currentPaths)
);
$response = $this->in($message, null, $defaultPath);
if (strtoupper($response) === 'Q') {
$this->out(__d('cake_console', 'Extract Aborted'));
return $this->_stop();
} elseif (strtoupper($response) === 'D' && count($this->_paths)) {
$this->out();
return;
} elseif (strtoupper($response) === 'D') {
$this->err(__d('cake_console', '<warning>No directories selected.</warning> Please choose a directory.'));
} elseif (is_dir($response)) {
$this->_paths[] = $response;
$defaultPath = 'D';
} else {
$this->err(__d('cake_console', 'The directory path you supplied was not found. Please try again.'));
}
$this->out();
}
}
/**
* Execution method always used for tasks
*
Expand All @@ -127,24 +159,7 @@ public function execute() {
$this->_paths = array(CakePlugin::path($plugin));
$this->params['plugin'] = $plugin;
} else {
$defaultPath = APP;
$message = __d('cake_console', "What is the path you would like to extract?\n[Q]uit [D]one");
while (true) {
$response = $this->in($message, null, $defaultPath);
if (strtoupper($response) === 'Q') {
$this->out(__d('cake_console', 'Extract Aborted'));
$this->_stop();
} elseif (strtoupper($response) === 'D') {
$this->out();
break;
} elseif (is_dir($response)) {
$this->_paths[] = $response;
$defaultPath = 'D';
} else {
$this->err(__d('cake_console', 'The directory path you supplied was not found. Please try again.'));
}
$this->out();
}
$this->_getPaths();
}

if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) {
Expand Down

0 comments on commit 9628910

Please sign in to comment.