|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the dotfiles project. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Anthonius Munthi <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Dotfiles\Behat; |
|
15
|
|
|
|
|
16
|
|
|
use Behat\Testwork\ServiceContainer\Extension; |
|
17
|
|
|
use Behat\Testwork\ServiceContainer\ExtensionManager; |
|
18
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
|
19
|
|
|
use Symfony\Component\Config\FileLocator; |
|
20
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
21
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
|
22
|
|
|
|
|
23
|
|
|
class DotfilesExtension implements Extension |
|
24
|
|
|
{ |
|
25
|
|
|
public function configure(ArrayNodeDefinition $builder): void |
|
26
|
|
|
{ |
|
27
|
|
|
$builder |
|
28
|
|
|
->addDefaultsIfNotSet() |
|
29
|
|
|
->children() |
|
30
|
|
|
->scalarNode('command_prefix') |
|
31
|
|
|
->defaultValue('dotfiles ') |
|
32
|
|
|
->end() |
|
33
|
|
|
->end() |
|
|
|
|
|
|
34
|
|
|
; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function getConfigKey() |
|
38
|
|
|
{ |
|
39
|
|
|
return 'dotfiles'; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function initialize(ExtensionManager $extensionManager): void |
|
43
|
|
|
{ |
|
44
|
|
|
// TODO: Implement initialize() method. |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* {@inheritdoc} |
|
49
|
|
|
*/ |
|
50
|
|
|
public function load(ContainerBuilder $container, array $config): void |
|
51
|
|
|
{ |
|
52
|
|
|
$locator = new FileLocator(__DIR__.'/Resources'); |
|
53
|
|
|
$loader = new YamlFileLoader($container, $locator); |
|
54
|
|
|
$loader->load('services.yaml'); |
|
55
|
|
|
|
|
56
|
|
|
$container->setParameter('dotfiles.command_prefix', $config['command_prefix']); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function process(ContainerBuilder $container): void |
|
60
|
|
|
{ |
|
61
|
|
|
// TODO: Implement process() method. |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|