Skip to content

Commit

Permalink
Merge pull request #460 from ec-europa/hotfix/DQA-3575
Browse files Browse the repository at this point in the history
DQA-3575: Generate drush file.
  • Loading branch information
jonhy81 authored Feb 22, 2022
2 parents 983e680 + dab7d4d commit ddf06d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
web:
image: fpfis/httpd-php:8.1-dev
image: registry.fpfis.eu/fpfis/httpd-php:8.1-dev
working_dir: ${PWD}
volumes:
- ${PWD}:${PWD}
Expand Down
30 changes: 21 additions & 9 deletions src/TaskRunner/Commands/BuildCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,18 @@ public function buildDist(array $options = [
$tasks[] = $this->taskWriteToFile($options['dist-root'] . '/' . $options['root'] . '/VERSION.txt')->text($tag);

// Copy drush.yml file.
$tk_drush = file_exists('resources/Drush/drush.yml.dist')
? 'resources/Drush/drush.yml.dist'
: 'vendor/ec-europa/toolkit/resources/Drush/drush.yml.dist';
if (file_exists($tk_drush)) {
if ($tk_drush = file_exists('resources/Drush/drush.yml.dist')) {
$tasks[] = $this->taskFilesystemStack()
->copy($tk_drush, $options['dist-root'] . '/web/sites/all/drush/drush.yml');
} else {
$vHost = getenv('VIRTUAL_HOST');
$vHostArray = explode(',', $vHost);
$drush_options['options'] = [
'uri' => reset($vHostArray)
];
$yaml = new Yaml();
$this->taskFilesystemStack()->mkdir($options['dist-root'] . '/web/sites/all/drush');
file_put_contents($options['dist-root'] . '/web/sites/all/drush/drush.yml', $yaml->dump($drush_options));
}

// Collect and execute list of commands set on local runner.yml.
Expand Down Expand Up @@ -185,12 +191,18 @@ public function buildDev(array $options = [
}

// Copy drush.yml file.
$tk_drush = file_exists('resources/Drush/drush.yml.dist')
? 'resources/Drush/drush.yml.dist'
: 'vendor/ec-europa/toolkit/resources/Drush/drush.yml.dist';
if (file_exists($tk_drush)) {
if ($tk_drush = file_exists('resources/Drush/drush.yml.dist')) {
$tasks[] = $this->taskFilesystemStack()
->copy($tk_drush, "$root/sites/all/drush/drush.yml");
->copy($tk_drush, $root . '/sites/all/drush/drush.yml');
} else {
$vHost = getenv('VIRTUAL_HOST');
$vHostArray = explode(',', $vHost);
$drush_options['options'] = [
'uri' => reset($vHostArray)
];
$yaml = new Yaml();
$this->taskFilesystemStack()->mkdir($root . '/sites/all/drush');
file_put_contents($root . '/sites/all/drush/drush.yml', $yaml->dump($drush_options));
}

// Collect and execute list of commands set on local runner.yml.
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/commands/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
->exec('mkdir -p web/sites/default/private_files')
->exec('chmod ug=rwx,o= web/sites/default/private_files')
[Simulator] Simulating Filesystem\FilesystemStack()
->copy('resources/Drush/drush.yml.dist', 'web/sites/all/drush/drush.yml')
->copy(1, 'web/sites/all/drush/drush.yml')
- command: 'toolkit:build-dist --root=web --dist-root=dist --tag=1.0.0 --sha=aBcDeF --keep=vendor --remove=CHANGELOG.txt'
configuration:
Expand Down Expand Up @@ -47,7 +47,7 @@
[Simulator] Simulating File\Write('dist/web/VERSION.txt')
->text('1.0.0')
[Simulator] Simulating Filesystem\FilesystemStack()
->copy('resources/Drush/drush.yml.dist', 'dist/web/sites/all/drush/drush.yml')
->copy(1, 'dist/web/sites/all/drush/drush.yml')
[Simulator] Simulating ExecStack()
->exec('find dist -maxdepth 3 -type f \( -name "CHANGELOG.txt" \) -exec rm -rf {} +')
Expand Down

0 comments on commit ddf06d3

Please sign in to comment.