From 134f4835ab279589067f93a280e7cf7510f3176c Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 16 Oct 2010 01:02:15 -0400 Subject: [PATCH] Adding some colours to project task, and fixing verbose output question. --- cake/console/libs/tasks/project.php | 33 ++++++++++++----------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 9813527e6d3..065cc912c7e 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -39,16 +39,15 @@ class ProjectTask extends Shell { * * @param string $project Project path */ - public function execute($project = null) { - if ($project === null) { - if (isset($this->args[0])) { - $project = $this->args[0]; - } + public function execute() { + $project = null; + if (isset($this->args[0])) { + $project = $this->args[0]; } if ($project) { $this->Dispatch->parseParams(array('-app', $project)); - $project = $this->params['working']; + $project = $this->Dispatch->params['working']; } if (empty($this->params['skel'])) { @@ -60,14 +59,14 @@ public function execute($project = null) { while (!$project) { $prompt = __("What is the full path for this app including the app directory name?\n Example:"); - $default = $this->params['working'] . DS . 'myapp'; + $default = $this->Dispatch->params['working'] . DS . 'myapp'; $project = $this->in($prompt . $default, null, $default); } if ($project) { $response = false; while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) { - $prompt = sprintf(__('A project already exists in this location: %s Overwrite?'), $project); + $prompt = sprintf(__('A project already exists in this location: %s Overwrite?'), $project); $response = $this->in($prompt, array('y','n'), 'n'); if (strtolower($response) === 'n') { $response = $project = false; @@ -80,7 +79,7 @@ public function execute($project = null) { if ($this->createHome($path)) { $this->out(__('Welcome page created')); } else { - $this->out(__('The Welcome page was NOT created')); + $this->out(__('The Welcome page was NOT created')); } if ($this->securitySalt($path) === true ) { @@ -109,8 +108,8 @@ public function execute($project = null) { $this->out(sprintf(__('chmod -R 0777 %s'), $path . DS .'tmp')); } - $this->params['working'] = $path; - $this->params['app'] = basename($path); + $this->Dispatch->params['working'] = $path; + $this->Dispatch->params['app'] = basename($path); return true; } } @@ -133,7 +132,7 @@ function bake($path, $skel = null, $skip = array('empty')) { while (!$skel) { $skel = $this->in(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS)); if ($skel == '') { - $this->out(__('The directory path you supplied was empty. Please try again.')); + $this->err(__('The directory path you supplied was empty. Please try again.')); } else { while (is_dir($skel) === false) { $skel = $this->in(__('Directory path does not exist please choose another:')); @@ -151,25 +150,21 @@ function bake($path, $skel = null, $skip = array('empty')) { $looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y'); if (strtolower($looksGood) == 'y') { - $verbose = $this->in(__('Do you want verbose output?'), array('y', 'n'), 'n'); - $Folder = new Folder($skel); if (!empty($this->params['empty'])) { $skip = array(); } if ($Folder->copy(array('to' => $path, 'skip' => $skip))) { $this->hr(); - $this->out(sprintf(__('Created: %s in %s'), $app, $path)); + $this->out(sprintf(__('Created: %s in %s'), $app, $path)); $this->hr(); } else { $this->err(sprintf(__(" '%s' could not be created properly"), $app)); return false; } - if (strtolower($verbose) == 'y') { - foreach ($Folder->messages() as $message) { - $this->out($message); - } + foreach ($Folder->messages() as $message) { + $this->out($message, 1, Shell::VERBOSE); } return true;