diff --git a/src/Handler.php b/src/Handler.php index 91e5224e12202509d4aee8953c57b6a49ec41497..2b17ff9a57f9ad1d8b7ef28d050145f9601423c3 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -120,13 +120,15 @@ class Handler { $options['webRoot'] = $webRoot . '/'; $orig_ignored = FALSE; foreach ($this->getFiles($projectRoot, $webRoot, $settingsPath) as $template => $def) { - $file = $def['dest'] . '/' . $template; + $twig_loader->setTemplate($template, $template); + $filename = $twig->render($template, $options); + $file = $def['dest'] . '/' . $filename; if ($overwrite || !$fs->exists($file)) { - $twig_loader->setTemplate($template, file_get_contents($pluginRoot . '/templates/' . $template . '.twig')); - $rendered = $twig->render($template, $options); - if (!empty($def['add2yaml']) && isset($options[$template])) { + $twig_loader->setTemplate($filename, file_get_contents($pluginRoot . '/templates/' . $template . '.twig')); + $rendered = $twig->render($filename, $options); + if (!empty($def['add2yaml']) && isset($options[$filename])) { $yaml = Yaml::parse($rendered); - $yaml = array_merge_recursive($yaml, $options[$template]); + $yaml = array_merge_recursive($yaml, $options[$filename]); $rendered = Yaml::dump($yaml, 9, 2); } if ($fs->exists($file)) { @@ -144,12 +146,12 @@ class Handler { } } else { - $this->git('ignore ' . $template); + $this->git('ignore ' . $filename); } file_put_contents($file, $rendered); } if (isset($def['link']) && ($def['link'] != $settingsPath)) { - $link = $def['link'] . '/' . $template; + $link = $def['link'] . '/' . $filename; if (!$fs->exists($link)) { $rel = substr($fs->makePathRelative($file, $projectRoot . '/' . $link), 3, -1); $fs->symlink($rel, $link); @@ -188,7 +190,7 @@ class Handler { 'drushrc.php' => [ 'dest' => $projectRoot . '/drush', ], - 'aliases.yml' => [ + '{{ projectname }}.alias.yml' => [ 'dest' => $projectRoot . '/drush', 'add2yaml' => TRUE, ], diff --git a/templates/aliases.yml.twig b/templates/aliases.yml.twig deleted file mode 100644 index e63710744301cc5e38ffd5bb99ab34244d431f93..0000000000000000000000000000000000000000 --- a/templates/aliases.yml.twig +++ /dev/null @@ -1,10 +0,0 @@ -sites: - {{ projectname }}: - dev: - root: '/var/www/html/{{ webRoot }}' - uri: '{{ projectname }}.docker.localhost:8000' - live: - root: '{{ live.root }}' - uri: '{{ live.uri }}' - remote-host: '{{ live.host }}' - remote-user: '{{ live.user }}' diff --git a/templates/drush.yml.twig b/templates/drush.yml.twig index 4d920a8b70201f1441b36b4b31f40d56ead0a10c..19436a9e83e1c15d0d3a4a982e9929d5a61ae664 100644 --- a/templates/drush.yml.twig +++ b/templates/drush.yml.twig @@ -1,3 +1,7 @@ +drush: + paths: + include: + - './drush/contrib' options: uri: 'http://{{ projectname }}.docker.localhost:8000' command: diff --git a/templates/{{ projectname }}.alias.yml.twig b/templates/{{ projectname }}.alias.yml.twig new file mode 100644 index 0000000000000000000000000000000000000000..5fdf3ceb80cf838fbcf27b51dab2764deed865d9 --- /dev/null +++ b/templates/{{ projectname }}.alias.yml.twig @@ -0,0 +1,8 @@ +dev: + root: '/var/www/html/{{ webRoot }}' + uri: '{{ projectname }}.docker.localhost:8000' +live: + root: '{{ live.root }}' + uri: '{{ live.uri }}' + host: '{{ live.host }}' + user: '{{ live.user }}'