|
|
@@ -141,6 +141,7 @@ class PluginTask extends BakeTask {
|
|
|
$this->createFile($this->path . $plugin . DS . $classBase . DS . 'Controller' . DS . $controllerFileName, $out);
|
|
|
|
|
|
$hasAutoloader = $this->_modifyAutoloader($plugin, $this->path);
|
|
|
+ $this->_generateRoutes($plugin, $this->path);
|
|
|
$this->_modifyBootstrap($plugin, $hasAutoloader);
|
|
|
$this->_generatePhpunitXml($plugin, $this->path);
|
|
|
$this->_generateTestBootstrap($plugin, $this->path);
|
|
|
@@ -166,7 +167,7 @@ class PluginTask extends BakeTask {
|
|
|
if (!preg_match("@\n\s*Plugin::loadAll@", $contents)) {
|
|
|
$autoload = $hasAutoloader ? null : "'autoload' => true, ";
|
|
|
$bootstrap->append(sprintf(
|
|
|
- "\nPlugin::load('%s', [%s'bootstrap' => false, 'routes' => false]);\n",
|
|
|
+ "\nPlugin::load('%s', [%s'bootstrap' => false, 'routes' => true]);\n",
|
|
|
$plugin,
|
|
|
$autoload
|
|
|
));
|
|
|
@@ -176,6 +177,23 @@ class PluginTask extends BakeTask {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Generate a routes file for the plugin being baked.
|
|
|
+ *
|
|
|
+ * @param string $plugin The plugin to generate routes for.
|
|
|
+ * @param string $path The path to save the routes.php file in.
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ protected function _generateRoutes($plugin, $path) {
|
|
|
+ $this->Template->set([
|
|
|
+ 'plugin' => $plugin,
|
|
|
+ ]);
|
|
|
+ $this->out( __d('cake_console', 'Generating routes.php file...'));
|
|
|
+ $out = $this->Template->generate('config', 'routes');
|
|
|
+ $file = $path . $plugin . DS . 'Config' . DS . 'routes.php';
|
|
|
+ $this->createFile($file, $out);
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* Generate a phpunit.xml stub for the plugin.
|
|
|
*
|
|
|
* @param string $plugin Name of plugin
|
|
|
@@ -300,6 +318,9 @@ class PluginTask extends BakeTask {
|
|
|
'Can create plugins in any of your bootstrapped plugin paths.'
|
|
|
))->addArgument('name', [
|
|
|
'help' => __d('cake_console', 'CamelCased name of the plugin to create.')
|
|
|
+ ])->addOption('composer', [
|
|
|
+ 'default' => ROOT . '/composer.phar',
|
|
|
+ 'help' => __d('cake_console', 'The path to the composer executable.')
|
|
|
])->removeOption('plugin');
|
|
|
|
|
|
return $parser;
|