From 4d76840d44ef9a4434616ae2ad2ac14d6d8e5447 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 22 May 2011 08:56:19 -0400 Subject: [PATCH] Fixing 'no' option when baking projects. Replying no, will enter iteractive mode now. Fixes #1721 --- lib/Cake/Console/Command/Task/ProjectTask.php | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index a3865b06d..b5bb2f3f2 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -163,31 +163,34 @@ class ProjectTask extends Shell { $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n', 'q'), 'y'); - if (strtolower($looksGood) == 'y') { - $Folder = new Folder($skel); - if (!empty($this->params['empty'])) { - $skip = array(); - } + switch (strtolower($looksGood)) { + case 'y': + $Folder = new Folder($skel); + if (!empty($this->params['empty'])) { + $skip = array(); + } - if ($Folder->copy(array('to' => $path, 'skip' => $skip))) { - $this->hr(); - $this->out(__d('cake_console', 'Created: %s in %s', $app, $path)); - $this->hr(); - } else { - $this->err(__d('cake_console', "Could not create '%s' properly.", $app)); + if ($Folder->copy(array('to' => $path, 'skip' => $skip))) { + $this->hr(); + $this->out(__d('cake_console', 'Created: %s in %s', $app, $path)); + $this->hr(); + } else { + $this->err(__d('cake_console', "Could not create '%s' properly.", $app)); + return false; + } + + foreach ($Folder->messages() as $message) { + $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE); + } + + return true; + case 'n': + unset($this->args[0]); + $this->execute(); + return false; + case 'q': + $this->out(__d('cake_console', 'Bake Aborted.')); return false; - } - - foreach ($Folder->messages() as $message) { - $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE); - } - - return true; - } elseif (strtolower($looksGood) == 'q') { - $this->out(__d('cake_console', 'Bake Aborted.')); - } else { - $this->execute(false); - return false; } }