moved to its own repo
This commit is contained in:
8
templates/bake/Plugin/.gitignore.twig
Normal file
8
templates/bake/Plugin/.gitignore.twig
Normal file
@@ -0,0 +1,8 @@
|
||||
/composer.lock
|
||||
/composer.phar
|
||||
/phpunit.xml
|
||||
/.phpunit.result.cache
|
||||
/phpunit.phar
|
||||
/config/Migrations/schema-dump-default.lock
|
||||
/vendor/
|
||||
/.idea/
|
||||
26
templates/bake/Plugin/README.md.twig
Normal file
26
templates/bake/Plugin/README.md.twig
Normal file
@@ -0,0 +1,26 @@
|
||||
{#
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 2.0.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
# {{ plugin }} plugin for CakePHP
|
||||
|
||||
## Installation
|
||||
|
||||
You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).
|
||||
|
||||
The recommended way to install composer packages is:
|
||||
|
||||
```
|
||||
composer require {{ package }}
|
||||
```
|
||||
40
templates/bake/Plugin/composer.json.twig
Normal file
40
templates/bake/Plugin/composer.json.twig
Normal file
@@ -0,0 +1,40 @@
|
||||
{#
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 2.0.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
{% set namespace = namespace|replace({'\\': '\\\\'}) %}
|
||||
{
|
||||
"name": "{{ package }}",
|
||||
"description": "{{ plugin }} plugin for CakePHP",
|
||||
"type": "cakephp-plugin",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"cakephp/cakephp": "{{ cakeVersion|raw }}"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"{{ namespace }}\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"{{ namespace }}\\Test\\": "tests/",
|
||||
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
|
||||
}
|
||||
}
|
||||
}
|
||||
45
templates/bake/Plugin/phpunit.xml.dist.twig
Normal file
45
templates/bake/Plugin/phpunit.xml.dist.twig
Normal file
@@ -0,0 +1,45 @@
|
||||
{#
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 2.0.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
>
|
||||
<php>
|
||||
<ini name="memory_limit" value="-1"/>
|
||||
<ini name="apc.enable_cli" value="1"/>
|
||||
</php>
|
||||
|
||||
<!-- Add any additional test suites you want to run here -->
|
||||
<testsuites>
|
||||
<testsuite name="{{ plugin }}">
|
||||
<directory>tests/TestCase/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<!-- Setup fixture extension -->
|
||||
<extensions>
|
||||
<extension class="Cake\TestSuite\Fixture\PHPUnitExtension"/>
|
||||
</extensions>
|
||||
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">src/</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
</phpunit>
|
||||
25
templates/bake/Plugin/src/Controller/AppController.php.twig
Normal file
25
templates/bake/Plugin/src/Controller/AppController.php.twig
Normal file
@@ -0,0 +1,25 @@
|
||||
{#
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 2.0.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
{{ element('Bake.file_header', {
|
||||
namespace: "#{namespace}\\Controller",
|
||||
classImports: {
|
||||
'BaseController': "#{baseNamespace}\\Controller\\AppController",
|
||||
},
|
||||
}) }}
|
||||
|
||||
class AppController extends BaseController
|
||||
{
|
||||
}
|
||||
108
templates/bake/Plugin/src/Plugin.php.twig
Normal file
108
templates/bake/Plugin/src/Plugin.php.twig
Normal file
@@ -0,0 +1,108 @@
|
||||
{#
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 1.7.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
{{ element('Bake.file_header', {
|
||||
namespace: "#{namespace}",
|
||||
classImports: [
|
||||
'Cake\\Console\\CommandCollection',
|
||||
'Cake\\Core\\BasePlugin',
|
||||
'Cake\\Core\\ContainerInterface',
|
||||
'Cake\\Core\\PluginApplicationInterface',
|
||||
'Cake\\Http\\MiddlewareQueue',
|
||||
'Cake\\Routing\\RouteBuilder',
|
||||
],
|
||||
}) }}
|
||||
|
||||
/**
|
||||
* Plugin for {{ namespace }}
|
||||
*/
|
||||
class {{ name }}Plugin extends BasePlugin
|
||||
{
|
||||
/**
|
||||
* Load all the plugin configuration and bootstrap logic.
|
||||
*
|
||||
* The host application is provided as an argument. This allows you to load
|
||||
* additional plugin dependencies, or attach events.
|
||||
*
|
||||
* @param \Cake\Core\PluginApplicationInterface $app The host application
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(PluginApplicationInterface $app): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add routes for the plugin.
|
||||
*
|
||||
* If your plugin has many routes and you would like to isolate them into a separate file,
|
||||
* you can create `$plugin/config/routes.php` and delete this method.
|
||||
*
|
||||
* @param \Cake\Routing\RouteBuilder $routes The route builder to update.
|
||||
* @return void
|
||||
*/
|
||||
public function routes(RouteBuilder $routes): void
|
||||
{
|
||||
$routes->plugin(
|
||||
'{{ plugin }}',
|
||||
['path' => '/{{ routePath }}'],
|
||||
function (RouteBuilder $builder) {
|
||||
// Add custom routes here
|
||||
|
||||
$builder->fallbacks();
|
||||
}
|
||||
);
|
||||
parent::routes($routes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add middleware for the plugin.
|
||||
*
|
||||
* @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update.
|
||||
* @return \Cake\Http\MiddlewareQueue
|
||||
*/
|
||||
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
|
||||
{
|
||||
// Add your middlewares here
|
||||
|
||||
return $middlewareQueue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add commands for the plugin.
|
||||
*
|
||||
* @param \Cake\Console\CommandCollection $commands The command collection to update.
|
||||
* @return \Cake\Console\CommandCollection
|
||||
*/
|
||||
public function console(CommandCollection $commands): CommandCollection
|
||||
{
|
||||
// Add your commands here
|
||||
|
||||
$commands = parent::console($commands);
|
||||
|
||||
return $commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register application container services.
|
||||
*
|
||||
* @param \Cake\Core\ContainerInterface $container The Container to update.
|
||||
* @return void
|
||||
* @link https://book.cakephp.org/4/en/development/dependency-injection.html#dependency-injection
|
||||
*/
|
||||
public function services(ContainerInterface $container): void
|
||||
{
|
||||
// Add your services here
|
||||
}
|
||||
}
|
||||
71
templates/bake/Plugin/tests/bootstrap.php.twig
Normal file
71
templates/bake/Plugin/tests/bootstrap.php.twig
Normal file
@@ -0,0 +1,71 @@
|
||||
{#
|
||||
/**
|
||||
* Tests bootstrap file
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 2.0.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
{{ element('Bake.file_header',{namespace: null}) }}
|
||||
|
||||
/**
|
||||
* Test suite bootstrap for {{ plugin }}.
|
||||
*
|
||||
* This function is used to find the location of CakePHP whether CakePHP
|
||||
* has been installed as a dependency of the plugin, or the plugin is itself
|
||||
* installed as a dependency of an application.
|
||||
*/
|
||||
$findRoot = function ($root) {
|
||||
do {
|
||||
$lastRoot = $root;
|
||||
$root = dirname($root);
|
||||
if (is_dir($root . '/vendor/cakephp/cakephp')) {
|
||||
return $root;
|
||||
}
|
||||
} while ($root !== $lastRoot);
|
||||
|
||||
throw new Exception('Cannot find the root of the application, unable to run tests');
|
||||
};
|
||||
$root = $findRoot(__FILE__);
|
||||
unset($findRoot);
|
||||
|
||||
chdir($root);
|
||||
|
||||
require_once $root . '/vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* Define fallback values for required constants and configuration.
|
||||
* To customize constants and configuration remove this require
|
||||
* and define the data required by your plugin here.
|
||||
*/
|
||||
require_once $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
|
||||
|
||||
if (file_exists($root . '/config/bootstrap.php')) {
|
||||
require $root . '/config/bootstrap.php';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load schema from a SQL dump file.
|
||||
*
|
||||
* If your plugin does not use database fixtures you can
|
||||
* safely delete this.
|
||||
*
|
||||
* If you want to support multiple databases, consider
|
||||
* using migrations to provide schema for your plugin,
|
||||
* and using \Migrations\TestSuite\Migrator to load schema.
|
||||
*/
|
||||
use Cake\TestSuite\Fixture\SchemaLoader;
|
||||
|
||||
// Load a schema dump file.
|
||||
(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
|
||||
1
templates/bake/Plugin/tests/schema.sql.twig
Normal file
1
templates/bake/Plugin/tests/schema.sql.twig
Normal file
@@ -0,0 +1 @@
|
||||
-- Test database schema for {{ plugin }}
|
||||
15
templates/bake/Plugin/webroot/.gitkeep.twig
Normal file
15
templates/bake/Plugin/webroot/.gitkeep.twig
Normal file
@@ -0,0 +1,15 @@
|
||||
{#
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 2.0.0
|
||||
* @license https://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
#}
|
||||
Reference in New Issue
Block a user