mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-05 19:05:33 +01:00
Render a simple template
This commit is contained in:
parent
c476543f5c
commit
31614e0f58
5 changed files with 82 additions and 67 deletions
|
@ -9,7 +9,10 @@ use Symfony\Component\Console\Command\Command;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
#[AsCommand(
|
||||
description: 'Build configuration files',
|
||||
|
@ -25,8 +28,11 @@ final class BuildConfigurationCommand extends Command
|
|||
$io = new SymfonyStyle($input, $output);
|
||||
$io->info("Building configuration for {$buildYaml['name']}.");
|
||||
|
||||
// Parse its contents.
|
||||
// Generate the appropriate configuration files.
|
||||
$twig = new Environment(new FilesystemLoader([__DIR__.'/../../../templates']));
|
||||
$output = $twig->render('test.twig', $buildYaml);
|
||||
|
||||
$fs = new Filesystem();
|
||||
$fs->dumpFile('test.txt', $output);
|
||||
//
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue