|
|
@@ -53,8 +53,9 @@ class PluginTask extends AppShell {
|
|
|
$plugin = Inflector::camelize($this->args[0]);
|
|
|
$pluginPath = $this->_pluginPath($plugin);
|
|
|
if (is_dir($pluginPath)) {
|
|
|
- $this->out(__d('cake_console', 'Plugin: %s', $plugin));
|
|
|
+ $this->out(__d('cake_console', 'Plugin: %s already exists, no action taken', $plugin));
|
|
|
$this->out(__d('cake_console', 'Path: %s', $pluginPath));
|
|
|
+ return false;
|
|
|
} else {
|
|
|
$this->_interactive($plugin);
|
|
|
}
|
|
|
@@ -127,6 +128,9 @@ class PluginTask extends AppShell {
|
|
|
|
|
|
$errors = $Folder->errors();
|
|
|
if (!empty($errors)) {
|
|
|
+ foreach ($errors as $message) {
|
|
|
+ $this->error($message);
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -144,8 +148,17 @@ class PluginTask extends AppShell {
|
|
|
$out .= "}\n\n";
|
|
|
$this->createFile($this->path . $plugin . DS . 'Model' . DS . $modelFileName, $out);
|
|
|
|
|
|
+ $bootstrap = new File(APP . 'Config' . DS . 'bootstrap.php', false);
|
|
|
+ $contents = $bootstrap->read();
|
|
|
+ if (!preg_match("@\n\s*CakePlugin::loadAll@", $contents)) {
|
|
|
+ $bootstrap->append("CakePlugin::load('$plugin', array('bootstrap' => false, 'routes' => false));");
|
|
|
+ $this->out('', 1, Shell::VERBOSE);
|
|
|
+ $this->out(__d('cake_dev', '%s modified', APP . 'Config' . DS . 'bootstrap.php', 1, Shell::VERBOSE));
|
|
|
+ }
|
|
|
+
|
|
|
$this->hr();
|
|
|
$this->out(__d('cake_console', '<success>Created:</success> %s in %s', $plugin, $this->path . $plugin), 2);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
@@ -170,7 +183,7 @@ class PluginTask extends AppShell {
|
|
|
$this->out($i + 1 . '. ' . $option);
|
|
|
}
|
|
|
$prompt = __d('cake_console', 'Choose a plugin path from the paths above.');
|
|
|
- $choice = $this->in($prompt);
|
|
|
+ $choice = $this->in($prompt, null, 1);
|
|
|
if (intval($choice) > 0 && intval($choice) <= $max) {
|
|
|
$valid = true;
|
|
|
}
|