From 6f5b4f35b964b7283088fc46b310fef7ad6a6ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Wed, 21 Nov 2018 21:53:10 +0100 Subject: [PATCH 1/2] Add support for using composer install commands --- docs/CHANGELOG.md | 5 +++++ payload/recipes/ez_install.bash | 10 +++++++++- src/Command/Docker/Initialize.php | 4 +++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fa071ee..43936ca 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,11 @@ ## CHANGELOG +### ?.?.? + +- Add support for calling composer ezplatform-install (script) on "initialdata" argument + + ### 1.4.0 - Add SOLR_CORES env variable on solr container to define the core(s) name. (default = "collection1") diff --git a/payload/recipes/ez_install.bash b/payload/recipes/ez_install.bash index d14faf2..7b9809b 100755 --- a/payload/recipes/ez_install.bash +++ b/payload/recipes/ez_install.bash @@ -45,7 +45,15 @@ if [ -f app/console ]; then CONSOLE="app/console" fi -$PHP $CONSOLE ezplatform:install $INIT_DATA + +# Prefer install via composer alias (added in v2.2, required for eZ Commerce) +if $COMPOSER run-script -l | grep -q " $INIT_DATA "; then + $COMPOSER run-script $INIT_DATA +else + $PHP $CONSOLE ezplatform:install $INIT_DATA +fi + + echo "Installation OK" diff --git a/src/Command/Docker/Initialize.php b/src/Command/Docker/Initialize.php index 817a145..56f32e0 100644 --- a/src/Command/Docker/Initialize.php +++ b/src/Command/Docker/Initialize.php @@ -57,7 +57,7 @@ protected function configure() $this->setAliases(['docker:init', 'initialize', 'init']); $this->addArgument('repository', InputArgument::OPTIONAL, 'eZ Platform Repository', 'ezsystems/ezplatform'); $this->addArgument('version', InputArgument::OPTIONAL, 'eZ Platform Version', '2.*'); - $this->addArgument('initialdata', InputArgument::OPTIONAL, 'eZ Platform Initial', 'clean'); + $this->addArgument('initialdata', InputArgument::OPTIONAL, 'eZ Platform installer. Composer install script like "ezplatform-install" checked for first, if not using as argument for install command directly)', 'clean'); } /** @@ -190,6 +190,8 @@ protected function innerInitialize( if ('clean' === $initialdata && false !== strpos($repository, 'ezplatform-ee')) { $initialdata = 'ezplatform-ee-clean'; + } elseif ('clean' === $initialdata && false !== strpos($repository, 'ezcommerce')) { + $initialdata = 'ezcommerce-install'; } $executor->eZInstall($input->getArgument('version'), $repository, $initialdata); From 2b60f6e5e285cfbac8cf7a0e5509163e433b1b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Thu, 22 Nov 2018 09:34:42 +0100 Subject: [PATCH 2/2] CS --- src/Command/Docker/Initialize.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Command/Docker/Initialize.php b/src/Command/Docker/Initialize.php index 56f32e0..fcbf5d8 100644 --- a/src/Command/Docker/Initialize.php +++ b/src/Command/Docker/Initialize.php @@ -57,7 +57,12 @@ protected function configure() $this->setAliases(['docker:init', 'initialize', 'init']); $this->addArgument('repository', InputArgument::OPTIONAL, 'eZ Platform Repository', 'ezsystems/ezplatform'); $this->addArgument('version', InputArgument::OPTIONAL, 'eZ Platform Version', '2.*'); - $this->addArgument('initialdata', InputArgument::OPTIONAL, 'eZ Platform installer. Composer install script like "ezplatform-install" checked for first, if not using as argument for install command directly)', 'clean'); + $this->addArgument( + 'initialdata', + InputArgument::OPTIONAL, + 'Installer: If avaiable uses "composer run-script ", if not uses ezplatform:install command', + 'clean' + ); } /**