From 7f8d92388e34c1241bce3dee50790c1bb767bb9a Mon Sep 17 00:00:00 2001 From: Rodrigo Espinoza Date: Fri, 27 Sep 2024 16:23:44 -0600 Subject: [PATCH 1/3] now setting up backstop data folder in the right way --- src/Robo/Plugin/Commands/VrtGenbackstopConfCommand.php | 6 +++++- src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Robo/Plugin/Commands/VrtGenbackstopConfCommand.php b/src/Robo/Plugin/Commands/VrtGenbackstopConfCommand.php index 374b065..03ad7b5 100644 --- a/src/Robo/Plugin/Commands/VrtGenbackstopConfCommand.php +++ b/src/Robo/Plugin/Commands/VrtGenbackstopConfCommand.php @@ -37,9 +37,13 @@ public function vrtGenBackstopConf(ConsoleIO $io) { ->textFromFile($this->getLocalEnvRoot() . '/.gitignore') ->appendUnlessMatches('/# FIRE VRT testing/', "# FIRE VRT testing\n") ->appendUnlessMatches('/tests\/backstop\/backstop-local\.json/', "tests/backstop/backstop-local.json\n") - ->appendUnlessMatches('/web\/backstop_data\/\*/', "web/backstop_data/*") + ->appendUnlessMatches('/web\/backstop_data\/bitmaps_reference\/\*/', "web/backstop_data/bitmaps_reference/*\n") + ->appendUnlessMatches('/web\/backstop_data\/bitmaps_test\/\*/', "web/backstop_data/bitmaps_test/*\n") + ->appendUnlessMatches('/web\/backstop_data\/ci_report\/\*/', "web/backstop_data/ci_report/*\n") + ->appendUnlessMatches('/web\/backstop_data\/html_report\/\*/', "web/backstop_data/html_report/*\n") ); + return $tasks; } } diff --git a/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php b/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php index 4fd6864..9c11dc6 100644 --- a/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php +++ b/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php @@ -36,8 +36,13 @@ public function vrtLocalEnvConfigure(ConsoleIO $io) { $landoYamlDump = Yaml::dump($landoConfig, 5, 2); file_put_contents($this->getLocalEnvRoot() . '/.lando.yml', $landoYamlDump); $this->taskExec('lando rebuild -y')->run(); + $overrideConfig = TRUE; + if (file_exists($this->getDrupalRoot() . '/backstop_data')) { + $overrideConfig = $io->confirm('You already have a existing backstop_data folder in: ' . $this->getDrupalRoot() .' , Do you want to override the configuration using the default backstop files?', FALSE); + } + if ($overrideConfig) { $this->taskExec('lando ssh -s backstopserver -c "cd /app/web/ && backstop init"')->run(); - + } } elseif ($env === 'ddev') { $this->taskExec('ddev get fourkitchens/ddev-drupal-backstop')->run(); From d6fca0adb975c9adeb87f75c05e9dc88b984d4c4 Mon Sep 17 00:00:00 2001 From: Rodrigo Espinoza Date: Fri, 27 Sep 2024 16:24:30 -0600 Subject: [PATCH 2/3] Fixing issue with get-files command , now removing old file --- src/Robo/Plugin/Commands/GetFilesCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Robo/Plugin/Commands/GetFilesCommand.php b/src/Robo/Plugin/Commands/GetFilesCommand.php index 7d6b721..28c83eb 100644 --- a/src/Robo/Plugin/Commands/GetFilesCommand.php +++ b/src/Robo/Plugin/Commands/GetFilesCommand.php @@ -85,10 +85,13 @@ private function getFilesAcquia(ConsoleIO $io, $tasks, $remoteSiteName, $remoteE * Helper function to get files from Pantheon. */ private function getFilesPantheon(ConsoleIO $io, array $opts, $tasks, $remoteSiteName, $remoteEnv, $origFilesFolder, $destFilesFolder) { - + $filesName = 'site-files.tar.gz'; if ($this->getCliToolStatus('terminus')) { - $filesName = 'site-files.tar.gz'; + if (!$opts['no-download']) { + if (file_exists($origFilesFolder . '/' . $filesName)) { + $tasks->addTask($this->taskFilesystemStack()->remove($origFilesFolder . '/' . $filesName)); + } $cmd = "terminus backup:get $remoteSiteName.$remoteEnv --element=files --to=$origFilesFolder/$filesName"; $tasks->addTask($this->taskExec($cmd)); } From 8323197e4fb9832863aa67e72464d76df6c387ab Mon Sep 17 00:00:00 2001 From: Rodrigo Espinoza Date: Mon, 30 Sep 2024 12:08:43 -0600 Subject: [PATCH 3/3] IMprovement over Vrt init confirmation --- .../Commands/VrtLocalEnvConfigureCommand.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php b/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php index 9c11dc6..d0e0390 100644 --- a/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php +++ b/src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php @@ -22,6 +22,11 @@ class VrtLocalEnvConfigureCommand extends FireCommandBase { */ public function vrtLocalEnvConfigure(ConsoleIO $io) { $env = Robo::config()->get('local_environment'); + $overrideConfig = TRUE; + if (file_exists($this->getDrupalRoot() . '/backstop_data')) { + $overrideConfig = $io->confirm('You already have a existing backstop_data folder in: ' . $this->getDrupalRoot() . ' , Do you want to override the configuration using the default backstop files? (This step is only normally needed when doing the initial VRT setup)', FALSE); + } + if ($env === 'lando') { $landoConfig = Yaml::parse(file_get_contents($this->getLocalEnvRoot() . '/.lando.yml')); $landoConfig['services']['backstopserver'] = [ @@ -36,10 +41,7 @@ public function vrtLocalEnvConfigure(ConsoleIO $io) { $landoYamlDump = Yaml::dump($landoConfig, 5, 2); file_put_contents($this->getLocalEnvRoot() . '/.lando.yml', $landoYamlDump); $this->taskExec('lando rebuild -y')->run(); - $overrideConfig = TRUE; - if (file_exists($this->getDrupalRoot() . '/backstop_data')) { - $overrideConfig = $io->confirm('You already have a existing backstop_data folder in: ' . $this->getDrupalRoot() .' , Do you want to override the configuration using the default backstop files?', FALSE); - } + if ($overrideConfig) { $this->taskExec('lando ssh -s backstopserver -c "cd /app/web/ && backstop init"')->run(); } @@ -47,8 +49,9 @@ public function vrtLocalEnvConfigure(ConsoleIO $io) { elseif ($env === 'ddev') { $this->taskExec('ddev get fourkitchens/ddev-drupal-backstop')->run(); $this->taskExec('ddev restart')->run(); - $this->taskExec('ddev backstop init')->run(); - + if($overrideConfig) { + $this->taskExec('ddev backstop init')->run(); + } } } }