Add ./do container:dump command and run it within build

[MAILPOET-1605]
This commit is contained in:
Rostislav Wolny 2018-10-31 11:45:07 +01:00
parent f39c0c58c2
commit 9eb586b8e6
4 changed files with 23 additions and 0 deletions

View File

@ -25,3 +25,4 @@ WP_TEST_MAILER_SMTP_PASSWORD=""
WP_SVN_USERNAME=""
WP_SVN_PASSWORD=""
WP_TRANSIFEX_API_TOKEN=""
WP_ROOT = ""

View File

@ -94,6 +94,8 @@ $ ./do delete:docker # stop and remove all running docker containers.
$ ./do qa:lint # PHP code linter.
$ ./do qa:lint:javascript # JS code linter.
$ ./do qa # PHP and JS linters.
$ ./do container:dump # Dumps DI container.
```
# Coding and Testing

View File

@ -282,6 +282,21 @@ class RoboFile extends \Robo\Tasks {
return $this->_exec('vendor/bin/codecept run integration -g failed');
}
function containerDump() {
$this->say('Deleting DI Container');
$this->_exec('rm -f ./lib/DI/CachedContainer.php');
$this->say('Generating DI container cache');
$this->loadEnv();
define('ABSPATH', getenv('WP_ROOT') . '/');
if (!file_exists(ABSPATH . 'wp-config.php')) {
$this->yell('WP_ROOT env variable does not contain valid path to wordpress root.', 40, 'red');
exit(1);
}
require_once __DIR__ . '/vendor/autoload.php';
$container_factory = new \MailPoet\DI\ContainerFactory();
$container_factory->dumpContainer();
}
function qa() {
$collection = $this->collectionBuilder();
$collection->addCode(array($this, 'qaLint'));

View File

@ -22,6 +22,11 @@ test -d node_modules && rm -rf node_modules
npm install
./do compile:all --env production
# Dependency injection container cache.
echo '[BUILD] Building DI Container cache'
./composer.phar install
./do container:dump
# Production libraries.
echo '[BUILD] Fetching production libraries'
test -d vendor && rm -rf vendor