Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vrt command fixes #56

Draft
wants to merge 3 commits into
base: 3.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Robo/Plugin/Commands/GetFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
6 changes: 5 additions & 1 deletion src/Robo/Plugin/Commands/VrtGenbackstopConfCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
14 changes: 11 additions & 3 deletions src/Robo/Plugin/Commands/VrtLocalEnvConfigureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = [
Expand All @@ -36,14 +41,17 @@ 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();
$this->taskExec('lando ssh -s backstopserver -c "cd /app/web/ && backstop init"')->run();

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();
$this->taskExec('ddev restart')->run();
$this->taskExec('ddev backstop init')->run();

if($overrideConfig) {
$this->taskExec('ddev backstop init')->run();
}
}
}
}