-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #483 from KnpLabs/v2-unstable-bundle-config
feat: add bundle configuration
- Loading branch information
Showing
13 changed files
with
461 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM composer:2.6.3 as composer | ||
|
||
############################### | ||
|
||
FROM php:8.2.10-fpm-alpine3.18 | ||
|
||
WORKDIR /src | ||
|
||
COPY --from=composer /usr/bin/composer /usr/bin/composer | ||
|
||
COPY ./entrypoint /usr/local/share/entrypoint | ||
COPY ./src /src | ||
|
||
ENTRYPOINT ["/usr/local/share/entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
IMAGE_TAG:=knplabs/snappy:test | ||
|
||
.PHONY: build | ||
build: | ||
docker build ./ -t "${IMAGE_TAG}" | ||
|
||
.PHONY: test | ||
test: build | ||
$(MAKE) -C src/Bundle test IMAGE_TAG="${IMAGE_TAG}" ARGS="${ARGS}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
set -o pipefail | ||
set -o errexit | ||
|
||
(cd /src/Bundle && composer install) | ||
|
||
exec "${@}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/spec/ export-ignore | ||
/Tests/ export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/composer.lock | ||
/vendor | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KnpLabs\Snappy\Bundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder('snappy'); | ||
|
||
$treeBuilder->getRootNode() | ||
->children() | ||
->arrayNode('backends') | ||
->useAttributeAsKey('name') | ||
->arrayPrototype() | ||
->children() | ||
->scalarNode('driver') | ||
->isRequired() | ||
->validate() | ||
->ifNotInArray(['wkhtmltopdf', 'chromium']) | ||
->thenInvalid('Invalid backend driver %s') | ||
->end() | ||
->end() | ||
->integerNode('timeout') | ||
->min(1) | ||
->defaultValue(30) | ||
->end() | ||
->scalarNode('binary_path') | ||
->isRequired() | ||
->cannotBeEmpty() | ||
->end() | ||
->arrayNode('options') | ||
->useAttributeAsKey('name') | ||
->scalarPrototype()->end() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
; | ||
|
||
return $treeBuilder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KnpLabs\Snappy\Bundle\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
|
||
class SnappyExtension extends Extension | ||
{ | ||
public function load(array $config, ContainerBuilder $container): void | ||
{ | ||
foreach($config['backends'] as $backend) { | ||
// @TODO: load backend services | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.PHONY: test | ||
test: | ||
docker run --rm -i -w /src/Bundle -v "$(shell pwd)/../:/src" "${IMAGE_TAG}" vendor/bin/phpunit $(ARGS) -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace KnpLabs\Snappy\Bundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\AbstractBundle; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class SnappyBundle extends AbstractBundle | ||
class SnappyBundle extends Bundle | ||
{ | ||
|
||
} |
Oops, something went wrong.