Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
hhit
config-generator
Commits
c85bb69e
Commit
c85bb69e
authored
Mar 03, 2021
by
Hendrik Heneke
Browse files
Allow creating of text files.
parent
ecd9ded2
Pipeline
#373
passed with stage
in 32 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
1 deletion
+28
-1
build-phar.php
build-phar.php
+1
-0
composer.json
composer.json
+1
-1
fixture/cfgen.json
fixture/cfgen.json
+6
-0
fixture/cfgen/users.txt.hbs
fixture/cfgen/users.txt.hbs
+6
-0
src/Generator/Validator/NoOpValidator.php
src/Generator/Validator/NoOpValidator.php
+12
-0
src/Generator/Validator/ValidatorFactory.php
src/Generator/Validator/ValidatorFactory.php
+2
-0
No files found.
build-phar.php
View file @
c85bb69e
<?php
$pharName
=
'cfgen.phar'
;
unlink
(
$pharName
);
$p
=
new
Phar
(
$pharName
,
FilesystemIterator
::
CURRENT_AS_FILEINFO
|
FilesystemIterator
::
KEY_AS_FILENAME
,
$pharName
);
$p
->
startBuffering
();
$p
->
setStub
(
"#!/usr/bin/env php
\n
<?php Phar::mapPhar(); include
\"
phar://
$pharName
/src/cfgen.php
\"
; __HALT_COMPILER(); ?>"
);
...
...
composer.json
View file @
c85bb69e
...
...
@@ -43,7 +43,7 @@
"scripts"
:
{
"build:phar"
:
"php -d phar.readonly=0 build-phar.php"
,
"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:fix"
:
"php-cs-fixer fix --using-cache=no src"
}
...
...
fixture/cfgen.json
View file @
c85bb69e
...
...
@@ -5,6 +5,12 @@
"values"
:
"./cfgen/users.values.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"
:
{
"type"
:
"yaml"
,
"template"
:
"./cfgen/users.yaml.hbs"
,
...
...
fixture/cfgen/users.txt.hbs
0 → 100644
View file @
c85bb69e
{{#
each
users
}}
users_
{{
this
.
username
}}
='
{{
password_hash_bcrypt
this
.
password
}}
'
users_
{{
this
.
username
}}
_cleartext='
{{
this
.
password
}}
'
{{/
each
}}
version=2
secret='
{{
this
.
secret
}}
'
src/Generator/Validator/NoOpValidator.php
0 → 100644
View file @
c85bb69e
<?php
declare
(
strict_types
=
1
);
namespace
HHIT\ConfigGenerator\Generator\Validator
;
class
NoOpValidator
implements
ValidatorInterface
{
public
function
validate
(
string
$content
)
{
// noop
}
}
src/Generator/Validator/ValidatorFactory.php
View file @
c85bb69e
...
...
@@ -10,6 +10,8 @@ class ValidatorFactory
switch
(
$type
)
{
case
'json'
:
return
new
JSONValidator
();
case
'text'
:
return
new
NoOpValidator
();
case
'yaml'
:
return
new
YamlValidator
();
default
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment