Commit c85bb69e authored by Hendrik Heneke's avatar Hendrik Heneke
Browse files

Allow creating of text files.

parent ecd9ded2
Pipeline #373 passed with stage
in 32 seconds
<?php <?php
$pharName = 'cfgen.phar'; $pharName = 'cfgen.phar';
unlink($pharName);
$p = new Phar($pharName, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, $pharName); $p = new Phar($pharName, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, $pharName);
$p->startBuffering(); $p->startBuffering();
$p->setStub("#!/usr/bin/env php\n<?php Phar::mapPhar(); include \"phar://$pharName/src/cfgen.php\"; __HALT_COMPILER(); ?>"); $p->setStub("#!/usr/bin/env php\n<?php Phar::mapPhar(); include \"phar://$pharName/src/cfgen.php\"; __HALT_COMPILER(); ?>");
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
"scripts": { "scripts": {
"build:phar": "php -d phar.readonly=0 build-phar.php", "build:phar": "php -d phar.readonly=0 build-phar.php",
"test-run:bin": "bin/cfgen generate-configs --env test --project fixture --overwrite", "test-run:bin": "bin/cfgen generate-configs --env test --project fixture --overwrite",
"test-run:phar": "build/cfgen.phar generate-configs --env test --project fixture --overwrite", "test-run:phar": "php cfgen.phar generate-configs --env test --project fixture --overwrite",
"php-cs:check": "php-cs-fixer fix --dry-run --stop-on-violation --using-cache=no --rules=-line_ending src", "php-cs:check": "php-cs-fixer fix --dry-run --stop-on-violation --using-cache=no --rules=-line_ending src",
"php-cs:fix": "php-cs-fixer fix --using-cache=no src" "php-cs:fix": "php-cs-fixer fix --using-cache=no src"
} }
......
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
"values": "./cfgen/users.values.json", "values": "./cfgen/users.values.json",
"destination": "./output/users.json" "destination": "./output/users.json"
}, },
"users.txt": {
"type": "text",
"template": "./cfgen/users.txt.hbs",
"values": "./cfgen/users.values.json",
"destination": "./output/users.txt"
},
"users.yaml": { "users.yaml": {
"type": "yaml", "type": "yaml",
"template": "./cfgen/users.yaml.hbs", "template": "./cfgen/users.yaml.hbs",
......
{{#each users}}
users_{{this.username}}='{{password_hash_bcrypt this.password}}'
users_{{this.username}}_cleartext='{{this.password}}'
{{/each}}
version=2
secret='{{this.secret}}'
<?php
declare(strict_types=1);
namespace HHIT\ConfigGenerator\Generator\Validator;
class NoOpValidator implements ValidatorInterface
{
public function validate(string $content)
{
// noop
}
}
...@@ -10,6 +10,8 @@ class ValidatorFactory ...@@ -10,6 +10,8 @@ class ValidatorFactory
switch ($type) { switch ($type) {
case 'json': case 'json':
return new JSONValidator(); return new JSONValidator();
case 'text':
return new NoOpValidator();
case 'yaml': case 'yaml':
return new YamlValidator(); return new YamlValidator();
default: default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment