X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FCommand%2FYaml%2FMergeCommand.php;h=da655a769111f9b859b6d4c3530ff58340de1178;hb=aea91e65e895364e460983b890e295aa5d5540a5;hp=082509260da58d6caba8ab8d0b8baf467bec671a;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/drupal/console-core/src/Command/Yaml/MergeCommand.php b/vendor/drupal/console-core/src/Command/Yaml/MergeCommand.php index 082509260..da655a769 100644 --- a/vendor/drupal/console-core/src/Command/Yaml/MergeCommand.php +++ b/vendor/drupal/console-core/src/Command/Yaml/MergeCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; +use Symfony\Component\Filesystem\Filesystem; class MergeCommand extends Command { @@ -44,10 +45,28 @@ class MergeCommand extends Command $yaml = new Parser(); $dumper = new Dumper(); - $final_yaml = array(); + $final_yaml = []; $yaml_destination = realpath($input->getArgument('yaml-destination')); $yaml_files = $input->getArgument('yaml-files'); + if (!$yaml_destination) { + $fs = new Filesystem(); + try { + $fs->touch($input->getArgument('yaml-destination')); + $yaml_destination = realpath($input->getArgument('yaml-destination')); + } catch (\Exception $e) { + $io->error( + sprintf( + '%s: %s', + $this->trans('commands.yaml.merge.messages.error-writing'), + $e->getMessage() + ) + ); + + return; + } + } + if (count($yaml_files) < 2) { $io->error($this->trans('commands.yaml.merge.messages.two-files-required')); @@ -155,7 +174,7 @@ class MergeCommand extends Command $yaml_files = $input->getArgument('yaml-files'); if (!$yaml_files) { - $yaml_files = array(); + $yaml_files = []; while (true) { // Set the string key based on among files provided