Skip to content

Commit

Permalink
Merge pull request #93 from openeuropa/OPENEUROPA-1569
Browse files Browse the repository at this point in the history
OPENEUROPA-1569: Task-Runner: Add support in task-runner "process" task arrays (imploded to string with comma delimiter).
  • Loading branch information
drupol authored Feb 8, 2019
2 parents 06bd78b + f21c7e4 commit c4b5725
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/Commands/AbstractDrupalCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

/**
* Class DrupalCommands.
*
* @package OpenEuropa\TaskRunner\Commands
*/
abstract class AbstractDrupalCommands extends AbstractCommands implements FilesystemAwareInterface
{
Expand Down
9 changes: 8 additions & 1 deletion src/Traits/ConfigurationTokensTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace OpenEuropa\TaskRunner\Traits;

use RecursiveArrayIterator;
use RecursiveIteratorIterator;

/**
* Class ConfigurationTokensTrait
*
Expand Down Expand Up @@ -39,7 +42,11 @@ protected function extractProcessedTokens($text)
$config = $this->getConfig();

return array_map(function ($key) use ($config) {
return $config->get($key);
$value = $config->get($key);
if (is_array($value)) {
return implode(',', iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($value))));
}
return $value;
}, $this->extractRawTokens($text));
}
}
7 changes: 7 additions & 0 deletions tests/fixtures/tasks/process-config-file/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@
concat: "${drupal.root}/${drupal.site.profile}"
expected:
concat: "build/standard"

- source:
comma-delimited: "${drupal.account}"
nested-comma-delimited: "${drupal.drush}"
expected:
comma-delimited: "admin,admin,[email protected]"
nested-comma-delimited: "http://127.0.0.1:8888"

0 comments on commit c4b5725

Please sign in to comment.