Move container dump from application code to Robofile and to generated dir
[PREMIUM-99]
This commit is contained in:
21
RoboFile.php
21
RoboFile.php
@@ -283,9 +283,6 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function containerDump() {
|
function containerDump() {
|
||||||
$this->say('Deleting DI Container');
|
|
||||||
$this->_exec('rm -f ./lib/DI/CachedContainer.php');
|
|
||||||
$this->say('Generating DI container cache');
|
|
||||||
$this->loadEnv();
|
$this->loadEnv();
|
||||||
define('ABSPATH', getenv('WP_ROOT') . '/');
|
define('ABSPATH', getenv('WP_ROOT') . '/');
|
||||||
if (!file_exists(ABSPATH . 'wp-config.php')) {
|
if (!file_exists(ABSPATH . 'wp-config.php')) {
|
||||||
@@ -293,8 +290,22 @@ class RoboFile extends \Robo\Tasks {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
$container_factory = new \MailPoet\DI\ContainerFactory();
|
$configurator = new \MailPoet\DI\ContainerConfigurator();
|
||||||
$container_factory->dumpContainer();
|
$dump_file = __DIR__ . '/generated/' . $configurator->getDumpClassname() . '.php';
|
||||||
|
$this->say('Deleting DI Container');
|
||||||
|
$this->_exec("rm -f $dump_file");
|
||||||
|
$this->say('Generating DI container cache');
|
||||||
|
$container_factory = new \MailPoet\DI\ContainerFactory($configurator);
|
||||||
|
$container = $container_factory->getConfiguredContainer();
|
||||||
|
$container->compile();
|
||||||
|
$dumper = new \MailPoetVendor\Symfony\Component\DependencyInjection\Dumper\PhpDumper($container);
|
||||||
|
file_put_contents(
|
||||||
|
$dump_file,
|
||||||
|
$dumper->dump([
|
||||||
|
'class' => $configurator->getDumpClassname(),
|
||||||
|
'namespace' => $configurator->getDumpNamespace()
|
||||||
|
])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function qa() {
|
function qa() {
|
||||||
|
1
build.sh
1
build.sh
@@ -42,6 +42,7 @@ echo '[BUILD] Fetching prefixed production libraries'
|
|||||||
echo '[BUILD] Copying release folders'
|
echo '[BUILD] Copying release folders'
|
||||||
cp -Rf lang $plugin_name
|
cp -Rf lang $plugin_name
|
||||||
cp -RfL assets $plugin_name
|
cp -RfL assets $plugin_name
|
||||||
|
cp -Rf generated $plugin_name
|
||||||
cp -Rf lib $plugin_name
|
cp -Rf lib $plugin_name
|
||||||
cp -Rf vendor $plugin_name
|
cp -Rf vendor $plugin_name
|
||||||
cp -Rf vendor-prefixed $plugin_name
|
cp -Rf vendor-prefixed $plugin_name
|
||||||
|
@@ -48,7 +48,9 @@
|
|||||||
],
|
],
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"MailPoet\\": "lib/",
|
"MailPoet\\": "lib/",
|
||||||
"Sudzy\\": "lib/Util/Sudzy"
|
"MailPoetVendor\\": "vendor-prefixed/",
|
||||||
|
"Sudzy\\": "lib/Util/Sudzy",
|
||||||
|
"MailPoetGenerated\\": "generated/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
2
generated/.gitignore
vendored
Normal file
2
generated/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
@@ -3,7 +3,6 @@
|
|||||||
namespace MailPoet\DI;
|
namespace MailPoet\DI;
|
||||||
|
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\ContainerBuilder;
|
use MailPoetVendor\Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
|
||||||
|
|
||||||
class ContainerFactory {
|
class ContainerFactory {
|
||||||
|
|
||||||
@@ -36,16 +35,4 @@ class ContainerFactory {
|
|||||||
function getConfiguredContainer() {
|
function getConfiguredContainer() {
|
||||||
return $this->configurator->configure(new ContainerBuilder());
|
return $this->configurator->configure(new ContainerBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
function dumpContainer() {
|
|
||||||
$container = $this->createContainer();
|
|
||||||
$container->compile();
|
|
||||||
$dumper = new PhpDumper($container);
|
|
||||||
file_put_contents(
|
|
||||||
__DIR__ . '/' . $this->dump_file,
|
|
||||||
$dumper->dump([
|
|
||||||
'class' => $this->dump_class
|
|
||||||
])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user